// // Created by xajhuang on 2023/4/19. // #ifndef VCPE_MAIN_H #define VCPE_MAIN_H #include "uthash/uthash.h" typedef enum { COL_INDEX = 0, COL_MAC, COL_HOSTNAME, COL_DISCOVER, COL_OFFER, COL_REQUEST, COL_ACK, COL_RESULT, COL_STATUS, COL_ATTR_EDITABLE, NUM_COLS } COL_NAME; typedef enum { STEP_BEGIN = 0, STEP_DISCOVER, STEP_OFFER, STEP_REQUEST, STEP_ACK, STEP_END, } DHCP_STEP; typedef enum { STA_WAIT_START = 0, STA_SEND_REQ, STA_RECV_RSP, STA_FINISHED, } DHCP_STATUS; typedef struct { U8 *p; int buf_size; } BUF_INFO, *PBUF_INFO; typedef struct { U32 index; U32 vni; U8 mac[6]; S8 hostname[64]; DHCP_STEP step; DHCP_STATUS status; BUF_INFO pDiscBuf; BUF_INFO pOfferBuf; BUF_INFO pReqBuf; BUF_INFO pAckBuf; UT_hash_handle hh; } DHCP_INFO, *PDHCP_INFO; U32 rand_number(); int dhcp_tools_init_network(const char *pNicName); U8 *dhcp_create_discover_req(PDHCP_INFO pInfo, int *pOutSize); #endif //VCPE_MAIN_H