1 /*
2 * Copyright (c) 2021-2024 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_error_code.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
TransServerProxyClear(void)35 void TransServerProxyClear(void)
36 {
37 return;
38 }
39
ServerIpcCreateSessionServer(const char * pkgName,const char * sessionName)40 int32_t ServerIpcCreateSessionServer(const char *pkgName, const char *sessionName)
41 {
42 return TransCreateSessionServer(pkgName, sessionName, 0, 0);
43 }
44
ServerIpcRemoveSessionServer(const char * pkgName,const char * sessionName)45 int32_t ServerIpcRemoveSessionServer(const char *pkgName, const char *sessionName)
46 {
47 return TransRemoveSessionServer(pkgName, sessionName);
48 }
49
ServerIpcOpenSession(const SessionParam * param,TransInfo * info)50 int32_t ServerIpcOpenSession(const SessionParam *param, TransInfo *info)
51 {
52 return TransOpenSession(param, info);
53 }
54
ServerIpcOpenAuthSession(const char * sessionName,const ConnectionAddr * addrInfo)55 int32_t ServerIpcOpenAuthSession(const char *sessionName, const ConnectionAddr *addrInfo)
56 {
57 if ((sessionName == NULL) || (addrInfo == NULL)) {
58 return SOFTBUS_INVALID_PARAM;
59 }
60
61 ConnectOption connOpt;
62 if (!LnnConvertAddrToOption(addrInfo, &connOpt)) {
63 return SOFTBUS_MEM_ERR;
64 }
65 ConnectParam param;
66 (void)memset_s(¶m, sizeof(ConnectParam), 0, sizeof(ConnectParam));
67 if (addrInfo->type == CONNECTION_ADDR_BLE) {
68 param.blePriority = addrInfo->info.ble.priority;
69 }
70
71 return TransOpenAuthChannel(sessionName, &connOpt, "", ¶m);
72 }
73
ServerIpcNotifyAuthSuccess(int32_t channelId,int32_t channelType)74 int32_t ServerIpcNotifyAuthSuccess(int32_t channelId, int32_t channelType)
75 {
76 return TransNotifyAuthSuccess(channelId, channelType);
77 }
78
ServerIpcCloseChannel(const char * sessionName,int32_t channelId,int32_t channelType)79 int32_t ServerIpcCloseChannel(const char *sessionName, int32_t channelId, int32_t channelType)
80 {
81 return TransCloseChannel(sessionName, channelId, channelType);
82 }
83
ServerIpcCloseChannelWithStatistics(int32_t channelId,int32_t channelType,uint64_t laneId,const void * dataInfo,uint32_t len)84 int32_t ServerIpcCloseChannelWithStatistics(int32_t channelId, int32_t channelType, uint64_t laneId,
85 const void *dataInfo, uint32_t len)
86 {
87 (void)channelId;
88 (void)channelType;
89 (void)laneId;
90 (void)dataInfo;
91 (void)len;
92 return SOFTBUS_NOT_IMPLEMENT;
93 }
94
ServerIpcReleaseResources(int32_t channelId)95 int32_t ServerIpcReleaseResources(int32_t channelId)
96 {
97 return TransReleaseUdpResources(channelId);
98 }
99
ServerIpcSendMessage(int32_t channelId,int32_t channelType,const void * data,uint32_t len,int32_t msgType)100 int32_t ServerIpcSendMessage(int32_t channelId, int32_t channelType, const void *data, uint32_t len, int32_t msgType)
101 {
102 return TransSendMsg(channelId, channelType, data, len, msgType);
103 }
104
ServerIpcQosReport(int32_t channelId,int32_t chanType,int32_t appType,int32_t quality)105 int32_t ServerIpcQosReport(int32_t channelId, int32_t chanType, int32_t appType, int32_t quality)
106 {
107 (void)channelId;
108 (void)chanType;
109 (void)appType;
110 (void)quality;
111 return SOFTBUS_NOT_IMPLEMENT;
112 }
113
ServerIpcGrantPermission(int uid,int pid,const char * sessionName)114 int32_t ServerIpcGrantPermission(int uid, int pid, const char *sessionName)
115 {
116 (void)uid;
117 (void)pid;
118 (void)sessionName;
119 return SOFTBUS_NOT_IMPLEMENT;
120 }
121
ServerIpcRemovePermission(const char * sessionName)122 int32_t ServerIpcRemovePermission(const char *sessionName)
123 {
124 (void)sessionName;
125 return SOFTBUS_NOT_IMPLEMENT;
126 }
127
ServerIpcStreamStats(int32_t channelId,int32_t channelType,const StreamSendStats * data)128 int32_t ServerIpcStreamStats(int32_t channelId, int32_t channelType, const StreamSendStats *data)
129 {
130 (void)channelId;
131 (void)channelType;
132 (void)data;
133 return SOFTBUS_NOT_IMPLEMENT;
134 }
135
ServerIpcRippleStats(int32_t channelId,int32_t channelType,const TrafficStats * data)136 int32_t ServerIpcRippleStats(int32_t channelId, int32_t channelType, const TrafficStats *data)
137 {
138 (void)channelId;
139 (void)channelType;
140 (void)data;
141 return SOFTBUS_NOT_IMPLEMENT;
142 }
143
ServerIpcEvaluateQos(const char * peerNetworkId,TransDataType dataType,const QosTV * qos,uint32_t qosCount)144 int32_t ServerIpcEvaluateQos(const char *peerNetworkId, TransDataType dataType, const QosTV *qos, uint32_t qosCount)
145 {
146 (void)peerNetworkId;
147 (void)dataType;
148 (void)qos;
149 (void)qosCount;
150 return SOFTBUS_NOT_IMPLEMENT;
151 }
152
ServerIpcProcessInnerEvent(int32_t eventType,uint8_t * buf,uint32_t len)153 int32_t ServerIpcProcessInnerEvent(int32_t eventType, uint8_t *buf, uint32_t len)
154 {
155 return TransProcessInnerEvent(eventType, buf, len);
156 }
157
ServerIpcPrivilegeCloseChannel(uint64_t tokenId,int32_t pid,const char * peerNetworkId)158 int32_t ServerIpcPrivilegeCloseChannel(uint64_t tokenId, int32_t pid, const char *peerNetworkId)
159 {
160 (void)tokenId;
161 (void)pid;
162 (void)peerNetworkId;
163 return SOFTBUS_NOT_IMPLEMENT;
164 }