| 1 | /*************************************************************************** |
| 2 | * Copyright (C) 2004 by Intra2net AG * |
| 3 | * opensource@intra2net.com * |
| 4 | * * |
| 5 | * This program is free software; you can redistribute it and/or modify * |
| 6 | * it under the terms of the GNU Lesser General Public License * |
| 7 | * version 2.1 as published by the Free Software Foundation; * |
| 8 | * * |
| 9 | ***************************************************************************/ |
| 10 | |
| 11 | #ifndef _ipt_ACCOUNT_cl_H |
| 12 | #define _ipt_ACCOUNT_cl_H |
| 13 | |
| 14 | #include <linux/netfilter_ipv4/ipt_ACCOUNT.h> |
| 15 | |
| 16 | /* Don't set this below the size of struct ipt_account_handle_sockopt */ |
| 17 | #define IPT_ACCOUNT_MIN_BUFSIZE 4096 |
| 18 | |
| 19 | struct ipt_ACCOUNT_context |
| 20 | { |
| 21 | int sockfd; |
| 22 | struct ipt_acc_handle_sockopt handle; |
| 23 | |
| 24 | unsigned int data_size; |
| 25 | void *data; |
| 26 | unsigned int pos; |
| 27 | |
| 28 | char *error_str; |
| 29 | }; |
| 30 | |
| 31 | #ifdef __cplusplus |
| 32 | extern "C" { |
| 33 | #endif |
| 34 | |
| 35 | int ipt_ACCOUNT_init(struct ipt_ACCOUNT_context *ctx); |
| 36 | void ipt_ACCOUNT_deinit(struct ipt_ACCOUNT_context *ctx); |
| 37 | |
| 38 | int ipt_ACCOUNT_read_entries(struct ipt_ACCOUNT_context *ctx, |
| 39 | const char *table, char dont_flush); |
| 40 | struct ipt_acc_handle_ip *ipt_ACCOUNT_get_next_entry( |
| 41 | struct ipt_ACCOUNT_context *ctx); |
| 42 | |
| 43 | /* ipt_ACCOUNT_free_entries is for internal use only function as this library |
| 44 | is constructed to be used in a loop -> Don't allocate memory all the time. |
| 45 | The data buffer is freed on deinit() */ |
| 46 | |
| 47 | int ipt_ACCOUNT_get_handle_usage(struct ipt_ACCOUNT_context *ctx); |
| 48 | int ipt_ACCOUNT_free_all_handles(struct ipt_ACCOUNT_context *ctx); |
| 49 | int ipt_ACCOUNT_get_table_names(struct ipt_ACCOUNT_context *ctx); |
| 50 | const char *ipt_ACCOUNT_get_next_name(struct ipt_ACCOUNT_context *ctx); |
| 51 | |
| 52 | #ifdef __cplusplus |
| 53 | } |
| 54 | #endif |
| 55 | |
| 56 | |
| 57 | #endif |