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_LOCAL_NET_LEDGER_H 17 #define LNN_LOCAL_NET_LEDGER_H 18 19 #include <pthread.h> 20 #include <stdint.h> 21 22 #include "bus_center_info_key.h" 23 #include "lnn_device_info.h" 24 #include "lnn_node_info.h" 25 26 #ifdef __cplusplus 27 extern "C" { 28 #endif 29 30 typedef enum { 31 LL_INIT_UNKNOWN = 0, 32 LL_INIT_FAIL, 33 LL_INIT_SUCCESS, 34 } LocalLedgerStatus; 35 36 typedef struct { 37 InfoKey key; 38 int32_t maxLen; 39 int32_t (*getInfo)(void *info, uint32_t len); 40 int32_t (*setInfo)(const void *info); 41 } LocalLedgerKey; 42 43 int32_t LnnInitLocalLedger(void); 44 int32_t LnnInitLocalLedgerDelay(void); 45 void LnnDeinitLocalLedger(void); 46 47 const NodeInfo *LnnGetLocalNodeInfo(void); 48 49 #ifdef __cplusplus 50 } 51 #endif 52 53 #endif // LNN_LOCAL_NET_LEDGER_H