71 lines
1.4 KiB
C
71 lines
1.4 KiB
C
//
|
|
// Created by xajhuang on 2023/3/23.
|
|
//
|
|
|
|
#ifndef VCPE_IP_POOL_H
|
|
#define VCPE_IP_POOL_H
|
|
#include <uthash/uthash.h>
|
|
#include <common.h>
|
|
#include <bitset/bitset.h>
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/**
|
|
* key format FFFFFFF-FFFFFFF
|
|
* minAddr-maxAddr
|
|
* Hex format string
|
|
*/
|
|
#define MAX_POOL_HASH_KEY (18)
|
|
|
|
typedef struct POOL_CTX {
|
|
U32 minAddr;
|
|
U32 maxAddr;
|
|
U32 netMask;
|
|
U32 gwAddr;
|
|
U32 primeDNS;
|
|
U32 salveDNS;
|
|
U32 leaseTime;
|
|
|
|
struct POOL_CTX *next, *prev;
|
|
} POOL_CTX, *PPOOL_CTX;
|
|
|
|
typedef struct {
|
|
U32 poolKey;
|
|
U32 minAddr;
|
|
U32 maxAddr;
|
|
U32 netMask;
|
|
U32 gwAddr;
|
|
U32 primeDNS;
|
|
U32 salveDNS;
|
|
U32 leaseTime;
|
|
bitset_t *assignPool;
|
|
UT_hash_handle hh;
|
|
} IPPOOL_INFO, *PIPPOOL_INFO;
|
|
|
|
typedef struct POOL_INFO {
|
|
U32 minAddr;
|
|
U32 maxAddr;
|
|
U32 netMask;
|
|
U32 gwAddr;
|
|
U32 primeDNS;
|
|
U32 salveDNS;
|
|
U32 leaseTime;
|
|
struct POOL_INFO *next;
|
|
} POOL_INFO, *PPOOL_INFO;
|
|
|
|
typedef struct {
|
|
U32 uid; ///< 用户 ID
|
|
U32 gid; ///< 用户组 ID
|
|
PPOOL_CTX pCtx; ///< 用户配置信息
|
|
|
|
UT_hash_handle hh;
|
|
} POOL_CONFIG, *PPOOL_CONFIG;
|
|
|
|
void init_default_pool();
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
#endif //VCPE_IP_POOL_H
|