5 #include <linux/types.h>
6 #include <linux/netfilter/x_tables.h>
7 #include <libiptc/libxtc.h>
11 #define IPPROTO_SCTP 132
14 #define IPPROTO_DCCP 33
16 #ifndef IPPROTO_UDPLITE
17 #define IPPROTO_UDPLITE 136
20 #define XTABLES_VERSION "@PACKAGE_VERSION@"
21 #define XTABLES_VERSION_CODE (0x10000 * @XTABLES_VERSION_MAJOR@ + 0x100 * @XTABLES_VERSION_MINOR@ + @XTABLES_VERSION_PATCH@)
23 #define XTABLES_API_VERSION(x,y,z) (0x10000*(x) + 0x100*(y) + z)
25 /* Include file for additions: new matches and targets. */
28 struct xtables_match *next;
32 /* Revision of match (0 by default). */
39 /* Size of match data. */
42 /* Size of match data relevent for userspace comparison purposes */
45 /* Function which prints out usage message. */
48 /* Initialize the match. */
49 void (*init)(struct xt_entry_match *m);
51 /* Function which parses command options; returns true if it
53 /* entry is struct ipt_entry for example */
54 int (*parse)(int c, char **argv, int invert, unsigned int *flags,
56 struct xt_entry_match **match);
58 /* Final check; exit if not ok. */
59 void (*final_check)(unsigned int flags);
61 /* Prints out the match iff non-NULL: put space at end */
62 /* ip is struct ipt_ip * for example */
63 void (*print)(const void *ip,
64 const struct xt_entry_match *match, int numeric);
66 /* Saves the match info in parsable form to stdout. */
67 /* ip is struct ipt_ip * for example */
68 void (*save)(const void *ip, const struct xt_entry_match *match);
70 /* Pointer to list of extra command-line options */
71 const struct option *extra_opts;
73 /* Ignore these men behind the curtain: */
74 unsigned int option_offset;
75 struct xt_entry_match *m;
78 unsigned int loaded; /* simulate loading so options are merged properly */
84 struct xtables_target *next;
88 /* Revision of target (0 by default). */
95 /* Size of target data. */
98 /* Size of target data relevent for userspace comparison purposes */
101 /* Function which prints out usage message. */
104 /* Initialize the target. */
105 void (*init)(struct xt_entry_target *t);
107 /* Function which parses command options; returns true if it
109 /* entry is struct ipt_entry for example */
110 int (*parse)(int c, char **argv, int invert, unsigned int *flags,
112 struct xt_entry_target **targetinfo);
114 /* Final check; exit if not ok. */
115 void (*final_check)(unsigned int flags);
117 /* Prints out the target iff non-NULL: put space at end */
118 void (*print)(const void *ip,
119 const struct xt_entry_target *target, int numeric);
121 /* Saves the targinfo in parsable form to stdout. */
122 void (*save)(const void *ip,
123 const struct xt_entry_target *target);
125 /* Pointer to list of extra command-line options */
126 const struct option *extra_opts;
128 /* Ignore these men behind the curtain: */
129 unsigned int option_offset;
130 struct xt_entry_target *t;
133 #ifdef NO_SHARED_LIBS
134 unsigned int loaded; /* simulate loading so options are merged properly */
138 /* Your shared library should call one of these. */
139 extern void xtables_register_match(struct xtables_match *me);
140 extern void xtables_register_target(struct xtables_target *me);
142 extern int string_to_number_ll(const char *s,
143 unsigned long long min,
144 unsigned long long max,
145 unsigned long long *ret);
146 extern int string_to_number_l(const char *s,
150 extern int string_to_number(const char *s,
154 extern bool strtonuml(const char *, char **, unsigned long *,
155 unsigned long, unsigned long);
156 extern bool strtonum(const char *, char **, unsigned int *,
157 unsigned int, unsigned int);
158 extern int service_to_port(const char *name, const char *proto);
159 extern u_int16_t parse_port(const char *port, const char *proto);
161 parse_interface(const char *arg, char *vianame, unsigned char *mask);
174 /* this is a special 64bit data type that is 8-byte aligned */
175 #define aligned_u64 u_int64_t __attribute__((aligned(8)))
177 int check_inverse(const char option[], int *invert, int *my_optind, int argc);
178 void exit_error(enum exittype, const char *, ...)__attribute__((noreturn,
179 format(printf,2,3)));
180 extern void param_act(unsigned int, const char *, ...);
181 extern const char *program_name, *program_version;
183 extern const char *ipaddr_to_numeric(const struct in_addr *);
184 extern const char *ipaddr_to_anyname(const struct in_addr *);
185 extern const char *ipmask_to_numeric(const struct in_addr *);
186 extern struct in_addr *numeric_to_ipaddr(const char *);
187 extern struct in_addr *numeric_to_ipmask(const char *);
188 extern void ipparse_hostnetworkmask(const char *, struct in_addr **,
189 struct in_addr *, unsigned int *);
191 extern struct in6_addr *numeric_to_ip6addr(const char *);
192 extern const char *ip6addr_to_numeric(const struct in6_addr *);
193 extern const char *ip6addr_to_anyname(const struct in6_addr *);
194 extern const char *ip6mask_to_numeric(const struct in6_addr *);
195 extern void ip6parse_hostnetworkmask(const char *, struct in6_addr **,
196 struct in6_addr *, unsigned int *);
199 * Print the specified value to standard output, quoting dangerous
200 * characters if required.
202 extern void save_string(const char *value);
204 #ifdef NO_SHARED_LIBS
209 extern void init_extensions(void);
211 # define _init __attribute__((constructor)) _INIT
214 /* Present in both iptables.c and ip6tables.c */
215 extern u_int16_t parse_protocol(const char *s);
217 #ifdef XTABLES_INTERNAL
218 # include <xtables/internal.h>
221 #endif /* _XTABLES_H */