diff options
| author | Daniel Borkmann <dborkman@redhat.com> | 2013-04-09 01:54:01 -0400 |
|---|---|---|
| committer | David S. Miller <davem@davemloft.net> | 2013-04-09 13:19:39 -0400 |
| commit | 1b8664341100716202c29d67f24d67094a82971e (patch) | |
| tree | 6420508b2e4053927f2ec6df4a516366da31691f /include/uapi/linux | |
| parent | 3d4a1316286d037c29a36a8451a9612f60404ef7 (diff) | |
net: sctp: introduce uapi header for sctp
This patch introduces an UAPI header for the SCTP protocol,
so that we can facilitate the maintenance and development of
user land applications or libraries, in particular in terms
of header synchronization.
To not break compatibility, some fragments from lksctp-tools'
netinet/sctp.h have been carefully included, while taking care
that neither kernel nor user land breaks, so both compile fine
with this change (for lksctp-tools I tested with the old
netinet/sctp.h header and with a newly adapted one that includes
the uapi sctp header). lksctp-tools smoke test run through
successfully as well in both cases.
Suggested-by: Neil Horman <nhorman@tuxdriver.com>
Cc: Neil Horman <nhorman@tuxdriver.com>
Cc: Vlad Yasevich <vyasevich@gmail.com>
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/uapi/linux')
| -rw-r--r-- | include/uapi/linux/Kbuild | 1 | ||||
| -rw-r--r-- | include/uapi/linux/sctp.h | 846 |
2 files changed, 847 insertions, 0 deletions
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild index 5c8a1d25e21c..7df190525337 100644 --- a/include/uapi/linux/Kbuild +++ b/include/uapi/linux/Kbuild | |||
| @@ -331,6 +331,7 @@ header-y += rtnetlink.h | |||
| 331 | header-y += scc.h | 331 | header-y += scc.h |
| 332 | header-y += sched.h | 332 | header-y += sched.h |
| 333 | header-y += screen_info.h | 333 | header-y += screen_info.h |
| 334 | header-y += sctp.h | ||
| 334 | header-y += sdla.h | 335 | header-y += sdla.h |
| 335 | header-y += seccomp.h | 336 | header-y += seccomp.h |
| 336 | header-y += securebits.h | 337 | header-y += securebits.h |
diff --git a/include/uapi/linux/sctp.h b/include/uapi/linux/sctp.h new file mode 100644 index 000000000000..66b466e4ca08 --- /dev/null +++ b/include/uapi/linux/sctp.h | |||
| @@ -0,0 +1,846 @@ | |||
| 1 | /* SCTP kernel implementation | ||
| 2 | * (C) Copyright IBM Corp. 2001, 2004 | ||
| 3 | * Copyright (c) 1999-2000 Cisco, Inc. | ||
| 4 | * Copyright (c) 1999-2001 Motorola, Inc. | ||
| 5 | * Copyright (c) 2002 Intel Corp. | ||
| 6 | * | ||
| 7 | * This file is part of the SCTP kernel implementation | ||
| 8 | * | ||
| 9 | * This header represents the structures and constants needed to support | ||
| 10 | * the SCTP Extension to the Sockets API. | ||
| 11 | * | ||
| 12 | * This SCTP implementation is free software; | ||
| 13 | * you can redistribute it and/or modify it under the terms of | ||
| 14 | * the GNU General Public License as published by | ||
| 15 | * the Free Software Foundation; either version 2, or (at your option) | ||
| 16 | * any later version. | ||
| 17 | * | ||
| 18 | * This SCTP implementation is distributed in the hope that it | ||
| 19 | * will be useful, but WITHOUT ANY WARRANTY; without even the implied | ||
| 20 | * ************************ | ||
| 21 | * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
| 22 | * See the GNU General Public License for more details. | ||
| 23 | * | ||
| 24 | * You should have received a copy of the GNU General Public License | ||
| 25 | * along with GNU CC; see the file COPYING. If not, write to | ||
| 26 | * the Free Software Foundation, 59 Temple Place - Suite 330, | ||
| 27 | * Boston, MA 02111-1307, USA. | ||
| 28 | * | ||
| 29 | * Please send any bug reports or fixes you make to the | ||
| 30 | * email address(es): | ||
| 31 | * lksctp developers <lksctp-developers@lists.sourceforge.net> | ||
| 32 | * | ||
| 33 | * Or submit a bug report through the following website: | ||
| 34 | * http://www.sf.net/projects/lksctp | ||
| 35 | * | ||
| 36 | * Written or modified by: | ||
| 37 | * La Monte H.P. Yarroll <piggy@acm.org> | ||
| 38 | * R. Stewart <randall@sctp.chicago.il.us> | ||
| 39 | * K. Morneau <kmorneau@cisco.com> | ||
| 40 | * Q. Xie <qxie1@email.mot.com> | ||
| 41 | * Karl Knutson <karl@athena.chicago.il.us> | ||
| 42 | * Jon Grimm <jgrimm@us.ibm.com> | ||
| 43 | * Daisy Chang <daisyc@us.ibm.com> | ||
| 44 | * Ryan Layer <rmlayer@us.ibm.com> | ||
| 45 | * Ardelle Fan <ardelle.fan@intel.com> | ||
| 46 | * Sridhar Samudrala <sri@us.ibm.com> | ||
| 47 | * Inaky Perez-Gonzalez <inaky.gonzalez@intel.com> | ||
| 48 | * Vlad Yasevich <vladislav.yasevich@hp.com> | ||
| 49 | * | ||
| 50 | * Any bugs reported given to us we will try to fix... any fixes shared will | ||
| 51 | * be incorporated into the next SCTP release. | ||
| 52 | */ | ||
| 53 | |||
| 54 | #ifndef _UAPI_SCTP_H | ||
| 55 | #define _UAPI_SCTP_H | ||
| 56 | |||
| 57 | #include <linux/types.h> | ||
| 58 | #include <linux/socket.h> | ||
| 59 | |||
| 60 | typedef __s32 sctp_assoc_t; | ||
| 61 | |||
| 62 | /* The following symbols come from the Sockets API Extensions for | ||
| 63 | * SCTP <draft-ietf-tsvwg-sctpsocket-07.txt>. | ||
| 64 | */ | ||
| 65 | #define SCTP_RTOINFO 0 | ||
| 66 | #define SCTP_ASSOCINFO 1 | ||
| 67 | #define SCTP_INITMSG 2 | ||
| 68 | #define SCTP_NODELAY 3 /* Get/set nodelay option. */ | ||
| 69 | #define SCTP_AUTOCLOSE 4 | ||
| 70 | #define SCTP_SET_PEER_PRIMARY_ADDR 5 | ||
| 71 | #define SCTP_PRIMARY_ADDR 6 | ||
| 72 | #define SCTP_ADAPTATION_LAYER 7 | ||
| 73 | #define SCTP_DISABLE_FRAGMENTS 8 | ||
| 74 | #define SCTP_PEER_ADDR_PARAMS 9 | ||
| 75 | #define SCTP_DEFAULT_SEND_PARAM 10 | ||
| 76 | #define SCTP_EVENTS 11 | ||
| 77 | #define SCTP_I_WANT_MAPPED_V4_ADDR 12 /* Turn on/off mapped v4 addresses */ | ||
| 78 | #define SCTP_MAXSEG 13 /* Get/set maximum fragment. */ | ||
| 79 | #define SCTP_STATUS 14 | ||
| 80 | #define SCTP_GET_PEER_ADDR_INFO 15 | ||
| 81 | #define SCTP_DELAYED_ACK_TIME 16 | ||
| 82 | #define SCTP_DELAYED_ACK SCTP_DELAYED_ACK_TIME | ||
| 83 | #define SCTP_DELAYED_SACK SCTP_DELAYED_ACK_TIME | ||
| 84 | #define SCTP_CONTEXT 17 | ||
| 85 | #define SCTP_FRAGMENT_INTERLEAVE 18 | ||
| 86 | #define SCTP_PARTIAL_DELIVERY_POINT 19 /* Set/Get partial delivery point */ | ||
| 87 | #define SCTP_MAX_BURST 20 /* Set/Get max burst */ | ||
| 88 | #define SCTP_AUTH_CHUNK 21 /* Set only: add a chunk type to authenticate */ | ||
| 89 | #define SCTP_HMAC_IDENT 22 | ||
| 90 | #define SCTP_AUTH_KEY 23 | ||
| 91 | #define SCTP_AUTH_ACTIVE_KEY 24 | ||
| 92 | #define SCTP_AUTH_DELETE_KEY 25 | ||
| 93 | #define SCTP_PEER_AUTH_CHUNKS 26 /* Read only */ | ||
| 94 | #define SCTP_LOCAL_AUTH_CHUNKS 27 /* Read only */ | ||
| 95 | #define SCTP_GET_ASSOC_NUMBER 28 /* Read only */ | ||
| 96 | #define SCTP_GET_ASSOC_ID_LIST 29 /* Read only */ | ||
| 97 | #define SCTP_AUTO_ASCONF 30 | ||
| 98 | #define SCTP_PEER_ADDR_THLDS 31 | ||
| 99 | |||
| 100 | /* Internal Socket Options. Some of the sctp library functions are | ||
| 101 | * implemented using these socket options. | ||
| 102 | */ | ||
| 103 | #define SCTP_SOCKOPT_BINDX_ADD 100 /* BINDX requests for adding addrs */ | ||
| 104 | #define SCTP_SOCKOPT_BINDX_REM 101 /* BINDX requests for removing addrs. */ | ||
| 105 | #define SCTP_SOCKOPT_PEELOFF 102 /* peel off association. */ | ||
| 106 | /* Options 104-106 are deprecated and removed. Do not use this space */ | ||
| 107 | #define SCTP_SOCKOPT_CONNECTX_OLD 107 /* CONNECTX old requests. */ | ||
| 108 | #define SCTP_GET_PEER_ADDRS 108 /* Get all peer address. */ | ||
| 109 | #define SCTP_GET_LOCAL_ADDRS 109 /* Get all local address. */ | ||
| 110 | #define SCTP_SOCKOPT_CONNECTX 110 /* CONNECTX requests. */ | ||
| 111 | #define SCTP_SOCKOPT_CONNECTX3 111 /* CONNECTX requests (updated) */ | ||
| 112 | #define SCTP_GET_ASSOC_STATS 112 /* Read only */ | ||
| 113 | |||
| 114 | /* | ||
| 115 | * 5.2.1 SCTP Initiation Structure (SCTP_INIT) | ||
| 116 | * | ||
| 117 | * This cmsghdr structure provides information for initializing new | ||
| 118 | * SCTP associations with sendmsg(). The SCTP_INITMSG socket option | ||
| 119 | * uses this same data structure. This structure is not used for | ||
| 120 | * recvmsg(). | ||
| 121 | * | ||
| 122 | * cmsg_level cmsg_type cmsg_data[] | ||
| 123 | * ------------ ------------ ---------------------- | ||
| 124 | * IPPROTO_SCTP SCTP_INIT struct sctp_initmsg | ||
| 125 | * | ||
| 126 | */ | ||
| 127 | struct sctp_initmsg { | ||
| 128 | __u16 sinit_num_ostreams; | ||
| 129 | __u16 sinit_max_instreams; | ||
| 130 | __u16 sinit_max_attempts; | ||
| 131 | __u16 sinit_max_init_timeo; | ||
| 132 | }; | ||
| 133 | |||
| 134 | /* | ||
| 135 | * 5.2.2 SCTP Header Information Structure (SCTP_SNDRCV) | ||
| 136 | * | ||
| 137 | * This cmsghdr structure specifies SCTP options for sendmsg() and | ||
| 138 | * describes SCTP header information about a received message through | ||
| 139 | * recvmsg(). | ||
| 140 | * | ||
| 141 | * cmsg_level cmsg_type cmsg_data[] | ||
| 142 | * ------------ ------------ ---------------------- | ||
| 143 | * IPPROTO_SCTP SCTP_SNDRCV struct sctp_sndrcvinfo | ||
| 144 | * | ||
| 145 | */ | ||
| 146 | struct sctp_sndrcvinfo { | ||
| 147 | __u16 sinfo_stream; | ||
| 148 | __u16 sinfo_ssn; | ||
| 149 | __u16 sinfo_flags; | ||
| 150 | __u32 sinfo_ppid; | ||
| 151 | __u32 sinfo_context; | ||
| 152 | __u32 sinfo_timetolive; | ||
| 153 | __u32 sinfo_tsn; | ||
| 154 | __u32 sinfo_cumtsn; | ||
| 155 | sctp_assoc_t sinfo_assoc_id; | ||
| 156 | }; | ||
| 157 | |||
| 158 | /* | ||
| 159 | * sinfo_flags: 16 bits (unsigned integer) | ||
| 160 | * | ||
| 161 | * This field may contain any of the following flags and is composed of | ||
| 162 | * a bitwise OR of these values. | ||
| 163 | */ | ||
| 164 | |||
| 165 | enum sctp_sinfo_flags { | ||
| 166 | SCTP_UNORDERED = 1, /* Send/receive message unordered. */ | ||
| 167 | SCTP_ADDR_OVER = 2, /* Override the primary destination. */ | ||
| 168 | SCTP_ABORT=4, /* Send an ABORT message to the peer. */ | ||
| 169 | SCTP_SACK_IMMEDIATELY = 8, /* SACK should be sent without delay */ | ||
| 170 | SCTP_EOF=MSG_FIN, /* Initiate graceful shutdown process. */ | ||
| 171 | }; | ||
| 172 | |||
| 173 | typedef union { | ||
| 174 | __u8 raw; | ||
| 175 | struct sctp_initmsg init; | ||
| 176 | struct sctp_sndrcvinfo sndrcv; | ||
| 177 | } sctp_cmsg_data_t; | ||
| 178 | |||
| 179 | /* These are cmsg_types. */ | ||
| 180 | typedef enum sctp_cmsg_type { | ||
| 181 | SCTP_INIT, /* 5.2.1 SCTP Initiation Structure */ | ||
| 182 | #define SCTP_INIT SCTP_INIT | ||
| 183 | SCTP_SNDRCV, /* 5.2.2 SCTP Header Information Structure */ | ||
| 184 | #define SCTP_SNDRCV SCTP_SNDRCV | ||
| 185 | } sctp_cmsg_t; | ||
| 186 | |||
| 187 | /* | ||
| 188 | * 5.3.1.1 SCTP_ASSOC_CHANGE | ||
| 189 | * | ||
| 190 | * Communication notifications inform the ULP that an SCTP association | ||
| 191 | * has either begun or ended. The identifier for a new association is | ||
| 192 | * provided by this notificaion. The notification information has the | ||
| 193 | * following format: | ||
| 19 | |||
