blob: 9ac3835cf195d5befeece3e83d9d324081c2deff [file] [log] [blame]
Rusty Russell79dee072000-05-02 16:45:16 +00001#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. */
8struct 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
Philip Blundell8c700902000-05-15 02:17:52 +000019 /* Size of match data relevent for userspace comparison purposes */
20 size_t userspacesize;
21
Rusty Russell79dee072000-05-02 16:45:16 +000022 /* 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 */
Jan Echternachb6db3312000-08-27 07:39:08 +000047 const struct option *extra_opts;
Rusty Russell79dee072000-05-02 16:45:16 +000048
49 /* Ignore these men behind the curtain: */
50 unsigned int option_offset;
51 struct ip6t_entry_match *m;
52 unsigned int mflags;
Fabrice MARIE8a5eb6d2001-05-05 21:37:47 +000053 unsigned int used;
Rusty Russell79dee072000-05-02 16:45:16 +000054};
55
56struct ip6tables_target
57{
58 struct ip6tables_target *next;
59
60 ip6t_chainlabel name;
61
62 const char *version;
63
64 /* Size of target data. */
65 size_t size;
66
Philip Blundell8c700902000-05-15 02:17:52 +000067 /* Size of target data relevent for userspace comparison purposes */
68 size_t userspacesize;
69
Rusty Russell79dee072000-05-02 16:45:16 +000070 /* Function which prints out usage message. */
71 void (*help)(void);
72
73 /* Initialize the target. */
74 void (*init)(struct ip6t_entry_target *t, unsigned int *nfcache);
75
76 /* Function which parses command options; returns true if it
77 ate an option */
78 int (*parse)(int c, char **argv, int invert, unsigned int *flags,
79 const struct ip6t_entry *entry,
80 struct ip6t_entry_target **target);
81
82 /* Final check; exit if not ok. */
83 void (*final_check)(unsigned int flags);
84
85 /* Prints out the target iff non-NULL: put space at end */
86 void (*print)(const struct ip6t_ip6 *ip,
87 const struct ip6t_entry_target *target, int numeric);
88
89 /* Saves the targinfo in parsable form to stdout. */
90 void (*save)(const struct ip6t_ip6 *ip,
91 const struct ip6t_entry_target *target);
92
93 /* Pointer to list of extra command-line options */
94 struct option *extra_opts;
95
96 /* Ignore these men behind the curtain: */
97 unsigned int option_offset;
98 struct ip6t_entry_target *t;
99 unsigned int tflags;
Fabrice MARIE8a5eb6d2001-05-05 21:37:47 +0000100 unsigned int used;
Rusty Russell79dee072000-05-02 16:45:16 +0000101};
102
103/* Your shared library should call one of these. */
104extern void register_match6(struct ip6tables_match *me);
105extern void register_target6(struct ip6tables_target *me);
106
107extern int do_command6(int argc, char *argv[], char **table,
108 ip6tc_handle_t *handle);
109/* Keeping track of external matches and targets: linked lists. */
110extern struct ip6tables_match *ip6tables_matches;
111extern struct ip6tables_target *ip6tables_targets;
112
Philip Blundell8c700902000-05-15 02:17:52 +0000113enum ip6t_tryload {
114 DONT_LOAD,
115 TRY_LOAD,
116 LOAD_MUST_SUCCEED
117};
118
Fabrice MARIE8a5eb6d2001-05-05 21:37:47 +0000119extern struct ip6tables_target *find_target(const char *name, enum ip6t_tryload);
120extern struct ip6tables_match *find_match(const char *name, enum ip6t_tryload);
András Kis-Szabó764316a2001-02-26 17:31:20 +0000121
122extern int for_each_chain(int (*fn)(const ip6t_chainlabel, int, ip6tc_handle_t *), int verbose, int builtinstoo, ip6tc_handle_t *handle);
123extern int flush_entries(const ip6t_chainlabel chain, int verbose, ip6tc_handle_t *handle);
124extern int delete_chain(const ip6t_chainlabel chain, int verbose, ip6tc_handle_t *handle);
Harald Welte58918652001-06-16 18:25:25 +0000125extern int ip6tables_insmod(const char *modname, const char *modprobe);
András Kis-Szabó764316a2001-02-26 17:31:20 +0000126
Rusty Russell79dee072000-05-02 16:45:16 +0000127#endif /*_IP6TABLES_USER_H*/