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 LNN_BUS_CENTER_IPC_H
17 #define LNN_BUS_CENTER_IPC_H
18 
19 #include <stdbool.h>
20 #include <stdint.h>
21 
22 #include "data_level.h"
23 #include "softbus_bus_center.h"
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
29 int32_t LnnIpcInit(void);
30 void LnnIpcDeinit(void);
31 int32_t LnnIpcServerJoin(const char *pkgName, int32_t callingPid, void *addr, uint32_t addrTypeLen);
32 int32_t LnnIpcServerLeave(const char *pkgName, int32_t callingPid, const char *networkId);
33 int32_t LnnIpcGetAllOnlineNodeInfo(const char *pkgName, void **info, uint32_t infoTypeLen, int32_t *infoNum);
34 int32_t LnnIpcGetLocalDeviceInfo(const char *pkgName, void *info, uint32_t infoTypeLen);
35 int32_t LnnIpcGetNodeKeyInfo(const char *pkgName, const char *networkId, int32_t key, unsigned char *buf, uint32_t len);
36 int32_t LnnIpcSetNodeDataChangeFlag(const char *pkgName, const char *networkId, uint16_t dataChangeFlag);
37 int32_t LnnIpcRegDataLevelChangeCb(const char *pkgName, int32_t callingPid);
38 int32_t LnnIpcUnregDataLevelChangeCb(const char *pkgName, int32_t callingPid);
39 int32_t LnnIpcSetDataLevel(const DataLevel *dataLevel);
40 int32_t LnnIpcGetNodeKeyInfoLen(int32_t key);
41 int32_t LnnIpcStartTimeSync(
42     const char *pkgName, int32_t callingPid, const char *targetNetworkId, int32_t accuracy, int32_t period);
43 int32_t LnnIpcStopTimeSync(const char *pkgName, const char *targetNetworkId, int32_t callingPid);
44 int32_t LnnIpcPublishLNN(const char *pkgName, const PublishInfo *info);
45 int32_t LnnIpcStopPublishLNN(const char *pkgName, int32_t publishId);
46 int32_t LnnIpcRefreshLNN(const char *pkgName, int32_t callingPid, const SubscribeInfo *info);
47 int32_t LnnIpcStopRefreshLNN(const char *pkgName, int32_t callingPid, int32_t refreshId);
48 int32_t LnnIpcActiveMetaNode(const MetaNodeConfigInfo *info, char *metaNodeId);
49 int32_t LnnIpcDeactiveMetaNode(const char *metaNodeId);
50 int32_t LnnIpcGetAllMetaNodeInfo(MetaNodeInfo *infos, int32_t *infoNum);
51 
52 int32_t LnnIpcNotifyJoinResult(void *addr, uint32_t addrTypeLen, const char *networkId, int32_t retCode);
53 int32_t LnnIpcNotifyLeaveResult(const char *networkId, int32_t retCode);
54 int32_t LnnIpcNotifyOnlineState(bool isOnline, void *info, uint32_t infoTypeLen);
55 int32_t LnnIpcNotifyBasicInfoChanged(void *info, uint32_t infoTypeLen, int32_t type);
56 int32_t LnnIpcNotifyNodeStatusChanged(void *info, uint32_t infoTypeLen, int32_t type);
57 int32_t LnnIpcLocalNetworkIdChanged(void);
58 int32_t LnnIpcNotifyDeviceNotTrusted(const char *msg);
59 int32_t LnnIpcNotifyHichainProofException(
60     const char *proofInfo, uint32_t proofLen, uint16_t deviceTypeId, int32_t errCode);
61 int32_t LnnIpcNotifyTimeSyncResult(
62     const char *pkgName, int32_t pid, const void *info, uint32_t infoTypeLen, int32_t retCode);
63 
64 int32_t LnnIpcShiftLNNGear(const char *pkgName, const char *callerId, const char *targetNetworkId,
65     const GearMode *mode);
66 
67 void BusCenterServerDeathCallback(const char *pkgName);
68 
69 #ifdef __cplusplus
70 }
71 #endif
72 #endif /* LNN_L2_BUS_CENTER_IPC_H */
73