• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2025 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 "ble_range.h"
20 #include "data_level.h"
21 #include "iremote_proxy.h"
22 #include "softbus_bus_center.h"
23 #include "softbus_connection.h"
24 #include "softbus_trans_def.h"
25 
26 namespace OHOS {
27 class ISoftBusServer : public IRemoteBroker {
28 public:
29     virtual ~ISoftBusServer() = default;
30 
31     virtual int32_t SoftbusRegisterService(const char *clientPkgName, const sptr<IRemoteObject> &object) = 0;
32     virtual int32_t RegisterBrProxyService(const char *clientPkgName, const sptr<IRemoteObject>& object);
33 
34     virtual int32_t CreateSessionServer(const char *pkgName, const char *sessionName, uint64_t timestamp) = 0;
35     virtual int32_t RemoveSessionServer(const char *pkgName, const char *sessionName, uint64_t timestamp) = 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, bool isForceJoin) = 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 TriggerRangeForMsdp(const char *pkgName, const RangeConfig *config);
73     virtual int32_t StopRangeForMsdp(const char *pkgName, const RangeConfig *config);
74     virtual int32_t RegisterRangeCallbackForMsdp(const char *pkgName) = 0;
75     virtual int32_t UnregisterRangeCallbackForMsdp(const char *pkgName) = 0;
76     virtual int32_t SyncTrustedRelationShip(const char *pkgName, const char *msg, uint32_t msgLen);
77     virtual int32_t GetSoftbusSpecObject(sptr<IRemoteObject> &object);
78     virtual int32_t GetBusCenterExObj(sptr<IRemoteObject> &object);
79     virtual int32_t EvaluateQos(const char *peerNetworkId, TransDataType dataType, const QosTV *qos,
80         uint32_t qosCount) = 0;
81     virtual int32_t ProcessInnerEvent(int32_t eventType, uint8_t *buf, uint32_t len) = 0;
82     virtual int32_t PrivilegeCloseChannel(uint64_t tokenId, int32_t pid, const char *peerNetworkId) = 0;
83     virtual int32_t SetDisplayName(const char *pkgName, const char *nameData, uint32_t len);
84     virtual int32_t CreateServer(const char *pkgName, const char *name);
85     virtual int32_t RemoveServer(const char *pkgName, const char *name);
86     virtual int32_t Connect(const char *pkgName, const char *name, const Address *address);
87     virtual int32_t Disconnect(uint32_t handle);
88     virtual int32_t Send(uint32_t handle, const uint8_t *data, uint32_t len);
89     virtual int32_t ConnGetPeerDeviceId(uint32_t handle, char *deviceId, uint32_t len);
90 
91     virtual int32_t OpenBrProxy(const char *brMac, const char *uuid);
92     virtual int32_t CloseBrProxy(int32_t channelId);
93     virtual int32_t SendBrProxyData(int32_t channelId, char *data, uint32_t dataLen);
94     virtual int32_t SetListenerState(int32_t channelId, int32_t type, bool CbEnabled);
95     virtual bool IsProxyChannelEnabled(int32_t uid);
96     virtual int32_t PushRegisterHook();
97 public:
98     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.ISoftBusServer");
99 };
100 } // namespace OHOS
101 
102 #endif // INTERFACES_INNERKITS_SOFTBUS_SERVER_H_