blob: 91a93c325e701acdd3f4e820db0b9c9a4e6de9f5 [file] [log] [blame]
Marc Bouchere6869a82000-03-20 06:03:29 +00001#ifndef _IPTABLES_USER_H
2#define _IPTABLES_USER_H
3
Yasuyuki KOZAKAI0d502bc2007-07-24 05:52:07 +00004#include "xtables.h"
Marc Bouchere6869a82000-03-20 06:03:29 +00005#include "libiptc/libiptc.h"
6
Martin Josefsson357d59d2004-12-27 19:49:28 +00007#ifndef IPT_LIB_DIR
Yasuyuki KOZAKAI5cd1ff52007-07-24 05:55:12 +00008#define IPT_LIB_DIR XT_LIB_DIR
Patrick McHardy95616062007-01-11 09:08:22 +00009#endif
Harald Weltedb0422f2004-03-04 07:45:30 +000010
Rusty Russell3aef54d2005-01-03 03:48:40 +000011#ifndef IPT_SO_GET_REVISION_MATCH /* Old kernel source. */
12#define IPT_SO_GET_REVISION_MATCH (IPT_BASE_CTL + 2)
13#define IPT_SO_GET_REVISION_TARGET (IPT_BASE_CTL + 3)
Rusty Russell3aef54d2005-01-03 03:48:40 +000014#endif /* IPT_SO_GET_REVISION_MATCH Old kernel source */
15
Yasuyuki KOZAKAI0d502bc2007-07-24 05:52:07 +000016#define iptables_rule_match xtables_rule_match
17#define iptables_match xtables_match
18#define iptables_target xtables_target
19#define ipt_tryload xt_tryload
Marc Bouchere6869a82000-03-20 06:03:29 +000020
Illes Marci63e90632003-03-03 08:08:37 +000021extern int line;
22
Marc Bouchere6869a82000-03-20 06:03:29 +000023/* Your shared library should call one of these. */
24extern void register_match(struct iptables_match *me);
25extern void register_target(struct iptables_target *me);
26
Rusty Russell79dee072000-05-02 16:45:16 +000027extern struct in_addr *dotted_to_addr(const char *dotted);
Pablo Neira Ayuso267a5702006-11-29 13:32:32 +000028extern struct in_addr *dotted_to_mask(const char *dotted);
Marc Bouchere6869a82000-03-20 06:03:29 +000029extern char *addr_to_dotted(const struct in_addr *addrp);
Marc Boucherb93c7982001-12-06 14:50:19 +000030extern char *addr_to_anyname(const struct in_addr *addr);
31extern char *mask_to_dotted(const struct in_addr *mask);
32
33extern void parse_hostnetworkmask(const char *name, struct in_addr **addrpp,
34 struct in_addr *maskp, unsigned int *naddrs);
35extern u_int16_t parse_protocol(const char *s);
Marc Bouchere6869a82000-03-20 06:03:29 +000036
37extern int do_command(int argc, char *argv[], char **table,
38 iptc_handle_t *handle);
Harald Weltea114e9e2000-12-01 14:28:19 +000039extern int delete_chain(const ipt_chainlabel chain, int verbose,
40 iptc_handle_t *handle);
41extern int flush_entries(const ipt_chainlabel chain, int verbose,
42 iptc_handle_t *handle);
43extern int for_each_chain(int (*fn)(const ipt_chainlabel, int, iptc_handle_t *),
44 int verbose, int builtinstoo, iptc_handle_t *handle);
Phil Oester8cf65912005-09-19 15:00:33 +000045
46/* kernel revision handling */
47extern int kernel_version;
48extern void get_kernel_version(void);
49#define LINUX_VERSION(x,y,z) (0x10000*(x) + 0x100*(y) + z)
50#define LINUX_VERSION_MAJOR(x) (((x)>>16) & 0xFF)
51#define LINUX_VERSION_MINOR(x) (((x)>> 8) & 0xFF)
52#define LINUX_VERSION_PATCH(x) ( (x) & 0xFF)
53
Marc Bouchere6869a82000-03-20 06:03:29 +000054#endif /*_IPTABLES_USER_H*/