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