ip6tables.h revision 4ebfad0cf7ff3e414a20c82513579789e8283c9f
1#ifndef _IP6TABLES_USER_H 2#define _IP6TABLES_USER_H 3 4#include "iptables_common.h" 5#include "libiptc/libip6tc.h" 6 7#ifndef IP6T_LIB_DIR 8#define IP6T_LIB_DIR "/usr/local/lib/iptables" 9#endif 10 11#ifndef IPPROTO_SCTP 12#define IPPROTO_SCTP 132 13#endif 14#ifndef IPPROTO_DCCP 15#define IPPROTO_DCCP 33 16#endif 17 18#ifndef IP6T_SO_GET_REVISION_MATCH /* Old kernel source. */ 19#define IP6T_SO_GET_REVISION_MATCH 68 20#define IP6T_SO_GET_REVISION_TARGET 69 21 22struct ip6t_get_revision 23{ 24 char name[IP6T_FUNCTION_MAXNAMELEN-1]; 25 26 u_int8_t revision; 27}; 28#endif /* IP6T_SO_GET_REVISION_MATCH Old kernel source */ 29 30struct ip6tables_rule_match 31{ 32 struct ip6tables_rule_match *next; 33 34 struct ip6tables_match *match; 35 36 /* Multiple matches of the same type: the ones before 37 the current one are completed from parsing point of view */ 38 unsigned int completed; 39}; 40 41/* Include file for additions: new matches and targets. */ 42struct ip6tables_match 43{ 44 struct ip6tables_match *next; 45 46 ip6t_chainlabel name; 47 48 /* Revision of match (0 by default). */ 49 u_int8_t revision; 50 51 const char *version; 52 53 /* Size of match data. */ 54 size_t size; 55 56 /* Size of match data relevent for userspace comparison purposes */ 57 size_t userspacesize; 58 59 /* Function which prints out usage message. */ 60 void (*help)(void); 61 62 /* Initialize the match. */ 63 void (*init)(struct ip6t_entry_match *m, unsigned int *nfcache); 64 65 /* Function which parses command options; returns true if it 66 ate an option */ 67 int (*parse)(int c, char **argv, int invert, unsigned int *flags, 68 const struct ip6t_entry *entry, 69 unsigned int *nfcache, 70 struct ip6t_entry_match **match); 71 72 /* Final check; exit if not ok. */ 73 void (*final_check)(unsigned int flags); 74 75 /* Prints out the match iff non-NULL: put space at end */ 76 void (*print)(const struct ip6t_ip6 *ip, 77 const struct ip6t_entry_match *match, int numeric); 78 79 /* Saves the union ipt_matchinfo in parsable form to stdout. */ 80 void (*save)(const struct ip6t_ip6 *ip, 81 const struct ip6t_entry_match *match); 82 83 /* Pointer to list of extra command-line options */ 84 const struct option *extra_opts; 85 86 /* Ignore these men behind the curtain: */ 87 unsigned int option_offset; 88 struct ip6t_entry_match *m; 89 unsigned int mflags; 90#ifdef NO_SHARED_LIBS 91 unsigned int loaded; /* simulate loading so options are merged properly */ 92#endif 93}; 94 95struct ip6tables_target 96{ 97 struct ip6tables_target *next; 98 99 ip6t_chainlabel name; 100 101 const char *version; 102 103 /* Size of target data. */ 104 size_t size; 105 106 /* Size of target data relevent for userspace comparison purposes */ 107 size_t userspacesize; 108 109 /* Function which prints out usage message. */ 110 void (*help)(void); 111 112 /* Initialize the target. */ 113 void (*init)(struct ip6t_entry_target *t, unsigned int *nfcache); 114 115 /* Function which parses command options; returns true if it 116 ate an option */ 117 int (*parse)(int c, char **argv, int invert, unsigned int *flags, 118 const struct ip6t_entry *entry, 119 struct ip6t_entry_target **target); 120 121 /* Final check; exit if not ok. */ 122 void (*final_check)(unsigned int flags); 123 124 /* Prints out the target iff non-NULL: put space at end */ 125 void (*print)(const struct ip6t_ip6 *ip, 126 const struct ip6t_entry_target *target, int numeric); 127 128 /* Saves the targinfo in parsable form to stdout. */ 129 void (*save)(const struct ip6t_ip6 *ip, 130 const struct ip6t_entry_target *target); 131 132 /* Pointer to list of extra command-line options */ 133 struct option *extra_opts; 134 135 /* Ignore these men behind the curtain: */ 136 unsigned int option_offset; 137 struct ip6t_entry_target *t; 138 unsigned int tflags; 139 unsigned int used; 140#ifdef NO_SHARED_LIBS 141 unsigned int loaded; /* simulate loading so options are merged properly */ 142#endif 143}; 144 145extern int line; 146 147/* Your shared library should call one of these. */ 148extern void register_match6(struct ip6tables_match *me); 149extern void register_target6(struct ip6tables_target *me); 150 151extern int service_to_port(const char *name, const char *proto); 152extern u_int16_t parse_port(const char *port, const char *proto); 153extern int do_command6(int argc, char *argv[], char **table, 154 ip6tc_handle_t *handle); 155/* Keeping track of external matches and targets: linked lists. */ 156extern struct ip6tables_match *ip6tables_matches; 157extern struct ip6tables_target *ip6tables_targets; 158 159enum ip6t_tryload { 160 DONT_LOAD, 161 DURING_LOAD, 162 TRY_LOAD, 163 LOAD_MUST_SUCCEED 164}; 165 166extern struct ip6tables_target *find_target(const char *name, enum ip6t_tryload); 167extern struct ip6tables_match *find_match(const char *name, enum ip6t_tryload, struct ip6tables_rule_match **match); 168 169extern void parse_interface(const char *arg, char *vianame, unsigned char *mask); 170 171extern int for_each_chain(int (*fn)(const ip6t_chainlabel, int, ip6tc_handle_t *), int verbose, int builtinstoo, ip6tc_handle_t *handle); 172extern int flush_entries(const ip6t_chainlabel chain, int verbose, ip6tc_handle_t *handle); 173extern int delete_chain(const ip6t_chainlabel chain, int verbose, ip6tc_handle_t *handle); 174extern int ip6tables_insmod(const char *modname, const char *modprobe); 175 176#endif /*_IP6TABLES_USER_H*/ 177