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 LNN_DISTRIBUTED_NET_LEDGER_STRUCT_H 17 #define LNN_DISTRIBUTED_NET_LEDGER_STRUCT_H 18 19 #include <stdint.h> 20 21 #include "bus_center_info_key_struct.h" 22 23 #ifdef __cplusplus 24 extern "C" { 25 #endif 26 27 #define INT_TO_STR_SIZE 12 28 #define INVALID_CONNECTION_CODE_VALUE (-1) 29 #define SHORT_UDID_HASH_LEN 8 30 #define SHORT_UDID_HASH_HEX_LEN 16 31 typedef struct { 32 InfoKey key; 33 int32_t (*getInfo)(const char *netWorkId, bool checkOnline, void *info, uint32_t len); 34 } DistributedLedgerKey; 35 36 typedef struct { 37 InfoKey key; 38 int32_t (*getInfo)(const char *netWorkId, bool checkOnline, void *info, uint32_t len, int32_t ifnameIdx); 39 } DistributedLedgerKeyByIfname; 40 41 typedef enum { 42 CATEGORY_UDID, 43 CATEGORY_UUID, 44 CATEGORY_NETWORK_ID, 45 } IdCategory; 46 47 typedef enum { 48 REPORT_NONE, 49 REPORT_CHANGE, 50 REPORT_ONLINE, 51 REPORT_OFFLINE, 52 } ReportCategory; 53 54 #ifdef __cplusplus 55 } 56 #endif 57 58 #endif // LNN_DISTRIBUTED_NET_LEDGER_STRUCT_H