RT-AC66 3.0.0.4.374.130 core
[tomato.git] / release / src-rt-6.x / linux / linux-2.6 / include / linux / netfilter_ipv4 / ipt_sctp.h
blob80b3dbacd193ea6ad6c6ce82a94b68d36a1aed78
1 #ifndef _IPT_SCTP_H_
2 #define _IPT_SCTP_H_
4 #define IPT_SCTP_SRC_PORTS 0x01
5 #define IPT_SCTP_DEST_PORTS 0x02
6 #define IPT_SCTP_CHUNK_TYPES 0x04
8 #define IPT_SCTP_VALID_FLAGS 0x07
11 struct ipt_sctp_flag_info {
12 u_int8_t chunktype;
13 u_int8_t flag;
14 u_int8_t flag_mask;
17 #define IPT_NUM_SCTP_FLAGS 4
19 struct ipt_sctp_info {
20 u_int16_t dpts[2]; /* Min, Max */
21 u_int16_t spts[2]; /* Min, Max */
23 u_int32_t chunkmap[256 / sizeof (u_int32_t)]; /* Bit mask of chunks to be matched according to RFC 2960 */
25 #define SCTP_CHUNK_MATCH_ANY 0x01 /* Match if any of the chunk types are present */
26 #define SCTP_CHUNK_MATCH_ALL 0x02 /* Match if all of the chunk types are present */
27 #define SCTP_CHUNK_MATCH_ONLY 0x04 /* Match if these are the only chunk types present */
29 u_int32_t chunk_match_type;
30 struct ipt_sctp_flag_info flag_info[IPT_NUM_SCTP_FLAGS];
31 int flag_count;
33 u_int32_t flags;
34 u_int32_t invflags;
37 #define bytes(type) (sizeof(type) * 8)
39 #define SCTP_CHUNKMAP_SET(chunkmap, type) \
40 do { \
41 chunkmap[type / bytes(u_int32_t)] |= \
42 1 << (type % bytes(u_int32_t)); \
43 } while (0)
45 #define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \
46 do { \
47 chunkmap[type / bytes(u_int32_t)] &= \
48 ~(1 << (type % bytes(u_int32_t))); \
49 } while (0)
51 #define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \
52 ({ \
53 (chunkmap[type / bytes (u_int32_t)] & \
54 (1 << (type % bytes (u_int32_t)))) ? 1: 0; \
57 #define SCTP_CHUNKMAP_RESET(chunkmap) \
58 do { \
59 int i; \
60 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \
61 chunkmap[i] = 0; \
62 } while (0)
64 #define SCTP_CHUNKMAP_SET_ALL(chunkmap) \
65 do { \
66 int i; \
67 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \
68 chunkmap[i] = ~0; \
69 } while (0)
71 #define SCTP_CHUNKMAP_COPY(destmap, srcmap) \
72 do { \
73 int i; \
74 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) \
75 destmap[i] = srcmap[i]; \
76 } while (0)
78 #define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \
79 ({ \
80 int i; \
81 int flag = 1; \
82 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) { \
83 if (chunkmap[i]) { \
84 flag = 0; \
85 break; \
86 } \
87 } \
88 flag; \
91 #define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \
92 ({ \
93 int i; \
94 int flag = 1; \
95 for (i = 0; i < ARRAY_SIZE(chunkmap); i++) { \
96 if (chunkmap[i] != ~0) { \
97 flag = 0; \
98 break; \
99 } \
101 flag; \
104 #endif /* _IPT_SCTP_H_ */