| 1 | #ifndef _ipt_ACCOUNT_cl_H |
| 2 | #define _ipt_ACCOUNT_cl_H |
| 3 | |
| 4 | // TODO: Path needs fixing |
| 5 | #include "../ipt_ACCOUNT.h" |
| 6 | |
| 7 | // TODO: Move these to the ip_tables.h |
| 8 | #define IPT_BASE_CTL 64 /* base for firewall socket options */ |
| 9 | #define IPT_SO_SET_ACCOUNT_HANDLE_FREE (IPT_BASE_CTL + 3) |
| 10 | #define IPT_SO_SET_ACCOUNT_MAX IPT_SO_SET_ACCOUNT_HANDLE_FREE |
| 11 | |
| 12 | #define IPT_SO_GET_ACCOUNT_PREPARE_READ (IPT_BASE_CTL + 3) |
| 13 | #define IPT_SO_GET_ACCOUNT_PREPARE_READ_FLUSH (IPT_BASE_CTL + 4) |
| 14 | #define IPT_SO_GET_ACCOUNT_GET_DATA (IPT_BASE_CTL + 5) |
| 15 | #define IPT_SO_GET_ACCOUNT_MAX IPT_SO_GET_ACCOUNT_GET_DATA |
| 16 | |
| 17 | #define IPT_ACCOUNT_MIN_BUFSIZE 4096 /* Don't set this below the size of struct ipt_account_handle_sockopt */ |
| 18 | |
| 19 | struct ipt_ACCOUNT_context |
| 20 | { |
| 21 | int sockfd; |
| 22 | struct ipt_account_handle_sockopt handle; |
| 23 | |
| 24 | unsigned int data_size; |
| 25 | void *data; |
| 26 | unsigned int pos; |
| 27 | |
| 28 | char *error_str; |
| 29 | }; |
| 30 | |
| 31 | int ipt_ACCOUNT_init(struct ipt_ACCOUNT_context *ctx); |
| 32 | void ipt_ACCOUNT_deinit(struct ipt_ACCOUNT_context *ctx); |
| 33 | |
| 34 | int ipt_ACCOUNT_read_entries(struct ipt_ACCOUNT_context *ctx, char *table, char dont_flush); |
| 35 | struct ipt_account_handle_ip *ipt_ACCOUNT_get_next_entry(struct ipt_ACCOUNT_context *ctx); |
| 36 | /* ipt_ACCOUNT_free_entries is for internal use only function as this library |
| 37 | is constructed to be used in a loop -> Don't allocate memory all the time. |
| 38 | The data buffer is freed on deinit() */ |
| 39 | |
| 40 | #endif |