1 /* 2 * Copyright (c) 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 SOFTBUS_RESOURCE_QUERY_STRUCT_H 17 #define SOFTBUS_RESOURCE_QUERY_STRUCT_H 18 19 #include <stdint.h> 20 #include "softbus_common.h" 21 #include "trans_type.h" 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 #define RESOURCE_IP_LEN 32 28 #define UDIDHASH_HEX_STR_LEN 16 29 30 typedef enum { 31 TRIGGER_TYPE_ACTION, 32 TRIGGER_TYPE_COAP, 33 TRIGGER_TYPE_BLE, 34 TRIGGER_TYPE_BR, 35 TRIGGER_TYPE_BUTT, 36 } TriggerType; 37 38 typedef struct { 39 TriggerType type; 40 union { 41 uint32_t actionMac; 42 char brMac[BT_MAC_LEN]; 43 char ip[IP_STR_MAX_LEN]; 44 char bleMac[BT_MAC_LEN]; 45 } addrInfo; 46 char udidHash[UDIDHASH_HEX_STR_LEN + 1]; 47 } TriggerAddr; 48 49 typedef enum { 50 IDENTIFY_DEV_ID, 51 IDENTIFY_DEV_ADDR, 52 IDENTIFY_DEV_BUTT, 53 } DevIdentifier; 54 55 typedef struct { 56 DevIdentifier devIdentifier; 57 union { 58 TriggerAddr peerAddr; 59 char peerNetworkId[NETWORK_ID_BUF_LEN]; 60 } identifyInfo; 61 TransDataType dataType[DATA_TYPE_BUTT]; 62 } SoftBusResourceRequest; 63 64 typedef struct { 65 uint8_t peerNetworkIdCnt; 66 char (*peerNetworkIdArr)[NETWORK_ID_BUF_LEN]; 67 uint8_t peerIpCnt; 68 char (*peerIpArr)[RESOURCE_IP_LEN]; 69 } ConflictInfo; 70 71 #ifdef __cplusplus 72 } 73 #endif 74 75 #endif // SOFTBUS_RESOURCE_QUERY_STRUCT_H