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