• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "softbus_server_proxy_standard.h"
17 
18 #include "message_parcel.h"
19 #include "softbus_client_stub.h"
20 #include "softbus_errcode.h"
21 #include "softbus_ipc_def.h"
22 #include "softbus_log.h"
23 
24 namespace OHOS {
25 sptr<IRemoteObject> SoftBusServerProxyFrame::clientCallbackStub_;
26 std::mutex SoftBusServerProxyFrame::instanceLock;
27 
GetRemoteInstance()28 sptr<IRemoteObject> SoftBusServerProxyFrame::GetRemoteInstance()
29 {
30     if (clientCallbackStub_ == nullptr) {
31         std::lock_guard<std::mutex> autoLock(instanceLock);
32         if (clientCallbackStub_ == nullptr) {
33             clientCallbackStub_ = sptr<IRemoteObject>(new (std::nothrow) SoftBusClientStub());
34         }
35     }
36     return clientCallbackStub_;
37 }
38 
StartDiscovery(const char * pkgName,const SubscribeInfo * info)39 int32_t SoftBusServerProxyFrame::StartDiscovery(const char *pkgName, const SubscribeInfo *info)
40 {
41     (void)pkgName;
42     (void)info;
43     return SOFTBUS_OK;
44 }
45 
StopDiscovery(const char * pkgName,int subscribeId)46 int32_t SoftBusServerProxyFrame::StopDiscovery(const char *pkgName, int subscribeId)
47 {
48     (void)pkgName;
49     (void)subscribeId;
50     return SOFTBUS_OK;
51 }
52 
PublishService(const char * pkgName,const PublishInfo * info)53 int32_t SoftBusServerProxyFrame::PublishService(const char *pkgName, const PublishInfo *info)
54 {
55     (void)pkgName;
56     (void)info;
57     return SOFTBUS_OK;
58 }
59 
UnPublishService(const char * pkgName,int publishId)60 int32_t SoftBusServerProxyFrame::UnPublishService(const char *pkgName, int publishId)
61 {
62     (void)pkgName;
63     (void)publishId;
64     return SOFTBUS_OK;
65 }
66 
SoftbusRegisterService(const char * clientPkgName,const sptr<IRemoteObject> & object)67 int32_t SoftBusServerProxyFrame::SoftbusRegisterService(const char *clientPkgName, const sptr<IRemoteObject>& object)
68 {
69     sptr<IRemoteObject> remote = Remote();
70     if (remote == nullptr) {
71         SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "remote is nullptr!");
72         return SOFTBUS_ERR;
73     }
74 
75     sptr<IRemoteObject> clientStub = SoftBusServerProxyFrame::GetRemoteInstance();
76     if (clientStub == nullptr) {
77         SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "client stub is nullptr!");
78         return SOFTBUS_ERR;
79     }
80     MessageParcel data;
81     if (!data.WriteInterfaceToken(GetDescriptor())) {
82         SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "SoftbusRegisterService write InterfaceToken failed!");
83         return SOFTBUS_ERR;
84     }
85     int ret = data.WriteRemoteObject(clientStub);
86     if (!ret) {
87         SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "SoftbusRegisterService write remote object failed!");
88         return SOFTBUS_ERR;
89     }
90     ret = data.WriteCString(clientPkgName);
91     if (!ret) {
92         SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "SoftbusRegisterService write clientPkgName failed!");
93         return SOFTBUS_ERR;
94     }
95 
96     MessageParcel reply;
97     MessageOption option;
98     int32_t err = remote->SendRequest(MANAGE_REGISTER_SERVICE, data, reply, option);
99     if (err != 0) {
100         SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "SoftbusRegisterService send request failed!");
101         return SOFTBUS_ERR;
102     }
103     int32_t serverRet = 0;
104     ret = reply.ReadInt32(serverRet);
105     if (!ret) {
106         SoftBusLog(SOFTBUS_LOG_COMM, SOFTBUS_LOG_ERROR, "SoftbusRegisterService read serverRet failed!");
107         return SOFTBUS_ERR;
108     }
109     return SOFTBUS_OK;
110 }
111 
CreateSessionServer(const char * pkgName,const char * sessionName)112 int32_t SoftBusServerProxyFrame::CreateSessionServer(const char *pkgName, const char *sessionName)
113 {
114     (void)pkgName;
115     (void)sessionName;
116     return SOFTBUS_OK;
117 }
118 
RemoveSessionServer(const char * pkgName,const char * sessionName)119 int32_t SoftBusServerProxyFrame::RemoveSessionServer(const char *pkgName, const char *sessionName)
120 {
121     (void)pkgName;
122     (void)sessionName;
123     return SOFTBUS_OK;
124 }
125 
OpenSession(const SessionParam * param,TransInfo * info)126 int32_t SoftBusServerProxyFrame::OpenSession(const SessionParam *param, TransInfo *info)
127 {
128     (void)param;
129     (void)info;
130     return SOFTBUS_OK;
131 }
132 
OpenAuthSession(const char * sessionName,const ConnectionAddr * addrInfo)133 int32_t SoftBusServerProxyFrame::OpenAuthSession(const char *sessionName, const ConnectionAddr *addrInfo)
134 {
135     (void)sessionName;
136     (void)addrInfo;
137     return SOFTBUS_OK;
138 }
139 
NotifyAuthSuccess(int32_t channelId,int32_t channelType)140 int32_t SoftBusServerProxyFrame::NotifyAuthSuccess(int32_t channelId, int32_t channelType)
141 {
142     (void)channelId;
143     (void)channelType;
144     return SOFTBUS_OK;
145 }
146 
CloseChannel(int32_t channelId,int32_t channelType)147 int32_t SoftBusServerProxyFrame::CloseChannel(int32_t channelId, int32_t channelType)
148 {
149     (void)channelId;
150     (void)channelType;
151     return SOFTBUS_OK;
152 }
153 
SendMessage(int32_t channelId,int32_t channelType,const void * data,uint32_t len,int32_t msgType)154 int32_t SoftBusServerProxyFrame::SendMessage(int32_t channelId, int32_t channelType, const void *data,
155     uint32_t len, int32_t msgType)
156 {
157     (void)channelId;
158     (void)channelType;
159     (void)data;
160     (void)len;
161     (void)msgType;
162     return SOFTBUS_OK;
163 }
164 
JoinLNN(const char * pkgName,void * addr,uint32_t addrTypeLen)165 int32_t SoftBusServerProxyFrame::JoinLNN(const char *pkgName, void *addr, uint32_t addrTypeLen)
166 {
167     (void)pkgName;
168     (void)addr;
169     (void)addrTypeLen;
170     return SOFTBUS_OK;
171 }
172 
JoinMetaNode(const char * pkgName,void * addr,CustomData * customData,uint32_t addrTypeLen)173 int32_t SoftBusServerProxyFrame::JoinMetaNode(const char *pkgName, void *addr, CustomData *customData,
174     uint32_t addrTypeLen)
175 {
176     (void)pkgName;
177     (void)addr;
178     (void)customData;
179     (void)addrTypeLen;
180     return SOFTBUS_OK;
181 }
182 
LeaveLNN(const char * pkgName,const char * networkId)183 int32_t SoftBusServerProxyFrame::LeaveLNN(const char *pkgName, const char *networkId)
184 {
185     (void)pkgName;
186     (void)networkId;
187     return SOFTBUS_OK;
188 }
189 
LeaveMetaNode(const char * pkgName,const char * networkId)190 int32_t SoftBusServerProxyFrame::LeaveMetaNode(const char *pkgName, const char *networkId)
191 {
192     (void)pkgName;
193     (void)networkId;
194     return SOFTBUS_OK;
195 }
196 
GetAllOnlineNodeInfo(const char * pkgName,void ** info,uint32_t infoTypeLen,int * infoNum)197 int32_t SoftBusServerProxyFrame::GetAllOnlineNodeInfo(const char *pkgName, void **info, uint32_t infoTypeLen,
198     int *infoNum)
199 {
200     (void)pkgName;
201     (void)info;
202     (void)infoTypeLen;
203     (void)infoNum;
204     return SOFTBUS_OK;
205 }
206 
GetLocalDeviceInfo(const char * pkgName,void * info,uint32_t infoTypeLen)207 int32_t SoftBusServerProxyFrame::GetLocalDeviceInfo(const char *pkgName, void *info, uint32_t infoTypeLen)
208 {
209     (void)pkgName;
210     (void)info;
211     (void)infoTypeLen;
212     return SOFTBUS_OK;
213 }
214 
GetNodeKeyInfo(const char * pkgName,const char * networkId,int key,unsigned char * buf,uint32_t len)215 int32_t SoftBusServerProxyFrame::GetNodeKeyInfo(const char *pkgName, const char *networkId, int key,
216     unsigned char *buf, uint32_t len)
217 {
218     (void)pkgName;
219     (void)networkId;
220     (void)key;
221     (void)buf;
222     (void)len;
223     return SOFTBUS_OK;
224 }
225 
SetNodeDataChangeFlag(const char * pkgName,const char * networkId,uint16_t dataChangeFlag)226 int32_t SoftBusServerProxyFrame::SetNodeDataChangeFlag(const char *pkgName, const char *networkId,
227     uint16_t dataChangeFlag)
228 {
229     (void)pkgName;
230     (void)networkId;
231     (void)dataChangeFlag;
232     return SOFTBUS_OK;
233 }
234 
StartTimeSync(const char * pkgName,const char * targetNetworkId,int32_t accuracy,int32_t period)235 int32_t SoftBusServerProxyFrame::StartTimeSync(const char *pkgName, const char *targetNetworkId, int32_t accuracy,
236     int32_t period)
237 {
238     (void)pkgName;
239     (void)targetNetworkId;
240     (void)accuracy;
241     (void)period;
242     return SOFTBUS_OK;
243 }
244 
StopTimeSync(const char * pkgName,const char * targetNetworkId)245 int32_t SoftBusServerProxyFrame::StopTimeSync(const char *pkgName, const char *targetNetworkId)
246 {
247     (void)pkgName;
248     (void)targetNetworkId;
249     return SOFTBUS_OK;
250 }
251 
QosReport(int32_t channelId,int32_t chanType,int32_t appType,int32_t quality)252 int32_t SoftBusServerProxyFrame::QosReport(int32_t channelId, int32_t chanType, int32_t appType, int32_t quality)
253 {
254     (void)channelId;
255     (void)chanType;
256     (void)appType;
257     (void)quality;
258     return SOFTBUS_OK;
259 }
260 
StreamStats(int32_t channelId,int32_t channelType,const StreamSendStats * data)261 int32_t SoftBusServerProxyFrame::StreamStats(int32_t channelId, int32_t channelType, const StreamSendStats *data)
262 {
263     (void)channelId;
264     (void)channelType;
265     (void)data;
266     return SOFTBUS_OK;
267 }
268 
RippleStats(int32_t channelId,int32_t channelType,const TrafficStats * data)269 int32_t SoftBusServerProxyFrame::RippleStats(int32_t channelId, int32_t channelType, const TrafficStats *data)
270 {
271     (void)channelId;
272     (void)channelType;
273     (void)data;
274     return SOFTBUS_OK;
275 }
276 } // namespace OHOS
277