blob: 9860e62fe696b5a19c79cfbd56e61c8cc7675b5d [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 */
47 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};
54
55struct ip6tables_target
56{
57 struct ip6tables_target *next;
58
59 ip6t_chainlabel name;
60
61 const char *version;
62
63 /* Size of target data. */
64 size_t size;
65
Philip Blundell8c700902000-05-15 02:17:52 +000066 /* Size of target data relevent for userspace comparison purposes */
67 size_t userspacesize;
68
Rusty Russell79dee072000-05-02 16:45:16 +000069 /* Function which prints out usage message. */
70 void (*help)(void);
71
72 /* Initialize the target. */
73 void (*init)(struct ip6t_entry_target *t, unsigned int *nfcache);
74
75 /* Function which parses command options; returns true if it
76 ate an option */
77 int (*parse)(int c, char **argv, int invert, unsigned int *flags,
78 const struct ip6t_entry *entry,
79 struct ip6t_entry_target **target);
80
81 /* Final check; exit if not ok. */
82 void (*final_check)(unsigned int flags);
83
84 /* Prints out the target iff non-NULL: put space at end */
85 void (*print)(const struct ip6t_ip6 *ip,
86 const struct ip6t_entry_target *target, int numeric);
87
88 /* Saves the targinfo in parsable form to stdout. */
89 void (*save)(const struct ip6t_ip6 *ip,
90 const struct ip6t_entry_target *target);
91
92 /* Pointer to list of extra command-line options */
93 struct option *extra_opts;
94
95 /* Ignore these men behind the curtain: */
96 unsigned int option_offset;
97 struct ip6t_entry_target *t;
98 unsigned int tflags;
99};
100
101/* Your shared library should call one of these. */
102extern void register_match6(struct ip6tables_match *me);
103extern void register_target6(struct ip6tables_target *me);
104
105extern int do_command6(int argc, char *argv[], char **table,
106 ip6tc_handle_t *handle);
107/* Keeping track of external matches and targets: linked lists. */
108extern struct ip6tables_match *ip6tables_matches;
109extern struct ip6tables_target *ip6tables_targets;
110
Philip Blundell8c700902000-05-15 02:17:52 +0000111enum ip6t_tryload {
112 DONT_LOAD,
113 TRY_LOAD,
114 LOAD_MUST_SUCCEED
115};
116
117extern struct ip6tables_target *find_target6(const char *name, enum ip6t_tryload);
118extern struct ip6tables_match *find_match6(const char *name, enum ip6t_tryload);
Rusty Russell79dee072000-05-02 16:45:16 +0000119#endif /*_IP6TABLES_USER_H*/