~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/uapi/linux/netfilter/xt_sctp.h

Version: ~ [ linux-5.11 ] ~ [ linux-5.10.17 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.99 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.176 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.221 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.257 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.257 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.85 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2 #ifndef _XT_SCTP_H_
  3 #define _XT_SCTP_H_
  4 
  5 #include <linux/types.h>
  6 
  7 #define XT_SCTP_SRC_PORTS               0x01
  8 #define XT_SCTP_DEST_PORTS              0x02
  9 #define XT_SCTP_CHUNK_TYPES             0x04
 10 
 11 #define XT_SCTP_VALID_FLAGS             0x07
 12 
 13 struct xt_sctp_flag_info {
 14         __u8 chunktype;
 15         __u8 flag;
 16         __u8 flag_mask;
 17 };
 18 
 19 #define XT_NUM_SCTP_FLAGS       4
 20 
 21 struct xt_sctp_info {
 22         __u16 dpts[2];  /* Min, Max */
 23         __u16 spts[2];  /* Min, Max */
 24 
 25         __u32 chunkmap[256 / sizeof (__u32)];  /* Bit mask of chunks to be matched according to RFC 2960 */
 26 
 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 */
 30 
 31         __u32 chunk_match_type;
 32         struct xt_sctp_flag_info flag_info[XT_NUM_SCTP_FLAGS];
 33         int flag_count;
 34 
 35         __u32 flags;
 36         __u32 invflags;
 37 };
 38 
 39 #define bytes(type) (sizeof(type) * 8)
 40 
 41 #define SCTP_CHUNKMAP_SET(chunkmap, type)               \
 42         do {                                            \
 43                 (chunkmap)[type / bytes(__u32)] |=      \
 44                         1u << (type % bytes(__u32));    \
 45         } while (0)
 46 
 47 #define SCTP_CHUNKMAP_CLEAR(chunkmap, type)                     \
 48         do {                                                    \
 49                 (chunkmap)[type / bytes(__u32)] &=              \
 50                         ~(1u << (type % bytes(__u32))); \
 51         } while (0)
 52 
 53 #define SCTP_CHUNKMAP_IS_SET(chunkmap, type)                    \
 54 ({                                                              \
 55         ((chunkmap)[type / bytes (__u32)] &             \
 56                 (1u << (type % bytes (__u32)))) ? 1: 0; \
 57 })
 58 
 59 #define SCTP_CHUNKMAP_RESET(chunkmap) \
 60         memset((chunkmap), 0, sizeof(chunkmap))
 61 
 62 #define SCTP_CHUNKMAP_SET_ALL(chunkmap) \
 63         memset((chunkmap), ~0U, sizeof(chunkmap))
 64 
 65 #define SCTP_CHUNKMAP_COPY(destmap, srcmap) \
 66         memcpy((destmap), (srcmap), sizeof(srcmap))
 67 
 68 #define SCTP_CHUNKMAP_IS_CLEAR(chunkmap) \
 69         __sctp_chunkmap_is_clear((chunkmap), ARRAY_SIZE(chunkmap))
 70 static inline _Bool
 71 __sctp_chunkmap_is_clear(const __u32 *chunkmap, unsigned int n)
 72 {
 73         unsigned int i;
 74         for (i = 0; i < n; ++i)
 75                 if (chunkmap[i])
 76                         return 0;
 77         return 1;
 78 }
 79 
 80 #define SCTP_CHUNKMAP_IS_ALL_SET(chunkmap) \
 81         __sctp_chunkmap_is_all_set((chunkmap), ARRAY_SIZE(chunkmap))
 82 static inline _Bool
 83 __sctp_chunkmap_is_all_set(const __u32 *chunkmap, unsigned int n)
 84 {
 85         unsigned int i;
 86         for (i = 0; i < n; ++i)
 87                 if (chunkmap[i] != ~0U)
 88                         return 0;
 89         return 1;
 90 }
 91 
 92 #endif /* _XT_SCTP_H_ */
 93 
 94 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp