• 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 #ifndef INTERFACES_INNERKITS_SOFTBUS_SERVER_H_
17 #define INTERFACES_INNERKITS_SOFTBUS_SERVER_H_
18 
19 #include "discovery_service.h"
20 #include "iremote_broker.h"
21 #include "iremote_object.h"
22 #include "iremote_proxy.h"
23 #include "softbus_bus_center.h"
24 #include "softbus_common.h"
25 #include "softbus_trans_def.h"
26 
27 namespace OHOS {
28 class ISoftBusServer : public IRemoteBroker {
29 public:
30     virtual ~ISoftBusServer() = default;
31 
32     virtual int32_t StartDiscovery(const char *pkgName, const SubscribeInfo *info) = 0;
33     virtual int32_t StopDiscovery(const char *pkgName, int subscribeId) = 0;
34     virtual int32_t PublishService(const char *pkgName, const PublishInfo *info) = 0;
35     virtual int32_t UnPublishService(const char *pkgName, int publishId) = 0;
36     virtual int32_t SoftbusRegisterService(const char *clientPkgName, const sptr<IRemoteObject> &object) = 0;
37 
38     virtual int32_t CreateSessionServer(const char *pkgName, const char *sessionName) = 0;
39     virtual int32_t RemoveSessionServer(const char *pkgName, const char *sessionName) = 0;
40     virtual int32_t OpenSession(const SessionParam *param, TransInfo *info) = 0;
41     virtual int32_t OpenAuthSession(const char *sessionName, const ConnectionAddr *addrInfo) = 0;
42     virtual int32_t NotifyAuthSuccess(int32_t channelId, int32_t channelType) = 0;
43     virtual int32_t CloseChannel(int32_t channelId, int32_t channelType) = 0;
44     virtual int32_t SendMessage(int32_t channelId, int32_t channelType,
45         const void *data, uint32_t len, int32_t msgType) = 0;
46     virtual int32_t JoinLNN(const char *pkgName, void *addr, uint32_t addrTypeLen) = 0;
47     virtual int32_t JoinMetaNode(const char *pkgName, void *addr, CustomData *customData, uint32_t addrTypeLen) = 0;
48     virtual int32_t LeaveLNN(const char *pkgName, const char *networkId) = 0;
49     virtual int32_t LeaveMetaNode(const char *pkgName, const char *networkId) = 0;
50     virtual int32_t GetAllOnlineNodeInfo(const char *pkgName, void **info, uint32_t infoTypeLen, int *infoNum) = 0;
51     virtual int32_t GetLocalDeviceInfo(const char *pkgName, void *info, uint32_t infoTypeLen) = 0;
52     virtual int32_t GetNodeKeyInfo(const char *pkgName, const char *networkId, int key, unsigned char *buf,
53         uint32_t len) = 0;
54     virtual int32_t SetNodeDataChangeFlag(const char *pkgName, const char *networkId, uint16_t dataChangeFlag) = 0;
55     virtual int32_t StartTimeSync(const char *pkgName, const char *targetNetworkId, int32_t accuracy,
56         int32_t period) = 0;
57     virtual int32_t StopTimeSync(const char *pkgName, const char *targetNetworkId) = 0;
58     virtual int32_t QosReport(int32_t channelId, int32_t chanType, int32_t appType, int32_t quality) = 0;
59     virtual int32_t StreamStats(int32_t channelId, int32_t channelType, const StreamSendStats *data) = 0;
60     virtual int32_t RippleStats(int32_t channelId, int32_t channelType, const TrafficStats *data) = 0;
61     virtual int32_t GrantPermission(int uid, int pid, const char *sessionName);
62     virtual int32_t RemovePermission(const char *sessionName);
63     virtual int32_t PublishLNN(const char *pkgName, const PublishInfo *info);
64     virtual int32_t StopPublishLNN(const char *pkgName, int32_t publishId);
65     virtual int32_t RefreshLNN(const char *pkgName, const SubscribeInfo *info);
66     virtual int32_t StopRefreshLNN(const char *pkgName, int32_t refreshId);
67     virtual int32_t ActiveMetaNode(const MetaNodeConfigInfo *info, char *metaNodeId);
68     virtual int32_t DeactiveMetaNode(const char *metaNodeId);
69     virtual int32_t GetAllMetaNodeInfo(MetaNodeInfo *info, int32_t *infoNum);
70     virtual int32_t ShiftLNNGear(const char *pkgName, const char *callerId, const char *targetNetworkId,
71         const GearMode *mode);
72     virtual int32_t GetSoftbusSpecObject(sptr<IRemoteObject> &object);
73 
74 public:
75     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.ISoftBusServer");
76 };
77 } // namespace OHOS
78 
79 #endif // !defined(INTERFACES_INNERKITS_SOFTBUS_SERVER_H_ )