• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /netgear-R7000-V1.0.7.12_1.2.5/ap/gpl/iptables-1.4.12.1/include/libiptc/

Lines Matching defs:*

0 #ifndef _LIBIP6TC_H
2 #define _LIBIP6TC_H
3 /* Library which manipulates firewall rules. Version 0.2. */
5 #include <linux/types.h>
6 #include <libiptc/ipt_kernel_headers.h>
7 #ifdef __cplusplus
8 # include <climits>
9 #else
10 # include <limits.h> /* INT_MAX in ip6_tables.h */
11 #endif
12 #include <linux/netfilter_ipv6/ip6_tables.h>
14 struct ip6tc_handle;
16 typedef char ip6t_chainlabel[32];
18 #define IP6TC_LABEL_ACCEPT "ACCEPT"
19 #define IP6TC_LABEL_DROP "DROP"
20 #define IP6TC_LABEL_QUEUE "QUEUE"
21 #define IP6TC_LABEL_RETURN "RETURN"
23 /* Does this chain exist? */
24 int ip6tc_is_chain(const char *chain, struct ip6tc_handle *const handle);
26 /* Take a snapshot of the rules. Returns NULL on error. */
27 struct ip6tc_handle *ip6tc_init(const char *tablename);
29 /* Cleanup after ip6tc_init(). */
30 void ip6tc_free(struct ip6tc_handle *h);
32 /* Iterator functions to run through the chains. Returns NULL at end. */
33 const char *ip6tc_first_chain(struct ip6tc_handle *handle);
34 const char *ip6tc_next_chain(struct ip6tc_handle *handle);
36 /* Get first rule in the given chain: NULL for empty chain. */
37 const struct ip6t_entry *ip6tc_first_rule(const char *chain,
38 struct ip6tc_handle *handle);
40 /* Returns NULL when rules run out. */
41 const struct ip6t_entry *ip6tc_next_rule(const struct ip6t_entry *prev,
42 struct ip6tc_handle *handle);
44 /* Returns a pointer to the target name of this position. */
45 const char *ip6tc_get_target(const struct ip6t_entry *e,
46 struct ip6tc_handle *handle);
48 /* Is this a built-in chain? */
49 int ip6tc_builtin(const char *chain, struct ip6tc_handle *const handle);
51 /* Get the policy of a given built-in chain */
52 const char *ip6tc_get_policy(const char *chain,
53 struct ip6t_counters *counters,
54 struct ip6tc_handle *handle);
56 /* These functions return TRUE for OK or 0 and set errno. If errno ==
57 0, it means there was a version error (ie. upgrade libiptc). */
58 /* Rule numbers start at 1 for the first rule. */
60 /* Insert the entry `fw' in chain `chain' into position `rulenum'. */
61 int ip6tc_insert_entry(const ip6t_chainlabel chain,
62 const struct ip6t_entry *e,
63 unsigned int rulenum,
64 struct ip6tc_handle *handle);
66 /* Atomically replace rule `rulenum' in `chain' with `fw'. */
67 int ip6tc_replace_entry(const ip6t_chainlabel chain,
68 const struct ip6t_entry *e,
69 unsigned int rulenum,
70 struct ip6tc_handle *handle);
72 /* Append entry `fw' to chain `chain'. Equivalent to insert with
73 rulenum = length of chain. */
74 int ip6tc_append_entry(const ip6t_chainlabel chain,
75 const struct ip6t_entry *e,
76 struct ip6tc_handle *handle);
78 /* Check whether a matching rule exists */
79 int ip6tc_check_entry(const ip6t_chainlabel chain,
80 const struct ip6t_entry *origfw,
81 unsigned char *matchmask,
82 struct ip6tc_handle *handle);
84 /* Delete the first rule in `chain' which matches `fw'. */
85 int ip6tc_delete_entry(const ip6t_chainlabel chain,
86 const struct ip6t_entry *origfw,
87 unsigned char *matchmask,
88 struct ip6tc_handle *handle);
90 /* Delete the rule in position `rulenum' in `chain'. */
91 int ip6tc_delete_num_entry(const ip6t_chainlabel chain,
92 unsigned int rulenum,
93 struct ip6tc_handle *handle);
95 /* Check the packet `fw' on chain `chain'. Returns the verdict, or
96 NULL and sets errno. */
97 const char *ip6tc_check_packet(const ip6t_chainlabel chain,
98 struct ip6t_entry *,
99 struct ip6tc_handle *handle);
101 /* Flushes the entries in the given chain (ie. empties chain). */
102 int ip6tc_flush_entries(const ip6t_chainlabel chain,
103 struct ip6tc_handle *handle);
105 /* Zeroes the counters in a chain. */
106 int ip6tc_zero_entries(const ip6t_chainlabel chain,
107 struct ip6tc_handle *handle);
109 /* Creates a new chain. */
110 int ip6tc_create_chain(const ip6t_chainlabel chain,
111 struct ip6tc_handle *handle);
113 /* Deletes a chain. */
114 int ip6tc_delete_chain(const ip6t_chainlabel chain,
115 struct ip6tc_handle *handle);
117 /* Renames a chain. */
118 int ip6tc_rename_chain(const ip6t_chainlabel oldname,
119 const ip6t_chainlabel newname,
120 struct ip6tc_handle *handle);
122 /* Sets the policy on a built-in chain. */
123 int ip6tc_set_policy(const ip6t_chainlabel chain,
124 const ip6t_chainlabel policy,
125 struct ip6t_counters *counters,
126 struct ip6tc_handle *handle);
128 /* Get the number of references to this chain */
129 int ip6tc_get_references(unsigned int *ref, const ip6t_chainlabel chain,
130 struct ip6tc_handle *handle);
132 /* read packet and byte counters for a specific rule */
133 struct ip6t_counters *ip6tc_read_counter(const ip6t_chainlabel chain,
134 unsigned int rulenum,
135 struct ip6tc_handle *handle);
137 /* zero packet and byte counters for a specific rule */
138 int ip6tc_zero_counter(const ip6t_chainlabel chain,
139 unsigned int rulenum,
140 struct ip6tc_handle *handle);
142 /* set packet and byte counters for a specific rule */
143 int ip6tc_set_counter(const ip6t_chainlabel chain,
144 unsigned int rulenum,
145 struct ip6t_counters *counters,
146 struct ip6tc_handle *handle);
148 /* Makes the actual changes. */
149 int ip6tc_commit(struct ip6tc_handle *handle);
151 /* Get raw socket. */
152 int ip6tc_get_raw_socket(void);
154 /* Translates errno numbers into more human-readable form than strerror. */
155 const char *ip6tc_strerror(int err);
157 /* Return prefix length, or -1 if not contiguous */
158 int ipv6_prefix_length(const struct in6_addr *a);
160 extern void dump_entries6(struct ip6tc_handle *const);
162 #endif /* _LIBIP6TC_H */