1/****************************************************************************
2 ****************************************************************************
3 ***
4 ***   This header was automatically generated from a Linux kernel header
5 ***   of the same name, to make information necessary for userspace to
6 ***   call into the kernel available to libc.  It contains only constants,
7 ***   structures, and macros generated from the original header, and thus,
8 ***   contains no copyrightable information.
9 ***
10 ***   To edit the content of this header, modify the corresponding
11 ***   source file (e.g. under external/kernel-headers/original/) then
12 ***   run bionic/libc/kernel/tools/update_all.py
13 ***
14 ***   Any manual change here will be lost the next time this script will
15 ***   be run. You've been warned!
16 ***
17 ****************************************************************************
18 ****************************************************************************/
19#ifndef _XT_SCTP_H_
20#define _XT_SCTP_H_
21#include <linux/types.h>
22#define XT_SCTP_SRC_PORTS 0x01
23#define XT_SCTP_DEST_PORTS 0x02
24#define XT_SCTP_CHUNK_TYPES 0x04
25#define XT_SCTP_VALID_FLAGS 0x07
26struct xt_sctp_flag_info {
27  __u8 chunktype;
28  __u8 flag;
29  __u8 flag_mask;
30};
31#define XT_NUM_SCTP_FLAGS 4
32struct xt_sctp_info {
33  __u16 dpts[2];
34  __u16 spts[2];
35  __u32 chunkmap[256 / sizeof(__u32)];
36#define SCTP_CHUNK_MATCH_ANY 0x01
37#define SCTP_CHUNK_MATCH_ALL 0x02
38#define SCTP_CHUNK_MATCH_ONLY 0x04
39  __u32 chunk_match_type;
40  struct xt_sctp_flag_info flag_info[XT_NUM_SCTP_FLAGS];
41  int flag_count;
42  __u32 flags;
43  __u32 invflags;
44};
45#define bytes(type) (sizeof(type) * 8)
46#define SCTP_CHUNKMAP_SET(chunkmap,type) do { (chunkmap)[type / bytes(__u32)] |= 1 << (type % bytes(__u32)); } while(0)
47#define SCTP_CHUNKMAP_CLEAR(chunkmap,type) do { (chunkmap)[type / bytes(__u32)] &= ~(1 << (type % bytes(__u32))); } while(0)
48#define SCTP_CHUNKMAP_IS_SET(chunkmap,type) \
49({ ((chunkmap)[type / bytes(__u32)] & (1 << (type % bytes(__u32)))) ? 1 : 0; \
50})
51#define SCTP_CHUNKMAP_RESET(chunkmap) memset((chunkmap), 0, sizeof(chunkmap))
52#define SCTP_CHUNKMAP_SET_ALL(chunkmap) memset((chunkmap), ~0U, sizeof(chunkmap))
53#define SCTP_CHUNKMAP_COPY(destmap,srcmap) memcpy((destmap), (srcmap), sizeof(srcmap))
54#define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) __sctp_chunkmap_is_clear((chunkmap), ARRAY_SIZE(chunkmap))
55#define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) __sctp_chunkmap_is_all_set((chunkmap), ARRAY_SIZE(chunkmap))
56#endif
57