1 /*
2  * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #include "trans_server_proxy.h"
17 
18 #include "lnn_connection_addr_utils.h"
19 #include "softbus_def.h"
20 #include "softbus_errcode.h"
21 #include "trans_channel_manager.h"
22 #include "trans_session_manager.h"
23 #include "trans_session_service.h"
24 
TransServerProxyInit(void)25 int32_t TransServerProxyInit(void)
26 {
27     return SOFTBUS_OK;
28 }
29 
TransServerProxyDeInit(void)30 void TransServerProxyDeInit(void)
31 {
32     return;
33 }
34 
ServerIpcCreateSessionServer(const char * pkgName,const char * sessionName)35 int32_t ServerIpcCreateSessionServer(const char *pkgName, const char *sessionName)
36 {
37     return TransCreateSessionServer(pkgName, sessionName, 0, 0);
38 }
39 
ServerIpcRemoveSessionServer(const char * pkgName,const char * sessionName)40 int32_t ServerIpcRemoveSessionServer(const char *pkgName, const char *sessionName)
41 {
42     return TransRemoveSessionServer(pkgName, sessionName);
43 }
44 
ServerIpcOpenSession(const SessionParam * param,TransInfo * info)45 int32_t ServerIpcOpenSession(const SessionParam *param, TransInfo *info)
46 {
47     return TransOpenSession(param, info);
48 }
49 
ServerIpcOpenAuthSession(const char * sessionName,const ConnectionAddr * addrInfo)50 int32_t ServerIpcOpenAuthSession(const char *sessionName, const ConnectionAddr *addrInfo)
51 {
52     if ((sessionName == NULL) || (addrInfo == NULL)) {
53         return SOFTBUS_INVALID_PARAM;
54     }
55 
56     ConnectOption connOpt;
57     if (!LnnConvertAddrToOption(addrInfo, &connOpt)) {
58         return SOFTBUS_MEM_ERR;
59     }
60     return TransOpenAuthChannel(sessionName, &connOpt, "");
61 }
62 
ServerIpcNotifyAuthSuccess(int32_t channelId,int32_t channelType)63 int32_t ServerIpcNotifyAuthSuccess(int32_t channelId, int32_t channelType)
64 {
65     return TransNotifyAuthSuccess(channelId, channelType);
66 }
67 
ServerIpcCloseChannel(const char * sessionName,int32_t channelId,int32_t channelType)68 int32_t ServerIpcCloseChannel(const char *sessionName, int32_t channelId, int32_t channelType)
69 {
70     return TransCloseChannel(sessionName, channelId, channelType);
71 }
72 
ServerIpcCloseChannelWithStatistics(int32_t channelId,int32_t channelType,uint64_t laneId,const void * dataInfo,uint32_t len)73 int32_t ServerIpcCloseChannelWithStatistics(int32_t channelId, int32_t channelType, uint64_t laneId,
74     const void *dataInfo, uint32_t len)
75 {
76     (void)channelId;
77     (void)channelType;
78     (void)laneId;
79     (void)dataInfo;
80     (void)len;
81     return SOFTBUS_NOT_IMPLEMENT;
82 }
83 
ServerIpcReleaseResources(int32_t channelId)84 int32_t ServerIpcReleaseResources(int32_t channelId)
85 {
86     return TransReleaseUdpResources(channelId);
87 }
88 
ServerIpcSendMessage(int32_t channelId,int32_t channelType,const void * data,uint32_t len,int32_t msgType)89 int32_t ServerIpcSendMessage(int32_t channelId, int32_t channelType, const void *data, uint32_t len, int32_t msgType)
90 {
91     return TransSendMsg(channelId, channelType, data, len, msgType);
92 }
93 
ServerIpcQosReport(int32_t channelId,int32_t chanType,int32_t appType,int32_t quality)94 int32_t ServerIpcQosReport(int32_t channelId, int32_t chanType, int32_t appType, int32_t quality)
95 {
96     (void)channelId;
97     (void)chanType;
98     (void)appType;
99     (void)quality;
100     return SOFTBUS_NOT_IMPLEMENT;
101 }
102 
ServerIpcGrantPermission(int uid,int pid,const char * sessionName)103 int32_t ServerIpcGrantPermission(int uid, int pid, const char *sessionName)
104 {
105     (void)uid;
106     (void)pid;
107     (void)sessionName;
108     return SOFTBUS_NOT_IMPLEMENT;
109 }
110 
ServerIpcRemovePermission(const char * sessionName)111 int32_t ServerIpcRemovePermission(const char *sessionName)
112 {
113     (void)sessionName;
114     return SOFTBUS_NOT_IMPLEMENT;
115 }
116 
ServerIpcStreamStats(int32_t channelId,int32_t channelType,const StreamSendStats * data)117 int32_t ServerIpcStreamStats(int32_t channelId, int32_t channelType, const StreamSendStats *data)
118 {
119     (void)channelId;
120     (void)channelType;
121     (void)data;
122     return SOFTBUS_NOT_IMPLEMENT;
123 }
124 
ServerIpcRippleStats(int32_t channelId,int32_t channelType,const TrafficStats * data)125 int32_t ServerIpcRippleStats(int32_t channelId, int32_t channelType, const TrafficStats *data)
126 {
127     (void)channelId;
128     (void)channelType;
129     (void)data;
130     return SOFTBUS_NOT_IMPLEMENT;
131 }
132 
ServerIpcEvaluateQos(const char * peerNetworkId,TransDataType dataType,const QosTV * qos,uint32_t qosCount)133 int32_t ServerIpcEvaluateQos(const char *peerNetworkId, TransDataType dataType, const QosTV *qos, uint32_t qosCount)
134 {
135     (void)peerNetworkId;
136     (void)dataType;
137     (void)qos;
138     (void)qosCount;
139     return SOFTBUS_NOT_IMPLEMENT;
140 }