mirror of
git://git.code.sf.net/p/xtables-addons/xtables-addons
synced 2025-09-20 11:34:57 +02:00
ACCOUNT: move private struct declarations into .c file
This commit is contained in:
@@ -42,6 +42,68 @@
|
||||
#error "ipt_ACCOUNT needs at least a PAGE_SIZE of 4096"
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Internal table structure, generated by check_entry()
|
||||
* @name: name of the table
|
||||
* @ip: base IP address of the network
|
||||
* @mask: netmask of the network
|
||||
* @depth: size of network (0: 8-bit, 1: 16-bit, 2: 24-bit)
|
||||
* @refcount: refcount of the table; if zero, destroy it
|
||||
* @itemcount: number of IP addresses in this table
|
||||
* @data; pointer to the actual data, depending on netmask
|
||||
*/
|
||||
struct ipt_acc_table {
|
||||
char name[ACCOUNT_TABLE_NAME_LEN];
|
||||
uint32_t ip;
|
||||
uint32_t netmask;
|
||||
unsigned char depth;
|
||||
uint32_t refcount;
|
||||
uint32_t itemcount;
|
||||
void *data;
|
||||
};
|
||||
|
||||
/**
|
||||
* Internal handle structure
|
||||
* @ip: base IP address of the network. Used for caculating the final
|
||||
* address during get_data().
|
||||
* @depth: size of the network; see above
|
||||
* @itemcount: number of addresses in this table
|
||||
*/
|
||||
struct ipt_acc_handle {
|
||||
uint32_t ip;
|
||||
unsigned char depth;
|
||||
uint32_t itemcount;
|
||||
void *data;
|
||||
};
|
||||
|
||||
/* Used for every IP entry
|
||||
Size is 16 bytes so that 256 (class C network) * 16
|
||||
fits in one kernel (zero) page */
|
||||
struct ipt_acc_ip {
|
||||
uint32_t src_packets;
|
||||
uint32_t src_bytes;
|
||||
uint32_t dst_packets;
|
||||
uint32_t dst_bytes;
|
||||
};
|
||||
|
||||
/*
|
||||
* The IP addresses are organized as an array so that direct slot
|
||||
* calculations are possible.
|
||||
* Only 8-bit networks are preallocated, 16/24-bit networks
|
||||
* allocate their slots when needed -> very efficent.
|
||||
*/
|
||||
struct ipt_acc_mask_24 {
|
||||
struct ipt_acc_ip ip[256];
|
||||
};
|
||||
|
||||
struct ipt_acc_mask_16 {
|
||||
struct ipt_acc_mask_24 *mask_24[256];
|
||||
};
|
||||
|
||||
struct ipt_acc_mask_8 {
|
||||
struct ipt_acc_mask_16 *mask_16[256];
|
||||
};
|
||||
|
||||
static struct ipt_acc_table *ipt_acc_tables;
|
||||
static struct ipt_acc_handle *ipt_acc_handles;
|
||||
static void *ipt_acc_tmpbuf;
|
||||
|
Reference in New Issue
Block a user