1 #ifndef _IP6TABLES_USER_H
2 #define _IP6TABLES_USER_H
4 #include "iptables_common.h"
5 #include "libiptc/libip6tc.h"
8 #define IP6T_LIB_DIR "/usr/local/lib/iptables"
12 #define IPPROTO_SCTP 132
15 #define IPPROTO_DCCP 33
17 #ifndef IPPROTO_UDPLITE
18 #define IPPROTO_UDPLITE 136
21 #ifndef IP6T_SO_GET_REVISION_MATCH /* Old kernel source. */
22 #define IP6T_SO_GET_REVISION_MATCH 68
23 #define IP6T_SO_GET_REVISION_TARGET 69
25 struct ip6t_get_revision
27 char name[IP6T_FUNCTION_MAXNAMELEN-1];
31 #endif /* IP6T_SO_GET_REVISION_MATCH Old kernel source */
33 struct ip6tables_rule_match
35 struct ip6tables_rule_match *next;
37 struct ip6tables_match *match;
39 /* Multiple matches of the same type: the ones before
40 the current one are completed from parsing point of view */
41 unsigned int completed;
44 /* Include file for additions: new matches and targets. */
45 struct ip6tables_match
47 struct ip6tables_match *next;
51 /* Revision of match (0 by default). */
56 /* Size of match data. */
59 /* Size of match data relevent for userspace comparison purposes */
62 /* Function which prints out usage message. */
65 /* Initialize the match. */
66 void (*init)(struct ip6t_entry_match *m, unsigned int *nfcache);
68 /* Function which parses command options; returns true if it
70 int (*parse)(int c, char **argv, int invert, unsigned int *flags,
71 const struct ip6t_entry *entry,
72 unsigned int *nfcache,
73 struct ip6t_entry_match **match);
75 /* Final check; exit if not ok. */
76 void (*final_check)(unsigned int flags);
78 /* Prints out the match iff non-NULL: put space at end */
79 void (*print)(const struct ip6t_ip6 *ip,
80 const struct ip6t_entry_match *match, int numeric);
82 /* Saves the union ipt_matchinfo in parsable form to stdout. */
83 void (*save)(const struct ip6t_ip6 *ip,
84 const struct ip6t_entry_match *match);
86 /* Pointer to list of extra command-line options */
87 const struct option *extra_opts;
89 /* Ignore these men behind the curtain: */
90 unsigned int option_offset;
91 struct ip6t_entry_match *m;
94 unsigned int loaded; /* simulate loading so options are merged properly */
98 struct ip6tables_target
100 struct ip6tables_target *next;
102 ip6t_chainlabel name;
106 /* Size of target data. */
109 /* Size of target data relevent for userspace comparison purposes */
110 size_t userspacesize;
112 /* Function which prints out usage message. */
115 /* Initialize the target. */
116 void (*init)(struct ip6t_entry_target *t, unsigned int *nfcache);
118 /* Function which parses command options; returns true if it
120 int (*parse)(int c, char **argv, int invert, unsigned int *flags,
121 const struct ip6t_entry *entry,
122 struct ip6t_entry_target **target);
124 /* Final check; exit if not ok. */
125 void (*final_check)(unsigned int flags);
127 /* Prints out the target iff non-NULL: put space at end */
128 void (*print)(const struct ip6t_ip6 *ip,
129 const struct ip6t_entry_target *target, int numeric);
131 /* Saves the targinfo in parsable form to stdout. */
132 void (*save)(const struct ip6t_ip6 *ip,
133 const struct ip6t_entry_target *target);
135 /* Pointer to list of extra command-line options */
136 struct option *extra_opts;
138 /* Ignore these men behind the curtain: */
139 unsigned int option_offset;
140 struct ip6t_entry_target *t;
143 #ifdef NO_SHARED_LIBS
144 unsigned int loaded; /* simulate loading so options are merged properly */
150 /* Your shared library should call one of these. */
151 extern void register_match6(struct ip6tables_match *me);
152 extern void register_target6(struct ip6tables_target *me);
154 extern int service_to_port(const char *name, const char *proto);
155 extern u_int16_t parse_port(const char *port, const char *proto);
156 extern int do_command6(int argc, char *argv[], char **table,
157 ip6tc_handle_t *handle);
158 /* Keeping track of external matches and targets: linked lists. */
159 extern struct ip6tables_match *ip6tables_matches;
160 extern struct ip6tables_target *ip6tables_targets;
169 extern struct ip6tables_target *find_target(const char *name, enum ip6t_tryload);
170 extern struct ip6tables_match *find_match(const char *name, enum ip6t_tryload, struct ip6tables_rule_match **match);
172 extern void parse_interface(const char *arg, char *vianame, unsigned char *mask);
174 extern int for_each_chain(int (*fn)(const ip6t_chainlabel, int, ip6tc_handle_t *), int verbose, int builtinstoo, ip6tc_handle_t *handle);
175 extern int flush_entries(const ip6t_chainlabel chain, int verbose, ip6tc_handle_t *handle);
176 extern int delete_chain(const ip6t_chainlabel chain, int verbose, ip6tc_handle_t *handle);
178 ip6tables_insmod(const char *modname, const char *modprobe, int quiet);
179 extern int load_ip6tables_ko(const char *modprobe, int quiet);
181 #endif /*_IP6TABLES_USER_H*/