1 /* 2 * Copyright (c) 2021 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_NET_BUILDER_H 17 #define LNN_NET_BUILDER_H 18 19 #include <stdint.h> 20 21 #include "auth_interface.h" 22 #include "lnn_sync_info_manager.h" 23 #include "softbus_bus_center.h" 24 25 #ifdef __cplusplus 26 extern "C" { 27 #endif 28 29 typedef enum { 30 NODE_TYPE_C, 31 NODE_TYPE_L 32 } NodeType; 33 34 typedef struct { 35 ListNode node; 36 ConnectionAddr addr; 37 char networkId[NETWORK_ID_BUF_LEN]; 38 int64_t authId; 39 uint32_t requestId; 40 uint32_t flag; 41 bool needReportFailure; 42 } MetaJoinRequestNode; 43 44 int32_t LnnInitNetBuilder(void); 45 int32_t LnnInitNetBuilderDelay(void); 46 void LnnDeinitNetBuilder(void); 47 48 int32_t LnnNotifyDiscoveryDevice(const ConnectionAddr *addr); 49 void LnnSyncOfflineComplete(LnnSyncInfoType type, const char *networkId, const uint8_t *msg, uint32_t len); 50 int32_t LnnRequestLeaveByAddrType(const bool *type, uint32_t typeLen); 51 int32_t LnnRequestLeaveSpecific(const char *networkId, ConnectionAddrType addrType); 52 int32_t LnnRequestLeaveInvalidConn(const char *oldNetworkId, ConnectionAddrType addrType, const char *newNetworkId); 53 int32_t LnnRequestCleanConnFsm(uint16_t connFsmId); 54 int32_t LnnNotifyNodeStateChanged(const ConnectionAddr *addr); 55 int32_t LnnNotifyMasterElect(const char *networkId, const char *masterUdid, int32_t masterWeight); 56 int32_t LnnNotifyAuthHandleLeaveLNN(int64_t authId); 57 int32_t LnnUpdateNodeAddr(const char *addr); 58 AuthVerifyCallback *LnnGetVerifyCallback(void); 59 AuthVerifyCallback *LnnGetMetaVerifyCallback(void); 60 61 #ifdef __cplusplus 62 } 63 #endif 64 65 #endif