| Rusty Russell | 79dee07 | 2000-05-02 16:45:16 +0000 | [diff] [blame] | 1 | #ifndef _IP6TABLES_USER_H |
| 2 | #define _IP6TABLES_USER_H |
| 3 | |
| 4 | #include "iptables_common.h" |
| 5 | #include "libiptc/libip6tc.h" |
| 6 | |
| Martin Josefsson | 357d59d | 2004-12-27 19:49:28 +0000 | [diff] [blame] | 7 | #ifndef IP6T_LIB_DIR |
| 8 | #define IP6T_LIB_DIR "/usr/local/lib/iptables" |
| 9 | #endif |
| 10 | |
| Patrick McHardy | 2452baf | 2006-04-28 08:10:08 +0000 | [diff] [blame] | 11 | #ifndef IPPROTO_SCTP |
| 12 | #define IPPROTO_SCTP 132 |
| 13 | #endif |
| 14 | #ifndef IPPROTO_DCCP |
| 15 | #define IPPROTO_DCCP 33 |
| 16 | #endif |
| 17 | |
| Martin Josefsson | 69ac0e0 | 2004-02-02 20:02:10 +0000 | [diff] [blame] | 18 | struct ip6tables_rule_match |
| 19 | { |
| 20 | struct ip6tables_rule_match *next; |
| 21 | |
| 22 | struct ip6tables_match *match; |
| Joszef Kadlecsik | a258ad7 | 2006-03-03 09:36:50 +0000 | [diff] [blame] | 23 | |
| 24 | /* Multiple matches of the same type: the ones before |
| 25 | the current one are completed from parsing point of view */ |
| 26 | unsigned int completed; |
| Martin Josefsson | 69ac0e0 | 2004-02-02 20:02:10 +0000 | [diff] [blame] | 27 | }; |
| 28 | |
| Rusty Russell | 79dee07 | 2000-05-02 16:45:16 +0000 | [diff] [blame] | 29 | /* Include file for additions: new matches and targets. */ |
| 30 | struct ip6tables_match |
| 31 | { |
| 32 | struct ip6tables_match *next; |
| 33 | |
| 34 | ip6t_chainlabel name; |
| 35 | |
| 36 | const char *version; |
| 37 | |
| 38 | /* Size of match data. */ |
| 39 | size_t size; |
| 40 | |
| Philip Blundell | 8c70090 | 2000-05-15 02:17:52 +0000 | [diff] [blame] | 41 | /* Size of match data relevent for userspace comparison purposes */ |
| 42 | size_t userspacesize; |
| 43 | |
| Rusty Russell | 79dee07 | 2000-05-02 16:45:16 +0000 | [diff] [blame] | 44 | /* Function which prints out usage message. */ |
| 45 | void (*help)(void); |
| 46 | |
| 47 | /* Initialize the match. */ |
| 48 | void (*init)(struct ip6t_entry_match *m, unsigned int *nfcache); |
| 49 | |
| 50 | /* Function which parses command options; returns true if it |
| 51 | ate an option */ |
| 52 | int (*parse)(int c, char **argv, int invert, unsigned int *flags, |
| 53 | const struct ip6t_entry *entry, |
| 54 | unsigned int *nfcache, |
| 55 | struct ip6t_entry_match **match); |
| 56 | |
| 57 | /* Final check; exit if not ok. */ |
| 58 | void (*final_check)(unsigned int flags); |
| 59 | |
| 60 | /* Prints out the match iff non-NULL: put space at end */ |
| 61 | void (*print)(const struct ip6t_ip6 *ip, |
| 62 | const struct ip6t_entry_match *match, int numeric); |
| 63 | |
| 64 | /* Saves the union ipt_matchinfo in parsable form to stdout. */ |
| 65 | void (*save)(const struct ip6t_ip6 *ip, |
| 66 | const struct ip6t_entry_match *match); |
| 67 | |
| 68 | /* Pointer to list of extra command-line options */ |
| Jan Echternach | b6db331 | 2000-08-27 07:39:08 +0000 | [diff] [blame] | 69 | const struct option *extra_opts; |
| Rusty Russell | 79dee07 | 2000-05-02 16:45:16 +0000 | [diff] [blame] | 70 | |
| 71 | /* Ignore these men behind the curtain: */ |
| 72 | unsigned int option_offset; |
| 73 | struct ip6t_entry_match *m; |
| 74 | unsigned int mflags; |
| Harald Welte | 3efb6ea | 2001-08-06 18:50:21 +0000 | [diff] [blame] | 75 | #ifdef NO_SHARED_LIBS |
| 76 | unsigned int loaded; /* simulate loading so options are merged properly */ |
| 77 | #endif |
| Rusty Russell | 79dee07 | 2000-05-02 16:45:16 +0000 | [diff] [blame] | 78 | }; |
| 79 | |
| 80 | struct ip6tables_target |
| 81 | { |
| 82 | struct ip6tables_target *next; |
| 83 | |
| 84 | ip6t_chainlabel name; |
| 85 | |
| 86 | const char *version; |
| 87 | |
| 88 | /* Size of target data. */ |
| 89 | size_t size; |
| 90 | |
| Philip Blundell | 8c70090 | 2000-05-15 02:17:52 +0000 | [diff] [blame] | 91 | /* Size of target data relevent for userspace comparison purposes */ |
| 92 | size_t userspacesize; |
| 93 | |
| Rusty Russell | 79dee07 | 2000-05-02 16:45:16 +0000 | [diff] [blame] | 94 | /* Function which prints out usage message. */ |
| 95 | void (*help)(void); |
| 96 | |
| 97 | /* Initialize the target. */ |
| 98 | void (*init)(struct ip6t_entry_target *t, unsigned int *nfcache); |
| 99 | |
| 100 | /* Function which parses command options; returns true if it |
| 101 | ate an option */ |
| 102 | int (*parse)(int c, char **argv, int invert, unsigned int *flags, |
| 103 | const struct ip6t_entry *entry, |
| 104 | struct ip6t_entry_target **target); |
| 105 | |
| 106 | /* Final check; exit if not ok. */ |
| 107 | void (*final_check)(unsigned int flags); |
| 108 | |
| 109 | /* Prints out the target iff non-NULL: put space at end */ |
| 110 | void (*print)(const struct ip6t_ip6 *ip, |
| 111 | const struct ip6t_entry_target *target, int numeric); |
| 112 | |
| 113 | /* Saves the targinfo in parsable form to stdout. */ |
| 114 | void (*save)(const struct ip6t_ip6 *ip, |
| 115 | const struct ip6t_entry_target *target); |
| 116 | |
| 117 | /* Pointer to list of extra command-line options */ |
| 118 | struct option *extra_opts; |
| 119 | |
| 120 | /* Ignore these men behind the curtain: */ |
| 121 | unsigned int option_offset; |
| 122 | struct ip6t_entry_target *t; |
| 123 | unsigned int tflags; |
| Fabrice MARIE | 8a5eb6d | 2001-05-05 21:37:47 +0000 | [diff] [blame] | 124 | unsigned int used; |
| Harald Welte | 3efb6ea | 2001-08-06 18:50:21 +0000 | [diff] [blame] | 125 | #ifdef NO_SHARED_LIBS |
| 126 | unsigned int loaded; /* simulate loading so options are merged properly */ |
| 127 | #endif |
| Rusty Russell | 79dee07 | 2000-05-02 16:45:16 +0000 | [diff] [blame] | 128 | }; |
| 129 | |
| Harald Welte | a8658ca | 2003-03-05 07:46:15 +0000 | [diff] [blame] | 130 | extern int line; |
| 131 | |
| Rusty Russell | 79dee07 | 2000-05-02 16:45:16 +0000 | [diff] [blame] | 132 | /* Your shared library should call one of these. */ |
| 133 | extern void register_match6(struct ip6tables_match *me); |
| 134 | extern void register_target6(struct ip6tables_target *me); |
| 135 | |
| Phil Oester | 58179b1 | 2006-07-20 17:00:19 +0000 | [diff] [blame^] | 136 | extern int service_to_port(const char *name, const char *proto); |
| Rusty Russell | 79dee07 | 2000-05-02 16:45:16 +0000 | [diff] [blame] | 137 | extern int do_command6(int argc, char *argv[], char **table, |
| 138 | ip6tc_handle_t *handle); |
| 139 | /* Keeping track of external matches and targets: linked lists. */ |
| 140 | extern struct ip6tables_match *ip6tables_matches; |
| 141 | extern struct ip6tables_target *ip6tables_targets; |
| 142 | |
| Philip Blundell | 8c70090 | 2000-05-15 02:17:52 +0000 | [diff] [blame] | 143 | enum ip6t_tryload { |
| 144 | DONT_LOAD, |
| Jones Desougi | f5b86e6 | 2005-12-22 03:33:50 +0000 | [diff] [blame] | 145 | DURING_LOAD, |
| Philip Blundell | 8c70090 | 2000-05-15 02:17:52 +0000 | [diff] [blame] | 146 | TRY_LOAD, |
| 147 | LOAD_MUST_SUCCEED |
| 148 | }; |
| 149 | |
| Fabrice MARIE | 8a5eb6d | 2001-05-05 21:37:47 +0000 | [diff] [blame] | 150 | extern struct ip6tables_target *find_target(const char *name, enum ip6t_tryload); |
| Martin Josefsson | 69ac0e0 | 2004-02-02 20:02:10 +0000 | [diff] [blame] | 151 | extern struct ip6tables_match *find_match(const char *name, enum ip6t_tryload, struct ip6tables_rule_match **match); |
| András Kis-Szabó | 764316a | 2001-02-26 17:31:20 +0000 | [diff] [blame] | 152 | |
| Yasuyuki KOZAKAI | 9867e81 | 2005-06-22 12:24:21 +0000 | [diff] [blame] | 153 | extern void parse_interface(const char *arg, char *vianame, unsigned char *mask); |
| 154 | |
| András Kis-Szabó | 764316a | 2001-02-26 17:31:20 +0000 | [diff] [blame] | 155 | extern int for_each_chain(int (*fn)(const ip6t_chainlabel, int, ip6tc_handle_t *), int verbose, int builtinstoo, ip6tc_handle_t *handle); |
| 156 | extern int flush_entries(const ip6t_chainlabel chain, int verbose, ip6tc_handle_t *handle); |
| 157 | extern int delete_chain(const ip6t_chainlabel chain, int verbose, ip6tc_handle_t *handle); |
| Harald Welte | 5891865 | 2001-06-16 18:25:25 +0000 | [diff] [blame] | 158 | extern int ip6tables_insmod(const char *modname, const char *modprobe); |
| András Kis-Szabó | 764316a | 2001-02-26 17:31:20 +0000 | [diff] [blame] | 159 | |
| Rusty Russell | 79dee07 | 2000-05-02 16:45:16 +0000 | [diff] [blame] | 160 | #endif /*_IP6TABLES_USER_H*/ |