1 /* 2 * Copyright (c) 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_LANE_LINK_CONFLICT_H 17 #define LNN_LANE_LINK_CONFLICT_H 18 19 #include "lnn_lane_interface.h" 20 #include "softbus_common.h" 21 #include "softbus_def.h" 22 23 #define CONFLICT_DEV_IP_LEN 32 24 #define CONFLICT_UDIDHASH_STR_LEN 16 25 26 #ifdef __cplusplus 27 extern "C" { 28 #endif 29 30 typedef enum { 31 CONFLICT_THREE_VAP = 0, 32 CONFLICT_ROLE, 33 CONFLICT_LINK_NUM_LIMITED, 34 CONFLICT_SOFTAP, 35 CONFLICT_BUTT, 36 } LinkConflictType; 37 38 typedef enum { 39 IDENTIFY_TYPE_DEV_ID = 0, 40 IDENTIFY_TYPE_UDID_HASH, 41 IDENTIFY_TYPE_BUTT, 42 } DevIdentifyType; 43 44 typedef struct { 45 DevIdentifyType type; 46 union { 47 char peerDevId[NETWORK_ID_BUF_LEN]; 48 char udidHash[CONFLICT_UDIDHASH_STR_LEN + 1]; 49 } devInfo; 50 } DevIdentifyInfo; 51 52 typedef struct { 53 ListNode node; 54 DevIdentifyInfo identifyInfo; 55 LaneLinkType releaseLink; 56 LinkConflictType conflictType; 57 uint8_t devIdCnt; 58 char (*devIdList)[NETWORK_ID_BUF_LEN]; 59 uint8_t devIpCnt; 60 char (*devIpList)[CONFLICT_DEV_IP_LEN]; 61 } LinkConflictInfo; 62 63 int32_t InitLaneLinkConflict(void); 64 void DeinitLaneLinkConflict(void); 65 LinkConflictType GetConflictTypeWithErrcode(int32_t conflictErrcode); 66 int32_t AddLinkConflictInfo(const LinkConflictInfo *inputInfo); 67 int32_t DelLinkConflictInfo(const DevIdentifyInfo *inputInfo, LinkConflictType conflictType); 68 int32_t FindLinkConflictInfoByDevId(const DevIdentifyInfo *inputInfo, LinkConflictType conflictType, 69 LinkConflictInfo *outputInfo); 70 void RemoveConflictInfoTimelinessMsg(const DevIdentifyInfo *inputInfo, LinkConflictType conflictType); 71 int32_t CheckLinkConflictByReleaseLink(LaneLinkType releaseLink); 72 73 #ifdef __cplusplus 74 } 75 #endif 76 #endif // LNN_LANE_LINK_CONFLICT_H 77