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