• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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 <map>
17 #include <securec.h>
18 #include <session.h>
19 #include <string>
20 
21 #include "softbus_bus_center.h"
22 
23 static std::map<std::string, std::map<std::string, const ISessionListener *>> sessionListeners;
24 static std::map<std::string, INodeStateCb *> callbacks_;
25 
OpenSession(const char * mySessionName,const char * peerSessionName,const char * peerDeviceId,const char * groupId,const SessionAttribute * attr)26 int OpenSession(const char *mySessionName, const char *peerSessionName, const char *peerDeviceId, const char *groupId,
27     const SessionAttribute *attr)
28 {
29     return -1;
30 }
31 
SendBytes(int sessionId,const void * data,unsigned int len)32 int SendBytes(int sessionId, const void *data, unsigned int len)
33 {
34     return -1;
35 }
36 
RemoveSessionServer(const char * pkgName,const char * sessionName)37 int RemoveSessionServer(const char *pkgName, const char *sessionName)
38 {
39     const char *invalidSessionName = "INVALID_SESSION_NAME";
40     const char *closeFailedSessionName = "REMOVE_FAILED_SESSION_NAME";
41     if (!strcmp(sessionName, invalidSessionName)) {
42         return -1;
43     }
44     if (!strcmp(sessionName, closeFailedSessionName)) {
45         return -1;
46     }
47     return 0;
48 }
GetMySessionName(int sessionId,char * sessionName,unsigned int len)49 int GetMySessionName(int sessionId, char *sessionName, unsigned int len)
50 {
51     return -1;
52 }
GetPeerSessionName(int sessionId,char * sessionName,unsigned int len)53 int GetPeerSessionName(int sessionId, char *sessionName, unsigned int len)
54 {
55     return 0;
56 }
GetPeerDeviceId(int sessionId,char * devId,unsigned int len)57 int GetPeerDeviceId(int sessionId, char *devId, unsigned int len)
58 {
59     return 0;
60 }
CloseSession(int sessionId)61 void CloseSession(int sessionId){};
GetSessionSide(int sessionId)62 int GetSessionSide(int sessionId)
63 {
64     return 1;
65 };
66 
GetLocalNodeDeviceInfo(const char * pkgName,NodeBasicInfo * info)67 int32_t GetLocalNodeDeviceInfo(const char *pkgName, NodeBasicInfo *info)
68 {
69     return -1;
70 }
71 
GetAllNodeDeviceInfo(const char * pkgName,NodeBasicInfo ** info,int32_t * infoNum)72 int32_t GetAllNodeDeviceInfo(const char *pkgName, NodeBasicInfo **info, int32_t *infoNum)
73 {
74     return -1;
75 }
76 
GetNodeKeyInfo(const char * pkgName,const char * networkId,NodeDeviceInfoKey key,uint8_t * info,int32_t infoLen)77 int32_t GetNodeKeyInfo(const char *pkgName, const char *networkId, NodeDeviceInfoKey key, uint8_t *info,
78                        int32_t infoLen)
79 {
80     return -1;
81 }
82 
CreateSessionServer(const char * pkgName,const char * sessionName,const ISessionListener * listener)83 int CreateSessionServer(const char *pkgName, const char *sessionName, const ISessionListener *listener)
84 {
85     const char *invalidSessionName = "INVALID_SESSION_NAME";
86     if (!strcmp(sessionName, invalidSessionName)) {
87         return -1;
88     }
89     return 0;
90 }