iptables-1.2.9-2.3.1.src.rpm
[iptables.git] / include / ip6tables.h
1 #ifndef _IP6TABLES_USER_H
2 #define _IP6TABLES_USER_H
3
4 #include "iptables_common.h"
5 #include "libiptc/libip6tc.h"
6
7 /* Include file for additions: new matches and targets. */
8 struct ip6tables_match
9 {
10         struct ip6tables_match *next;
11
12         ip6t_chainlabel name;
13
14         const char *version;
15
16         /* Size of match data. */
17         size_t size;
18
19         /* Size of match data relevent for userspace comparison purposes */
20         size_t userspacesize;
21
22         /* Function which prints out usage message. */
23         void (*help)(void);
24
25         /* Initialize the match. */
26         void (*init)(struct ip6t_entry_match *m, unsigned int *nfcache);
27
28         /* Function which parses command options; returns true if it
29            ate an option */
30         int (*parse)(int c, char **argv, int invert, unsigned int *flags,
31                      const struct ip6t_entry *entry,
32                      unsigned int *nfcache,
33                      struct ip6t_entry_match **match);
34
35         /* Final check; exit if not ok. */
36         void (*final_check)(unsigned int flags);
37
38         /* Prints out the match iff non-NULL: put space at end */
39         void (*print)(const struct ip6t_ip6 *ip,
40                       const struct ip6t_entry_match *match, int numeric);
41
42         /* Saves the union ipt_matchinfo in parsable form to stdout. */
43         void (*save)(const struct ip6t_ip6 *ip,
44                      const struct ip6t_entry_match *match);
45
46         /* Pointer to list of extra command-line options */
47         const struct option *extra_opts;
48
49         /* Ignore these men behind the curtain: */
50         unsigned int option_offset;
51         struct ip6t_entry_match *m;
52         unsigned int mflags;
53         unsigned int used;
54 #ifdef NO_SHARED_LIBS
55         unsigned int loaded; /* simulate loading so options are merged properly */
56 #endif
57 };
58
59 struct ip6tables_target
60 {
61         struct ip6tables_target *next;
62         
63         ip6t_chainlabel name;
64
65         const char *version;
66
67         /* Size of target data. */
68         size_t size;
69
70         /* Size of target data relevent for userspace comparison purposes */
71         size_t userspacesize;
72
73         /* Function which prints out usage message. */
74         void (*help)(void);
75
76         /* Initialize the target. */
77         void (*init)(struct ip6t_entry_target *t, unsigned int *nfcache);
78
79         /* Function which parses command options; returns true if it
80            ate an option */
81         int (*parse)(int c, char **argv, int invert, unsigned int *flags,
82                      const struct ip6t_entry *entry,
83                      struct ip6t_entry_target **target);
84         
85         /* Final check; exit if not ok. */
86         void (*final_check)(unsigned int flags);
87
88         /* Prints out the target iff non-NULL: put space at end */
89         void (*print)(const struct ip6t_ip6 *ip,
90                       const struct ip6t_entry_target *target, int numeric);
91
92         /* Saves the targinfo in parsable form to stdout. */
93         void (*save)(const struct ip6t_ip6 *ip,
94                      const struct ip6t_entry_target *target);
95
96         /* Pointer to list of extra command-line options */
97         struct option *extra_opts;
98
99         /* Ignore these men behind the curtain: */
100         unsigned int option_offset;
101         struct ip6t_entry_target *t;
102         unsigned int tflags;
103         unsigned int used;
104 #ifdef NO_SHARED_LIBS
105         unsigned int loaded; /* simulate loading so options are merged properly */
106 #endif
107 };
108
109 extern int line;
110
111 /* Your shared library should call one of these. */
112 extern void register_match6(struct ip6tables_match *me);
113 extern void register_target6(struct ip6tables_target *me);
114
115 extern int do_command6(int argc, char *argv[], char **table,
116                        ip6tc_handle_t *handle);
117 /* Keeping track of external matches and targets: linked lists. */
118 extern struct ip6tables_match *ip6tables_matches;
119 extern struct ip6tables_target *ip6tables_targets;
120
121 enum ip6t_tryload {
122         DONT_LOAD,
123         TRY_LOAD,
124         LOAD_MUST_SUCCEED
125 };
126
127 extern struct ip6tables_target *find_target(const char *name, enum ip6t_tryload);
128 extern struct ip6tables_match *find_match(const char *name, enum ip6t_tryload);
129
130 extern int for_each_chain(int (*fn)(const ip6t_chainlabel, int, ip6tc_handle_t *), int verbose, int builtinstoo, ip6tc_handle_t *handle);
131 extern int flush_entries(const ip6t_chainlabel chain, int verbose, ip6tc_handle_t *handle);
132 extern int delete_chain(const ip6t_chainlabel chain, int verbose, ip6tc_handle_t *handle);
133 extern int ip6tables_insmod(const char *modname, const char *modprobe);
134
135 #endif /*_IP6TABLES_USER_H*/