4 #define ACCOUNT_MAX_TABLES 32
5 #define ACCOUNT_TABLE_NAME_LEN 32
6 #define ACCOUNT_MAX_HANDLES 10
8 /* Structure for the userspace part of ipt_ACCOUNT */
9 struct ipt_account_info {
12 char table_name[ACCOUNT_TABLE_NAME_LEN];
16 /* Internal table structure, generated by check_entry() */
17 struct ipt_account_table
19 char name[ACCOUNT_TABLE_NAME_LEN]; /* name of the table */
20 unsigned int ip; /* base IP of network (-a option) */
21 unsigned char netmask; /* netmask of the network (-a option) */
22 unsigned int refcount; /* refcount of this table. if zero, destroy it */
23 unsigned int itemcount; /* number of IPs in this table */
24 void *data; /* pointer to the actual data, depending on netmask */
27 /* Handle structure for communication with the userspace library */
28 struct ipt_account_handle
30 unsigned int ip; /* base IP of network */
31 unsigned char netmask; /* netmask of the network */
32 unsigned int itemcount; /* number of IPs in this table */
33 void *data; /* pointer to the actual data, depending on netmask */
36 /* Used for every IP entry */
37 /* Size is 16 bytes so that 256 (class C network) * 16 fits in one kernel (zero) page */
40 unsigned int src_packets;
41 unsigned int src_bytes;
42 unsigned int dst_packets;
43 unsigned int dst_bytes;
47 Used for every IP when returning data
49 struct ipt_account_handle_ip
52 unsigned int src_packets;
53 unsigned int src_bytes;
54 unsigned int dst_packets;
55 unsigned int dst_bytes;
59 The IPs are organized as an array so that direct slot
60 calculations are possible.
61 Only 8 bit networks are preallocated, 16/24 bit networks
62 allocate their slots when needed -> very efficent.
64 struct ipt_account_mask_24
66 struct ipt_account_ip ip[256];
69 struct ipt_account_mask_16
71 struct ipt_account_mask_24 *mask_24[256];
74 struct ipt_account_mask_8
76 struct ipt_account_mask_16 *mask_16[256];
79 #endif /*_IPT_ACCOUNT_H*/