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_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(int32_t channelId,int32_t channelType)68 int32_t ServerIpcCloseChannel(int32_t channelId, int32_t channelType)
69 {
70 return TransCloseChannel(channelId, channelType);
71 }
72
ServerIpcSendMessage(int32_t channelId,int32_t channelType,const void * data,uint32_t len,int32_t msgType)73 int32_t ServerIpcSendMessage(int32_t channelId, int32_t channelType, const void *data, uint32_t len, int32_t msgType)
74 {
75 return TransSendMsg(channelId, channelType, data, len, msgType);
76 }
77
ServerIpcQosReport(int32_t channelId,int32_t chanType,int32_t appType,int32_t quality)78 int32_t ServerIpcQosReport(int32_t channelId, int32_t chanType, int32_t appType, int32_t quality)
79 {
80 (void)channelId;
81 (void)chanType;
82 (void)appType;
83 (void)quality;
84 return SOFTBUS_NOT_IMPLEMENT;
85 }
86
ServerIpcGrantPermission(int uid,int pid,const char * sessionName)87 int32_t ServerIpcGrantPermission(int uid, int pid, const char *sessionName)
88 {
89 (void)uid;
90 (void)pid;
91 (void)sessionName;
92 return SOFTBUS_NOT_IMPLEMENT;
93 }
94
ServerIpcRemovePermission(const char * sessionName)95 int32_t ServerIpcRemovePermission(const char *sessionName)
96 {
97 (void)sessionName;
98 return SOFTBUS_NOT_IMPLEMENT;
99 }
100
ServerIpcStreamStats(int32_t channelId,int32_t channelType,const StreamSendStats * data)101 int32_t ServerIpcStreamStats(int32_t channelId, int32_t channelType, const StreamSendStats *data)
102 {
103 (void)channelId;
104 (void)channelType;
105 (void)data;
106 return SOFTBUS_NOT_IMPLEMENT;
107 }
108
ServerIpcRippleStats(int32_t channelId,int32_t channelType,const TrafficStats * data)109 int32_t ServerIpcRippleStats(int32_t channelId, int32_t channelType, const TrafficStats *data)
110 {
111 (void)channelId;
112 (void)channelType;
113 (void)data;
114 return SOFTBUS_NOT_IMPLEMENT;
115 }
116
ServerIpcEvaluateQos(const char * peerNetworkId,TransDataType dataType,const QosTV * qos,uint32_t qosCount)117 int32_t ServerIpcEvaluateQos(const char *peerNetworkId, TransDataType dataType, const QosTV *qos, uint32_t qosCount)
118 {
119 (void)peerNetworkId;
120 (void)dataType;
121 (void)qos;
122 (void)qosCount;
123 return SOFTBUS_NOT_IMPLEMENT;
124 }