5f8c6ef2906d859c5f0bbbd60c29746b8f79a7f6
[libipt_ACCOUNT] / src / ipt_ACCOUNT_cl.h
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 <netinet/in.h>
15 #include <linux/if.h>
16 #include <linux/netfilter_ipv4/ip_tables.h>
17 #include <linux/netfilter_ipv4/ipt_ACCOUNT.h>
18
19 #define IPT_ACCOUNT_MIN_BUFSIZE 4096    /* Don't set this below the size of struct ipt_account_handle_sockopt */
20
21 struct ipt_ACCOUNT_context
22 {
23     int sockfd;
24     struct ipt_account_handle_sockopt handle;
25     
26     unsigned int data_size;
27     void *data;
28     unsigned int pos;
29         
30     char *error_str;
31 };
32
33 int ipt_ACCOUNT_init(struct ipt_ACCOUNT_context *ctx);
34 void ipt_ACCOUNT_deinit(struct ipt_ACCOUNT_context *ctx);
35
36 int ipt_ACCOUNT_read_entries(struct ipt_ACCOUNT_context *ctx, char *table, char dont_flush);
37 struct ipt_account_handle_ip *ipt_ACCOUNT_get_next_entry(struct ipt_ACCOUNT_context *ctx);
38 /* ipt_ACCOUNT_free_entries is for internal use only function as this library
39    is constructed to be used in a loop -> Don't allocate memory all the time.
40    The data buffer is freed on deinit() */
41
42 #endif