ip6tables.h revision 79dee0702b18c8ea1d1f7a2b1f6b29349466986b
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. */ 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 19 /* Function which prints out usage message. */ 20 void (*help)(void); 21 22 /* Initialize the match. */ 23 void (*init)(struct ip6t_entry_match *m, unsigned int *nfcache); 24 25 /* Function which parses command options; returns true if it 26 ate an option */ 27 int (*parse)(int c, char **argv, int invert, unsigned int *flags, 28 const struct ip6t_entry *entry, 29 unsigned int *nfcache, 30 struct ip6t_entry_match **match); 31 32 /* Final check; exit if not ok. */ 33 void (*final_check)(unsigned int flags); 34 35 /* Prints out the match iff non-NULL: put space at end */ 36 void (*print)(const struct ip6t_ip6 *ip, 37 const struct ip6t_entry_match *match, int numeric); 38 39 /* Saves the union ipt_matchinfo in parsable form to stdout. */ 40 void (*save)(const struct ip6t_ip6 *ip, 41 const struct ip6t_entry_match *match); 42 43 /* Pointer to list of extra command-line options */ 44 struct option *extra_opts; 45 46 /* Ignore these men behind the curtain: */ 47 unsigned int option_offset; 48 struct ip6t_entry_match *m; 49 unsigned int mflags; 50}; 51 52struct ip6tables_target 53{ 54 struct ip6tables_target *next; 55 56 ip6t_chainlabel name; 57 58 const char *version; 59 60 /* Size of target data. */ 61 size_t size; 62 63 /* Function which prints out usage message. */ 64 void (*help)(void); 65 66 /* Initialize the target. */ 67 void (*init)(struct ip6t_entry_target *t, unsigned int *nfcache); 68 69 /* Function which parses command options; returns true if it 70 ate an option */ 71 int (*parse)(int c, char **argv, int invert, unsigned int *flags, 72 const struct ip6t_entry *entry, 73 struct ip6t_entry_target **target); 74 75 /* Final check; exit if not ok. */ 76 void (*final_check)(unsigned int flags); 77 78 /* Prints out the target iff non-NULL: put space at end */ 79 void (*print)(const struct ip6t_ip6 *ip, 80 const struct ip6t_entry_target *target, int numeric); 81 82 /* Saves the targinfo in parsable form to stdout. */ 83 void (*save)(const struct ip6t_ip6 *ip, 84 const struct ip6t_entry_target *target); 85 86 /* Pointer to list of extra command-line options */ 87 struct option *extra_opts; 88 89 /* Ignore these men behind the curtain: */ 90 unsigned int option_offset; 91 struct ip6t_entry_target *t; 92 unsigned int tflags; 93}; 94 95/* Your shared library should call one of these. */ 96extern void register_match6(struct ip6tables_match *me); 97extern void register_target6(struct ip6tables_target *me); 98 99extern int do_command6(int argc, char *argv[], char **table, 100 ip6tc_handle_t *handle); 101/* Keeping track of external matches and targets: linked lists. */ 102extern struct ip6tables_match *ip6tables_matches; 103extern struct ip6tables_target *ip6tables_targets; 104 105extern struct ip6tables_target *find_target6(const char *name, int tryload); 106extern struct ip6tables_match *find_match6(const char *name, int tryload); 107#endif /*_IP6TABLES_USER_H*/ 108