1 /*
2 * Copyright (c) 2021 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 "softbus_def.h"
19 #include "softbus_errcode.h"
20 #include "trans_channel_manager.h"
21 #include "trans_session_manager.h"
22 #include "trans_session_service.h"
23
TransServerProxyInit(void)24 int32_t TransServerProxyInit(void)
25 {
26 return SOFTBUS_OK;
27 }
28
TransServerProxyDeInit(void)29 void TransServerProxyDeInit(void)
30 {
31 return;
32 }
33
ServerIpcCreateSessionServer(const char * pkgName,const char * sessionName)34 int32_t ServerIpcCreateSessionServer(const char *pkgName, const char *sessionName)
35 {
36 return TransCreateSessionServer(pkgName, sessionName, 0, 0);
37 }
38
ServerIpcRemoveSessionServer(const char * pkgName,const char * sessionName)39 int32_t ServerIpcRemoveSessionServer(const char *pkgName, const char *sessionName)
40 {
41 return TransRemoveSessionServer(pkgName, sessionName);
42 }
43
ServerIpcOpenSession(const SessionParam * param,TransInfo * info)44 int32_t ServerIpcOpenSession(const SessionParam *param, TransInfo *info)
45 {
46 return TransOpenSession(param, info);
47 }
48
ServerIpcOpenAuthSession(const char * sessionName,const ConnectionAddr * addrInfo)49 int32_t ServerIpcOpenAuthSession(const char *sessionName, const ConnectionAddr *addrInfo)
50 {
51 if ((sessionName == NULL) || (addrInfo == NULL)) {
52 return SOFTBUS_INVALID_PARAM;
53 }
54
55 ConnectOption connOpt;
56 if (!LnnConvertAddrToOption(addrInfo, &connOpt)) {
57 return SOFTBUS_ERR;
58 }
59 return TransOpenAuthChannel(sessionName, &connOpt);
60 }
61
ServerIpcNotifyAuthSuccess(int channelId)62 int32_t ServerIpcNotifyAuthSuccess(int channelId)
63 {
64 return TransNotifyAuthSuccess(channelId);
65 }
66
ServerIpcCloseChannel(int32_t channelId,int32_t channelType)67 int32_t ServerIpcCloseChannel(int32_t channelId, int32_t channelType)
68 {
69 return TransCloseChannel(channelId, channelType);
70 }
71
ServerIpcSendMessage(int32_t channelId,int32_t channelType,const void * data,uint32_t len,int32_t msgType)72 int32_t ServerIpcSendMessage(int32_t channelId, int32_t channelType, const void *data, uint32_t len, int32_t msgType)
73 {
74 return TransSendMsg(channelId, channelType, data, len, msgType);
75 }
76
ServerIpcQosReport(int32_t channelId,int32_t chanType,int32_t appType,int32_t quality)77 int32_t ServerIpcQosReport(int32_t channelId, int32_t chanType, int32_t appType, int32_t quality)
78 {
79 (void)channelId;
80 (void)chanType;
81 (void)appType;
82 (void)quality;
83 return SOFTBUS_NOT_IMPLEMENT;
84 }
85