GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / toolchains / hndtools-arm-linux-2.6.36-uclibc-4.5.3 / arm-brcm-linux-uclibcgnueabi / sysroot / usr / include / linux / netfilter / x_tables.h
blobfa2d9578d7d2ef4b19079464d2d2087e6a4baab5
1 #ifndef _X_TABLES_H
2 #define _X_TABLES_H
3 #include <linux/kernel.h>
4 #include <linux/types.h>
6 #define XT_FUNCTION_MAXNAMELEN 30
7 #define XT_EXTENSION_MAXNAMELEN 29
8 #define XT_TABLE_MAXNAMELEN 32
10 struct xt_entry_match {
11 union {
12 struct {
13 __u16 match_size;
15 /* Used by userspace */
16 char name[XT_EXTENSION_MAXNAMELEN];
17 __u8 revision;
18 } user;
19 struct {
20 __u16 match_size;
22 /* Used inside the kernel */
23 struct xt_match *match;
24 } kernel;
26 /* Total length */
27 __u16 match_size;
28 } u;
30 unsigned char data[0];
33 struct xt_entry_target {
34 union {
35 struct {
36 __u16 target_size;
38 /* Used by userspace */
39 char name[XT_EXTENSION_MAXNAMELEN];
40 __u8 revision;
41 } user;
42 struct {
43 __u16 target_size;
45 /* Used inside the kernel */
46 struct xt_target *target;
47 } kernel;
49 /* Total length */
50 __u16 target_size;
51 } u;
53 unsigned char data[0];
56 #define XT_TARGET_INIT(__name, __size) \
57 { \
58 .target.u.user = { \
59 .target_size = XT_ALIGN(__size), \
60 .name = __name, \
61 }, \
64 struct xt_standard_target {
65 struct xt_entry_target target;
66 int verdict;
69 /* The argument to IPT_SO_GET_REVISION_*. Returns highest revision
70 * kernel supports, if >= revision. */
71 struct xt_get_revision {
72 char name[XT_EXTENSION_MAXNAMELEN];
73 __u8 revision;
76 /* CONTINUE verdict for targets */
77 #define XT_CONTINUE 0xFFFFFFFF
79 /* For standard target */
80 #define XT_RETURN (-NF_REPEAT - 1)
82 /* this is a dummy structure to find out the alignment requirement for a struct
83 * containing all the fundamental data types that are used in ipt_entry,
84 * ip6t_entry and arpt_entry. This sucks, and it is a hack. It will be my
85 * personal pleasure to remove it -HW
87 struct _xt_align {
88 __u8 u8;
89 __u16 u16;
90 __u32 u32;
91 __u64 u64;
94 #define XT_ALIGN(s) __ALIGN_KERNEL((s), __alignof__(struct _xt_align))
96 /* Standard return verdict, or do jump. */
97 #define XT_STANDARD_TARGET ""
98 /* Error verdict. */
99 #define XT_ERROR_TARGET "ERROR"
101 #define SET_COUNTER(c,b,p) do { (c).bcnt = (b); (c).pcnt = (p); } while(0)
102 #define ADD_COUNTER(c,b,p) do { (c).bcnt += (b); (c).pcnt += (p); } while(0)
104 struct xt_counters {
105 __u64 pcnt, bcnt; /* Packet and byte counters */
108 /* The argument to IPT_SO_ADD_COUNTERS. */
109 struct xt_counters_info {
110 /* Which table. */
111 char name[XT_TABLE_MAXNAMELEN];
113 unsigned int num_counters;
115 /* The counters (actually `number' of these). */
116 struct xt_counters counters[0];
119 #define XT_INV_PROTO 0x40 /* Invert the sense of PROTO. */
121 /* fn returns 0 to continue iteration */
122 #define XT_MATCH_ITERATE(type, e, fn, args...) \
123 ({ \
124 unsigned int __i; \
125 int __ret = 0; \
126 struct xt_entry_match *__m; \
128 for (__i = sizeof(type); \
129 __i < (e)->target_offset; \
130 __i += __m->u.match_size) { \
131 __m = (void *)e + __i; \
133 __ret = fn(__m , ## args); \
134 if (__ret != 0) \
135 break; \
137 __ret; \
140 /* fn returns 0 to continue iteration */
141 #define XT_ENTRY_ITERATE_CONTINUE(type, entries, size, n, fn, args...) \
142 ({ \
143 unsigned int __i, __n; \
144 int __ret = 0; \
145 type *__entry; \
147 for (__i = 0, __n = 0; __i < (size); \
148 __i += __entry->next_offset, __n++) { \
149 __entry = (void *)(entries) + __i; \
150 if (__n < n) \
151 continue; \
153 __ret = fn(__entry , ## args); \
154 if (__ret != 0) \
155 break; \
157 __ret; \
160 /* fn returns 0 to continue iteration */
161 #define XT_ENTRY_ITERATE(type, entries, size, fn, args...) \
162 XT_ENTRY_ITERATE_CONTINUE(type, entries, size, 0, fn, args)
165 /* pos is normally a struct ipt_entry/ip6t_entry/etc. */
166 #define xt_entry_foreach(pos, ehead, esize) \
167 for ((pos) = (typeof(pos))(ehead); \
168 (pos) < (typeof(pos))((char *)(ehead) + (esize)); \
169 (pos) = (typeof(pos))((char *)(pos) + (pos)->next_offset))
171 /* can only be xt_entry_match, so no use of typeof here */
172 #define xt_ematch_foreach(pos, entry) \
173 for ((pos) = (struct xt_entry_match *)entry->elems; \
174 (pos) < (struct xt_entry_match *)((char *)(entry) + \
175 (entry)->target_offset); \
176 (pos) = (struct xt_entry_match *)((char *)(pos) + \
177 (pos)->u.match_size))
180 #endif /* _X_TABLES_H */