iptables.h revision c02e80878979d2205f3d89d05548397871e598e9
1e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher#ifndef _IPTABLES_USER_H
2e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher#define _IPTABLES_USER_H
3e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher
4ef18e8147903885708d1c264904129af4fb636d6Jan Engelhardt#include <netinet/ip.h>
5ef18e8147903885708d1c264904129af4fb636d6Jan Engelhardt#include <xtables.h>
6ef18e8147903885708d1c264904129af4fb636d6Jan Engelhardt#include <libiptc/libiptc.h>
7c02e80878979d2205f3d89d05548397871e598e9Jan Engelhardt#include <iptables/internal.h>
8e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher
93aef54dce4f9bbe0b466478fd33a1d3131efbbb8Rusty Russell#ifndef IPT_SO_GET_REVISION_MATCH /* Old kernel source. */
103aef54dce4f9bbe0b466478fd33a1d3131efbbb8Rusty Russell#define IPT_SO_GET_REVISION_MATCH	(IPT_BASE_CTL + 2)
113aef54dce4f9bbe0b466478fd33a1d3131efbbb8Rusty Russell#define IPT_SO_GET_REVISION_TARGET	(IPT_BASE_CTL + 3)
123aef54dce4f9bbe0b466478fd33a1d3131efbbb8Rusty Russell#endif /* IPT_SO_GET_REVISION_MATCH   Old kernel source */
133aef54dce4f9bbe0b466478fd33a1d3131efbbb8Rusty Russell
140d502bcdbc97ed359e84f6a21dfa0049b3b60a6cYasuyuki KOZAKAI#define iptables_rule_match	xtables_rule_match
150d502bcdbc97ed359e84f6a21dfa0049b3b60a6cYasuyuki KOZAKAI#define ipt_tryload		xt_tryload
16e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher
1763e9063a660809385fd17edb94da044c7c884e02Illes Marciextern int line;
1863e9063a660809385fd17edb94da044c7c884e02Illes Marci
19e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher/* Your shared library should call one of these. */
20e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucherextern int do_command(int argc, char *argv[], char **table,
21fd1873110f8e57be578df17fc9d03536b10f4f73Jan Engelhardt		      struct iptc_handle **handle);
22a114e9e8be802ab744d442449b3ec7de03c58621Harald Welteextern int delete_chain(const ipt_chainlabel chain, int verbose,
231c9015b2cb483678f153121255e10ec0bbfde3e6Jan Engelhardt			struct iptc_handle *handle);
24a114e9e8be802ab744d442449b3ec7de03c58621Harald Welteextern int flush_entries(const ipt_chainlabel chain, int verbose,
251c9015b2cb483678f153121255e10ec0bbfde3e6Jan Engelhardt			struct iptc_handle *handle);
261c9015b2cb483678f153121255e10ec0bbfde3e6Jan Engelhardtextern int for_each_chain(int (*fn)(const ipt_chainlabel, int, struct iptc_handle *),
271c9015b2cb483678f153121255e10ec0bbfde3e6Jan Engelhardt		int verbose, int builtinstoo, struct iptc_handle *handle);
2896296cfb7e01298234c7fa9403619f50391620d1Henrik Nordstromextern void print_rule(const struct ipt_entry *e,
291c9015b2cb483678f153121255e10ec0bbfde3e6Jan Engelhardt		struct iptc_handle *handle, const char *chain, int counters);
308cf65913bb6353bf0e92eab0669d1c4c53b43623Phil Oester
318cf65913bb6353bf0e92eab0669d1c4c53b43623Phil Oester/* kernel revision handling */
328cf65913bb6353bf0e92eab0669d1c4c53b43623Phil Oesterextern int kernel_version;
338cf65913bb6353bf0e92eab0669d1c4c53b43623Phil Oesterextern void get_kernel_version(void);
348cf65913bb6353bf0e92eab0669d1c4c53b43623Phil Oester#define LINUX_VERSION(x,y,z)	(0x10000*(x) + 0x100*(y) + z)
358cf65913bb6353bf0e92eab0669d1c4c53b43623Phil Oester#define LINUX_VERSION_MAJOR(x)	(((x)>>16) & 0xFF)
368cf65913bb6353bf0e92eab0669d1c4c53b43623Phil Oester#define LINUX_VERSION_MINOR(x)	(((x)>> 8) & 0xFF)
378cf65913bb6353bf0e92eab0669d1c4c53b43623Phil Oester#define LINUX_VERSION_PATCH(x)	( (x)      & 0xFF)
388cf65913bb6353bf0e92eab0669d1c4c53b43623Phil Oester
39e6869a8f59d779ff4d5a0984c86d80db7078496Marc Boucher#endif /*_IPTABLES_USER_H*/
40