4 #define XT_SCTP_SRC_PORTS 0x01
5 #define XT_SCTP_DEST_PORTS 0x02
6 #define XT_SCTP_CHUNK_TYPES 0x04
8 #define XT_SCTP_VALID_FLAGS 0x07
10 #define ELEMCOUNT(x) (sizeof(x)/sizeof(x[0]))
13 struct xt_sctp_flag_info {
19 #define XT_NUM_SCTP_FLAGS 4
22 u_int16_t dpts[2]; /* Min, Max */
23 u_int16_t spts[2]; /* Min, Max */
25 u_int32_t chunkmap[256 / sizeof (u_int32_t)]; /* Bit mask of chunks to be matched according to RFC 2960 */
27 #define SCTP_CHUNK_MATCH_ANY 0x01 /* Match if any of the chunk types are present */
28 #define SCTP_CHUNK_MATCH_ALL 0x02 /* Match if all of the chunk types are present */
29 #define SCTP_CHUNK_MATCH_ONLY 0x04 /* Match if these are the only chunk types present */
31 u_int32_t chunk_match_type;
32 struct xt_sctp_flag_info flag_info[XT_NUM_SCTP_FLAGS];
39 #define bytes(type) (sizeof(type) * 8)
41 #define SCTP_CHUNKMAP_SET(chunkmap, type) \
43 chunkmap[type / bytes(u_int32_t)] |= \
44 1 << (type % bytes(u_int32_t)); \
47 #define SCTP_CHUNKMAP_CLEAR(chunkmap, type) \
49 chunkmap[type / bytes(u_int32_t)] &= \
50 ~(1 << (type % bytes(u_int32_t))); \
53 #define SCTP_CHUNKMAP_IS_SET(chunkmap, type) \
55 (chunkmap[type / bytes (u_int32_t)] & \
56 (1 << (type % bytes (u_int32_t)))) ? 1: 0; \
59 #define SCTP_CHUNKMAP_RESET(chunkmap) \
62 for (i = 0; i < ELEMCOUNT(chunkmap); i++) \
66 #define SCTP_CHUNKMAP_SET_ALL(chunkmap) \
69 for (i = 0; i < ELEMCOUNT(chunkmap); i++) \
73 #define SCTP_CHUNKMAP_COPY(destmap, srcmap) \
76 for (i = 0; i < ELEMCOUNT(chunkmap); i++) \
77 destmap[i] = srcmap[i]; \
80 #define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \
84 for (i = 0; i < ELEMCOUNT(chunkmap); i++) { \
93 #define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \
97 for (i = 0; i < ELEMCOUNT(chunkmap); i++) { \
98 if (chunkmap[i] != ~0) { \
106 #endif /* _XT_SCTP_H_ */