1 /*
2  * Copyright (c) 2021-2024 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 "data_level.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 SoftbusRegisterService(const char *clientPkgName, const sptr<IRemoteObject> &object) = 0;
33 
34     virtual int32_t CreateSessionServer(const char *pkgName, const char *sessionName) = 0;
35     virtual int32_t RemoveSessionServer(const char *pkgName, const char *sessionName) = 0;
36     virtual int32_t OpenSession(const SessionParam *param, TransInfo *info) = 0;
37     virtual int32_t OpenAuthSession(const char *sessionName, const ConnectionAddr *addrInfo) = 0;
38     virtual int32_t NotifyAuthSuccess(int32_t channelId, int32_t channelType) = 0;
39     virtual int32_t CloseChannel(const char *sessionName, int32_t channelId, int32_t channelType) = 0;
40     virtual int32_t CloseChannelWithStatistics(int32_t channelId, int32_t channelType, uint64_t laneId,
41         const void *dataInfo, uint32_t len) = 0;
42     virtual int32_t ReleaseResources(int32_t channelId) = 0;
43     virtual int32_t SendMessage(int32_t channelId, int32_t channelType,
44         const void *data, uint32_t len, int32_t msgType) = 0;
45     virtual int32_t JoinLNN(const char *pkgName, void *addr, uint32_t addrTypeLen) = 0;
46     virtual int32_t LeaveLNN(const char *pkgName, const char *networkId) = 0;
47     virtual int32_t GetAllOnlineNodeInfo(const char *pkgName, void **info, uint32_t infoTypeLen, int *infoNum) = 0;
48     virtual int32_t GetLocalDeviceInfo(const char *pkgName, void *info, uint32_t infoTypeLen) = 0;
49     virtual int32_t GetNodeKeyInfo(const char *pkgName, const char *networkId, int key, unsigned char *buf,
50         uint32_t len) = 0;
51     virtual int32_t SetNodeDataChangeFlag(const char *pkgName, const char *networkId, uint16_t dataChangeFlag) = 0;
52     virtual int32_t RegDataLevelChangeCb(const char *pkgName) = 0;
53     virtual int32_t UnregDataLevelChangeCb(const char *pkgName) = 0;
54     virtual int32_t SetDataLevel(const DataLevel *dataLevel) = 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     virtual int32_t GetBusCenterExObj(sptr<IRemoteObject> &object);
74     virtual int32_t EvaluateQos(const char *peerNetworkId, TransDataType dataType, const QosTV *qos,
75         uint32_t qosCount) = 0;
76 
77 public:
78     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.ISoftBusServer");
79 };
80 } // namespace OHOS
81 
82 #endif // INTERFACES_INNERKITS_SOFTBUS_SERVER_H_