| Marc Boucher | e6869a8 | 2000-03-20 06:03:29 +0000 | [diff] [blame] | 1 | #ifndef _IPTABLES_USER_H |
| 2 | #define _IPTABLES_USER_H |
| 3 | |
| Yasuyuki KOZAKAI | 0d502bc | 2007-07-24 05:52:07 +0000 | [diff] [blame^] | 4 | #include "xtables.h" |
| Rusty Russell | 79dee07 | 2000-05-02 16:45:16 +0000 | [diff] [blame] | 5 | #include "iptables_common.h" |
| Marc Boucher | e6869a8 | 2000-03-20 06:03:29 +0000 | [diff] [blame] | 6 | #include "libiptc/libiptc.h" |
| 7 | |
| Martin Josefsson | 357d59d | 2004-12-27 19:49:28 +0000 | [diff] [blame] | 8 | #ifndef IPT_LIB_DIR |
| 9 | #define IPT_LIB_DIR "/usr/local/lib/iptables" |
| 10 | #endif |
| 11 | |
| Harald Welte | db0422f | 2004-03-04 07:45:30 +0000 | [diff] [blame] | 12 | #ifndef IPPROTO_SCTP |
| 13 | #define IPPROTO_SCTP 132 |
| 14 | #endif |
| Patrick McHardy | 2452baf | 2006-04-28 08:10:08 +0000 | [diff] [blame] | 15 | #ifndef IPPROTO_DCCP |
| 16 | #define IPPROTO_DCCP 33 |
| 17 | #endif |
| Patrick McHardy | 9561606 | 2007-01-11 09:08:22 +0000 | [diff] [blame] | 18 | #ifndef IPPROTO_UDPLITE |
| 19 | #define IPPROTO_UDPLITE 136 |
| 20 | #endif |
| Harald Welte | db0422f | 2004-03-04 07:45:30 +0000 | [diff] [blame] | 21 | |
| Rusty Russell | 3aef54d | 2005-01-03 03:48:40 +0000 | [diff] [blame] | 22 | #ifndef IPT_SO_GET_REVISION_MATCH /* Old kernel source. */ |
| 23 | #define IPT_SO_GET_REVISION_MATCH (IPT_BASE_CTL + 2) |
| 24 | #define IPT_SO_GET_REVISION_TARGET (IPT_BASE_CTL + 3) |
| Rusty Russell | 3aef54d | 2005-01-03 03:48:40 +0000 | [diff] [blame] | 25 | #endif /* IPT_SO_GET_REVISION_MATCH Old kernel source */ |
| 26 | |
| Yasuyuki KOZAKAI | 0d502bc | 2007-07-24 05:52:07 +0000 | [diff] [blame^] | 27 | #define iptables_rule_match xtables_rule_match |
| 28 | #define iptables_match xtables_match |
| 29 | #define iptables_target xtables_target |
| 30 | #define ipt_tryload xt_tryload |
| Marc Boucher | e6869a8 | 2000-03-20 06:03:29 +0000 | [diff] [blame] | 31 | |
| Illes Marci | 63e9063 | 2003-03-03 08:08:37 +0000 | [diff] [blame] | 32 | extern int line; |
| 33 | |
| Marc Boucher | e6869a8 | 2000-03-20 06:03:29 +0000 | [diff] [blame] | 34 | /* Your shared library should call one of these. */ |
| 35 | extern void register_match(struct iptables_match *me); |
| 36 | extern void register_target(struct iptables_target *me); |
| 37 | |
| Phil Oester | 58179b1 | 2006-07-20 17:00:19 +0000 | [diff] [blame] | 38 | extern int service_to_port(const char *name, const char *proto); |
| Phil Oester | dbac8ad | 2006-07-20 17:01:54 +0000 | [diff] [blame] | 39 | extern u_int16_t parse_port(const char *port, const char *proto); |
| Rusty Russell | 79dee07 | 2000-05-02 16:45:16 +0000 | [diff] [blame] | 40 | extern struct in_addr *dotted_to_addr(const char *dotted); |
| Pablo Neira Ayuso | 267a570 | 2006-11-29 13:32:32 +0000 | [diff] [blame] | 41 | extern struct in_addr *dotted_to_mask(const char *dotted); |
| Marc Boucher | e6869a8 | 2000-03-20 06:03:29 +0000 | [diff] [blame] | 42 | extern char *addr_to_dotted(const struct in_addr *addrp); |
| Marc Boucher | b93c798 | 2001-12-06 14:50:19 +0000 | [diff] [blame] | 43 | extern char *addr_to_anyname(const struct in_addr *addr); |
| 44 | extern char *mask_to_dotted(const struct in_addr *mask); |
| 45 | |
| 46 | extern void parse_hostnetworkmask(const char *name, struct in_addr **addrpp, |
| 47 | struct in_addr *maskp, unsigned int *naddrs); |
| 48 | extern u_int16_t parse_protocol(const char *s); |
| Yasuyuki KOZAKAI | 9867e81 | 2005-06-22 12:24:21 +0000 | [diff] [blame] | 49 | extern void parse_interface(const char *arg, char *vianame, unsigned char *mask); |
| Marc Boucher | e6869a8 | 2000-03-20 06:03:29 +0000 | [diff] [blame] | 50 | |
| 51 | extern int do_command(int argc, char *argv[], char **table, |
| 52 | iptc_handle_t *handle); |
| Harald Welte | a114e9e | 2000-12-01 14:28:19 +0000 | [diff] [blame] | 53 | extern int delete_chain(const ipt_chainlabel chain, int verbose, |
| 54 | iptc_handle_t *handle); |
| 55 | extern int flush_entries(const ipt_chainlabel chain, int verbose, |
| 56 | iptc_handle_t *handle); |
| 57 | extern int for_each_chain(int (*fn)(const ipt_chainlabel, int, iptc_handle_t *), |
| 58 | int verbose, int builtinstoo, iptc_handle_t *handle); |
| Phil Oester | 8cf6591 | 2005-09-19 15:00:33 +0000 | [diff] [blame] | 59 | |
| 60 | /* kernel revision handling */ |
| 61 | extern int kernel_version; |
| 62 | extern void get_kernel_version(void); |
| 63 | #define LINUX_VERSION(x,y,z) (0x10000*(x) + 0x100*(y) + z) |
| 64 | #define LINUX_VERSION_MAJOR(x) (((x)>>16) & 0xFF) |
| 65 | #define LINUX_VERSION_MINOR(x) (((x)>> 8) & 0xFF) |
| 66 | #define LINUX_VERSION_PATCH(x) ( (x) & 0xFF) |
| 67 | |
| Marc Boucher | e6869a8 | 2000-03-20 06:03:29 +0000 | [diff] [blame] | 68 | #endif /*_IPTABLES_USER_H*/ |