1224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/* SCTP kernel implementation
2224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * (C) Copyright IBM Corp. 2001, 2004
3224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * Copyright (c) 1999-2000 Cisco, Inc.
4224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * Copyright (c) 1999-2001 Motorola, Inc.
5224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * Copyright (c) 2002 Intel Corp.
6224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
7224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * This file is part of the SCTP kernel implementation
8224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
9224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * This header represents the structures and constants needed to support
10224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * the SCTP Extension to the Sockets API.
11224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
12224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * This SCTP implementation is free software;
13224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * you can redistribute it and/or modify it under the terms of
14224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * the GNU General Public License as published by
15224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * the Free Software Foundation; either version 2, or (at your option)
16224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * any later version.
17224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
18224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * This SCTP implementation is distributed in the hope that it
19224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * will be useful, but WITHOUT ANY WARRANTY; without even the implied
20224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *                 ************************
21224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
22224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * See the GNU General Public License for more details.
23224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
24224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * You should have received a copy of the GNU General Public License
25e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris * along with GNU CC; see the file COPYING.  If not, see
26e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris * <http://www.gnu.org/licenses/>.
27224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
28224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * Please send any bug reports or fixes you make to the
29224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * email address(es):
30e084501669a4e4931c9d648351ecd7d595b81b79Christopher Ferris *    lksctp developers <linux-sctp@vger.kernel.org>
31224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
32224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * Or submit a bug report through the following website:
33224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *    http://www.sf.net/projects/lksctp
34224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
35224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * Written or modified by:
36224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *    La Monte H.P. Yarroll    <piggy@acm.org>
37224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *    R. Stewart               <randall@sctp.chicago.il.us>
38224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *    K. Morneau               <kmorneau@cisco.com>
39224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *    Q. Xie                   <qxie1@email.mot.com>
40224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *    Karl Knutson             <karl@athena.chicago.il.us>
41224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *    Jon Grimm                <jgrimm@us.ibm.com>
42224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *    Daisy Chang              <daisyc@us.ibm.com>
43224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *    Ryan Layer               <rmlayer@us.ibm.com>
44224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *    Ardelle Fan              <ardelle.fan@intel.com>
45224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *    Sridhar Samudrala        <sri@us.ibm.com>
46224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *    Inaky Perez-Gonzalez     <inaky.gonzalez@intel.com>
47224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *    Vlad Yasevich            <vladislav.yasevich@hp.com>
48224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
49224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * Any bugs reported given to us we will try to fix... any fixes shared will
50224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * be incorporated into the next SCTP release.
51224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
52224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
53224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#ifndef _UAPI_SCTP_H
54224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define _UAPI_SCTP_H
55224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
56224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#include <linux/types.h>
57224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#include <linux/socket.h>
58224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
59224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengtypedef __s32 sctp_assoc_t;
60224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
61224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/* The following symbols come from the Sockets API Extensions for
62224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * SCTP <draft-ietf-tsvwg-sctpsocket-07.txt>.
63224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
64224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_RTOINFO	0
65224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_ASSOCINFO  1
66224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_INITMSG	2
67224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_NODELAY	3		/* Get/set nodelay option. */
68224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_AUTOCLOSE	4
69224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_SET_PEER_PRIMARY_ADDR 5
70224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_PRIMARY_ADDR	6
71224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_ADAPTATION_LAYER	7
72224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_DISABLE_FRAGMENTS	8
73224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_PEER_ADDR_PARAMS	9
74224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_DEFAULT_SEND_PARAM	10
75224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_EVENTS	11
76224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_I_WANT_MAPPED_V4_ADDR 12	/* Turn on/off mapped v4 addresses  */
77224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_MAXSEG	13		/* Get/set maximum fragment. */
78224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_STATUS	14
79224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_GET_PEER_ADDR_INFO	15
80224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_DELAYED_ACK_TIME	16
81224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_DELAYED_ACK SCTP_DELAYED_ACK_TIME
82224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_DELAYED_SACK SCTP_DELAYED_ACK_TIME
83224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_CONTEXT	17
84224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_FRAGMENT_INTERLEAVE	18
85224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_PARTIAL_DELIVERY_POINT	19 /* Set/Get partial delivery point */
86224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_MAX_BURST	20		/* Set/Get max burst */
87224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_AUTH_CHUNK	21	/* Set only: add a chunk type to authenticate */
88224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_HMAC_IDENT	22
89224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_AUTH_KEY	23
90224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_AUTH_ACTIVE_KEY	24
91224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_AUTH_DELETE_KEY	25
92224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_PEER_AUTH_CHUNKS	26	/* Read only */
93224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_LOCAL_AUTH_CHUNKS	27	/* Read only */
94224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_GET_ASSOC_NUMBER	28	/* Read only */
95224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_GET_ASSOC_ID_LIST	29	/* Read only */
96224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_AUTO_ASCONF       30
97224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_PEER_ADDR_THLDS	31
987c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris#define SCTP_RECVRCVINFO	32
997c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris#define SCTP_RECVNXTINFO	33
1007c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris#define SCTP_DEFAULT_SNDINFO	34
101224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
102224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/* Internal Socket Options. Some of the sctp library functions are
103224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * implemented using these socket options.
104224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
105224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_SOCKOPT_BINDX_ADD	100	/* BINDX requests for adding addrs */
106224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_SOCKOPT_BINDX_REM	101	/* BINDX requests for removing addrs. */
107224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_SOCKOPT_PEELOFF	102	/* peel off association. */
108224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/* Options 104-106 are deprecated and removed. Do not use this space */
109224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_SOCKOPT_CONNECTX_OLD	107	/* CONNECTX old requests. */
110224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_GET_PEER_ADDRS	108		/* Get all peer address. */
111224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_GET_LOCAL_ADDRS	109		/* Get all local address. */
112224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_SOCKOPT_CONNECTX	110		/* CONNECTX requests. */
113224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_SOCKOPT_CONNECTX3	111	/* CONNECTX requests (updated) */
114224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_GET_ASSOC_STATS	112	/* Read only */
115224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
1167c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris/* These are bit fields for msghdr->msg_flags.  See section 5.1.  */
1177c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris/* On user space Linux, these live in <bits/socket.h> as an enum.  */
1187c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferrisenum sctp_msg_flags {
1197c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris	MSG_NOTIFICATION = 0x8000,
1207c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris#define MSG_NOTIFICATION MSG_NOTIFICATION
1217c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris};
1227c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris
1237c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris/* 5.3.1 SCTP Initiation Structure (SCTP_INIT)
124224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
125224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   This cmsghdr structure provides information for initializing new
126224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   SCTP associations with sendmsg().  The SCTP_INITMSG socket option
127224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   uses this same data structure.  This structure is not used for
128224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   recvmsg().
129224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
130224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   cmsg_level    cmsg_type      cmsg_data[]
131224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   ------------  ------------   ----------------------
132224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   IPPROTO_SCTP  SCTP_INIT      struct sctp_initmsg
133224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
134224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct sctp_initmsg {
135224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 sinit_num_ostreams;
136224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 sinit_max_instreams;
137224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 sinit_max_attempts;
138224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 sinit_max_init_timeo;
139224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
140224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
1417c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris/* 5.3.2 SCTP Header Information Structure (SCTP_SNDRCV)
142224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
143224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   This cmsghdr structure specifies SCTP options for sendmsg() and
144224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   describes SCTP header information about a received message through
145224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   recvmsg().
146224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
147224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   cmsg_level    cmsg_type      cmsg_data[]
148224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   ------------  ------------   ----------------------
149224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   IPPROTO_SCTP  SCTP_SNDRCV    struct sctp_sndrcvinfo
150224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
151224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct sctp_sndrcvinfo {
152224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 sinfo_stream;
153224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 sinfo_ssn;
154224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 sinfo_flags;
155224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32 sinfo_ppid;
156224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32 sinfo_context;
157224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32 sinfo_timetolive;
158224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32 sinfo_tsn;
159224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32 sinfo_cumtsn;
160224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	sctp_assoc_t sinfo_assoc_id;
161224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
162224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
1637c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris/* 5.3.4 SCTP Send Information Structure (SCTP_SNDINFO)
1647c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris *
1657c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris *   This cmsghdr structure specifies SCTP options for sendmsg().
1667c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris *
1677c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris *   cmsg_level    cmsg_type      cmsg_data[]
1687c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris *   ------------  ------------   -------------------
1697c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris *   IPPROTO_SCTP  SCTP_SNDINFO   struct sctp_sndinfo
1707c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris */
1717c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferrisstruct sctp_sndinfo {
1727c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris	__u16 snd_sid;
1737c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris	__u16 snd_flags;
1747c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris	__u32 snd_ppid;
1757c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris	__u32 snd_context;
1767c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris	sctp_assoc_t snd_assoc_id;
1777c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris};
1787c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris
1797c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris/* 5.3.5 SCTP Receive Information Structure (SCTP_RCVINFO)
1807c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris *
1817c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris *   This cmsghdr structure describes SCTP receive information
1827c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris *   about a received message through recvmsg().
1837c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris *
1847c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris *   cmsg_level    cmsg_type      cmsg_data[]
1857c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris *   ------------  ------------   -------------------
1867c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris *   IPPROTO_SCTP  SCTP_RCVINFO   struct sctp_rcvinfo
1877c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris */
1887c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferrisstruct sctp_rcvinfo {
1897c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris	__u16 rcv_sid;
1907c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris	__u16 rcv_ssn;
1917c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris	__u16 rcv_flags;
1927c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris	__u32 rcv_ppid;
1937c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris	__u32 rcv_tsn;
1947c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris	__u32 rcv_cumtsn;
1957c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris	__u32 rcv_context;
1967c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris	sctp_assoc_t rcv_assoc_id;
1977c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris};
1987c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris
1997c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris/* 5.3.6 SCTP Next Receive Information Structure (SCTP_NXTINFO)
2007c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris *
2017c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris *   This cmsghdr structure describes SCTP receive information
2027c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris *   of the next message that will be delivered through recvmsg()
2037c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris *   if this information is already available when delivering
2047c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris *   the current message.
2057c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris *
2067c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris *   cmsg_level    cmsg_type      cmsg_data[]
2077c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris *   ------------  ------------   -------------------
2087c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris *   IPPROTO_SCTP  SCTP_NXTINFO   struct sctp_nxtinfo
2097c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris */
2107c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferrisstruct sctp_nxtinfo {
2117c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris	__u16 nxt_sid;
2127c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris	__u16 nxt_flags;
2137c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris	__u32 nxt_ppid;
2147c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris	__u32 nxt_length;
2157c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris	sctp_assoc_t nxt_assoc_id;
2167c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris};
2177c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris
218224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/*
219224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *  sinfo_flags: 16 bits (unsigned integer)
220224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
221224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   This field may contain any of the following flags and is composed of
222224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   a bitwise OR of these values.
223224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
224224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum sctp_sinfo_flags {
2257c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris	SCTP_UNORDERED		= (1 << 0), /* Send/receive message unordered. */
2267c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris	SCTP_ADDR_OVER		= (1 << 1), /* Override the primary destination. */
2277c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris	SCTP_ABORT		= (1 << 2), /* Send an ABORT message to the peer. */
2287c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris	SCTP_SACK_IMMEDIATELY	= (1 << 3), /* SACK should be sent without delay. */
2297c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris	SCTP_NOTIFICATION	= MSG_NOTIFICATION, /* Next message is not user msg but notification. */
2307c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris	SCTP_EOF		= MSG_FIN,  /* Initiate graceful shutdown process. */
231224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
232224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
233224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengtypedef union {
234224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u8   			raw;
235224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	struct sctp_initmsg	init;
236224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	struct sctp_sndrcvinfo	sndrcv;
237224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng} sctp_cmsg_data_t;
238224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
239224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/* These are cmsg_types.  */
240224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengtypedef enum sctp_cmsg_type {
2417c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris	SCTP_INIT,		/* 5.2.1 SCTP Initiation Structure */
242224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_INIT	SCTP_INIT
2437c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris	SCTP_SNDRCV,		/* 5.2.2 SCTP Header Information Structure */
244224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_SNDRCV	SCTP_SNDRCV
2457c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris	SCTP_SNDINFO,		/* 5.3.4 SCTP Send Information Structure */
2467c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris#define SCTP_SNDINFO	SCTP_SNDINFO
2477c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris	SCTP_RCVINFO,		/* 5.3.5 SCTP Receive Information Structure */
2487c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris#define SCTP_RCVINFO	SCTP_RCVINFO
2497c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris	SCTP_NXTINFO,		/* 5.3.6 SCTP Next Receive Information Structure */
2507c0b639731767acd9b3788628d81174c641fa6b9Christopher Ferris#define SCTP_NXTINFO	SCTP_NXTINFO
251224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng} sctp_cmsg_t;
252224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
253224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/*
254224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 5.3.1.1 SCTP_ASSOC_CHANGE
255224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
256224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   Communication notifications inform the ULP that an SCTP association
257224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   has either begun or ended. The identifier for a new association is
258224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   provided by this notificaion. The notification information has the
259224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   following format:
260224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
261224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
262224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct sctp_assoc_change {
263224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 sac_type;
264224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 sac_flags;
265224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32 sac_length;
266224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 sac_state;
267224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 sac_error;
268224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 sac_outbound_streams;
269224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 sac_inbound_streams;
270224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	sctp_assoc_t sac_assoc_id;
271224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u8 sac_info[0];
272224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
273224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
274224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/*
275224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   sac_state: 32 bits (signed integer)
276224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
277224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   This field holds one of a number of values that communicate the
278224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   event that happened to the association.  They include:
279224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
280224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   Note:  The following state names deviate from the API draft as
281224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   the names clash too easily with other kernel symbols.
282224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
283224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum sctp_sac_state {
284224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_COMM_UP,
285224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_COMM_LOST,
286224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_RESTART,
287224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_SHUTDOWN_COMP,
288224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_CANT_STR_ASSOC,
289224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
290224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
291224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/*
292224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 5.3.1.2 SCTP_PEER_ADDR_CHANGE
293224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
294224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   When a destination address on a multi-homed peer encounters a change
295224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   an interface details event is sent.  The information has the
296224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   following structure:
297224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
298224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct sctp_paddr_change {
299224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 spc_type;
300224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 spc_flags;
301224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32 spc_length;
302224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	struct sockaddr_storage spc_aaddr;
303224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	int spc_state;
304224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	int spc_error;
305224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	sctp_assoc_t spc_assoc_id;
306224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng} __attribute__((packed, aligned(4)));
307224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
308224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/*
309224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *    spc_state:  32 bits (signed integer)
310224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
311224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   This field holds one of a number of values that communicate the
312224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   event that happened to the address.  They include:
313224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
314224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum sctp_spc_state {
315224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_ADDR_AVAILABLE,
316224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_ADDR_UNREACHABLE,
317224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_ADDR_REMOVED,
318224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_ADDR_ADDED,
319224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_ADDR_MADE_PRIM,
320224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_ADDR_CONFIRMED,
321224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
322224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
323224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
324224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/*
325224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 5.3.1.3 SCTP_REMOTE_ERROR
326224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
327224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   A remote peer may send an Operational Error message to its peer.
328224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   This message indicates a variety of error conditions on an
329224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   association. The entire error TLV as it appears on the wire is
330224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   included in a SCTP_REMOTE_ERROR event.  Please refer to the SCTP
331224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   specification [SCTP] and any extensions for a list of possible
332224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   error formats. SCTP error TLVs have the format:
333224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
334224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct sctp_remote_error {
335224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 sre_type;
336224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 sre_flags;
337224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32 sre_length;
338224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 sre_error;
339224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	sctp_assoc_t sre_assoc_id;
340224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u8 sre_data[0];
341224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
342224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
343224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
344224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/*
345224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 5.3.1.4 SCTP_SEND_FAILED
346224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
347224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   If SCTP cannot deliver a message it may return the message as a
348224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   notification.
349224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
350224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct sctp_send_failed {
351224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 ssf_type;
352224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 ssf_flags;
353224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32 ssf_length;
354224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32 ssf_error;
355224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	struct sctp_sndrcvinfo ssf_info;
356224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	sctp_assoc_t ssf_assoc_id;
357224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u8 ssf_data[0];
358224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
359224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
360224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/*
361224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   ssf_flags: 16 bits (unsigned integer)
362224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
363224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   The flag value will take one of the following values
364224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
365224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   SCTP_DATA_UNSENT  - Indicates that the data was never put on
366224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *                       the wire.
367224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
368224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   SCTP_DATA_SENT    - Indicates that the data was put on the wire.
369224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *                       Note that this does not necessarily mean that the
370224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *                       data was (or was not) successfully delivered.
371224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
372224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum sctp_ssf_flags {
373224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_DATA_UNSENT,
374224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_DATA_SENT,
375224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
376224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
377224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/*
378224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 5.3.1.5 SCTP_SHUTDOWN_EVENT
379224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
380224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   When a peer sends a SHUTDOWN, SCTP delivers this notification to
381224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   inform the application that it should cease sending data.
382224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
383224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct sctp_shutdown_event {
384224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 sse_type;
385224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 sse_flags;
386224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32 sse_length;
387224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	sctp_assoc_t sse_assoc_id;
388224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
389224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
390224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/*
391224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 5.3.1.6 SCTP_ADAPTATION_INDICATION
392224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
393224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   When a peer sends a Adaptation Layer Indication parameter , SCTP
394224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   delivers this notification to inform the application
395224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   that of the peers requested adaptation layer.
396224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
397224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct sctp_adaptation_event {
398224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 sai_type;
399224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 sai_flags;
400224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32 sai_length;
401224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32 sai_adaptation_ind;
402224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	sctp_assoc_t sai_assoc_id;
403224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
404224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
405224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/*
406224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 5.3.1.7 SCTP_PARTIAL_DELIVERY_EVENT
407224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
408224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   When a receiver is engaged in a partial delivery of a
409224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   message this notification will be used to indicate
410224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   various events.
411224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
412224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct sctp_pdapi_event {
413224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 pdapi_type;
414224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 pdapi_flags;
415224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32 pdapi_length;
416224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32 pdapi_indication;
417224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	sctp_assoc_t pdapi_assoc_id;
418224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
419224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
420224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum { SCTP_PARTIAL_DELIVERY_ABORTED=0, };
421224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
422224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/*
423224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 5.3.1.8.  SCTP_AUTHENTICATION_EVENT
424224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
425224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *  When a receiver is using authentication this message will provide
426224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *  notifications regarding new keys being made active as well as errors.
427224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
428224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct sctp_authkey_event {
429224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 auth_type;
430224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 auth_flags;
431224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32 auth_length;
432224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 auth_keynumber;
433224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 auth_altkeynumber;
434224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32 auth_indication;
435224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	sctp_assoc_t auth_assoc_id;
436224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
437224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
438224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum { SCTP_AUTH_NEWKEY = 0, };
439224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
440224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/*
441224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 6.1.9. SCTP_SENDER_DRY_EVENT
442224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
443224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * When the SCTP stack has no more user data to send or retransmit, this
444224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * notification is given to the user. Also, at the time when a user app
445224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * subscribes to this event, if there is no data to be sent or
446224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * retransmit, the stack will immediately send up this notification.
447224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
448224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct sctp_sender_dry_event {
449224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 sender_dry_type;
450224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 sender_dry_flags;
451224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32 sender_dry_length;
452224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	sctp_assoc_t sender_dry_assoc_id;
453224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
454224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
455224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/*
456224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * Described in Section 7.3
457224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   Ancillary Data and Notification Interest Options
458224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
459224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct sctp_event_subscribe {
460224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u8 sctp_data_io_event;
461224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u8 sctp_association_event;
462224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u8 sctp_address_event;
463224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u8 sctp_send_failure_event;
464224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u8 sctp_peer_error_event;
465224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u8 sctp_shutdown_event;
466224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u8 sctp_partial_delivery_event;
467224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u8 sctp_adaptation_layer_event;
468224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u8 sctp_authentication_event;
469224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u8 sctp_sender_dry_event;
470224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
471224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
472224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/*
473224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 5.3.1 SCTP Notification Structure
474224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
475224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   The notification structure is defined as the union of all
476224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   notification types.
477224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
478224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
479224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengunion sctp_notification {
480224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	struct {
481224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng		__u16 sn_type;             /* Notification type. */
482224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng		__u16 sn_flags;
483224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng		__u32 sn_length;
484224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	} sn_header;
485224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	struct sctp_assoc_change sn_assoc_change;
486224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	struct sctp_paddr_change sn_paddr_change;
487224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	struct sctp_remote_error sn_remote_error;
488224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	struct sctp_send_failed sn_send_failed;
489224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	struct sctp_shutdown_event sn_shutdown_event;
490224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	struct sctp_adaptation_event sn_adaptation_event;
491224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	struct sctp_pdapi_event sn_pdapi_event;
492224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	struct sctp_authkey_event sn_authkey_event;
493224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	struct sctp_sender_dry_event sn_sender_dry_event;
494224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
495224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
496224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/* Section 5.3.1
497224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * All standard values for sn_type flags are greater than 2^15.
498224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * Values from 2^15 and down are reserved.
499224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
500224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
501224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum sctp_sn_type {
502224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_SN_TYPE_BASE     = (1<<15),
503224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_ASSOC_CHANGE,
504224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_ASSOC_CHANGE		SCTP_ASSOC_CHANGE
505224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_PEER_ADDR_CHANGE,
506224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_PEER_ADDR_CHANGE		SCTP_PEER_ADDR_CHANGE
507224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_SEND_FAILED,
508224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_SEND_FAILED		SCTP_SEND_FAILED
509224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_REMOTE_ERROR,
510224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_REMOTE_ERROR		SCTP_REMOTE_ERROR
511224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_SHUTDOWN_EVENT,
512224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_SHUTDOWN_EVENT		SCTP_SHUTDOWN_EVENT
513224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_PARTIAL_DELIVERY_EVENT,
514224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_PARTIAL_DELIVERY_EVENT	SCTP_PARTIAL_DELIVERY_EVENT
515224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_ADAPTATION_INDICATION,
516224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_ADAPTATION_INDICATION	SCTP_ADAPTATION_INDICATION
517224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_AUTHENTICATION_EVENT,
518224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_AUTHENTICATION_INDICATION	SCTP_AUTHENTICATION_EVENT
519224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_SENDER_DRY_EVENT,
520224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_SENDER_DRY_EVENT		SCTP_SENDER_DRY_EVENT
521224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
522224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
523224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/* Notification error codes used to fill up the error fields in some
524224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * notifications.
525224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * SCTP_PEER_ADDRESS_CHAGE 	: spc_error
526224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * SCTP_ASSOC_CHANGE		: sac_error
527224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * These names should be potentially included in the draft 04 of the SCTP
528224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * sockets API specification.
529224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
530224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengtypedef enum sctp_sn_error {
531224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_FAILED_THRESHOLD,
532224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_RECEIVED_SACK,
533224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_HEARTBEAT_SUCCESS,
534224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_RESPONSE_TO_USER_REQ,
535224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_INTERNAL_ERROR,
536224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_SHUTDOWN_GUARD_EXPIRES,
537224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_PEER_FAULTY,
538224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng} sctp_sn_error_t;
539224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
540224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/*
541224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 7.1.1 Retransmission Timeout Parameters (SCTP_RTOINFO)
542224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
543224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   The protocol parameters used to initialize and bound retransmission
544224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   timeout (RTO) are tunable.  See [SCTP] for more information on how
545224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   these parameters are used in RTO calculation.
546224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
547224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct sctp_rtoinfo {
548224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	sctp_assoc_t	srto_assoc_id;
549224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32		srto_initial;
550224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32		srto_max;
551224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32		srto_min;
552224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
553224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
554224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/*
555224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 7.1.2 Association Parameters (SCTP_ASSOCINFO)
556224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
557224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   This option is used to both examine and set various association and
558224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   endpoint parameters.
559224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
560224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct sctp_assocparams {
561224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	sctp_assoc_t	sasoc_assoc_id;
562224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16		sasoc_asocmaxrxt;
563224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16		sasoc_number_peer_destinations;
564224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32		sasoc_peer_rwnd;
565224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32		sasoc_local_rwnd;
566224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32		sasoc_cookie_life;
567224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
568224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
569224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/*
570224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 7.1.9 Set Peer Primary Address (SCTP_SET_PEER_PRIMARY_ADDR)
571224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
572224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *  Requests that the peer mark the enclosed address as the association
573224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *  primary. The enclosed address must be one of the association's
574224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *  locally bound addresses. The following structure is used to make a
575224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   set primary request:
576224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
577224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct sctp_setpeerprim {
578224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	sctp_assoc_t            sspp_assoc_id;
579224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	struct sockaddr_storage sspp_addr;
580224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng} __attribute__((packed, aligned(4)));
581224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
582224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/*
583224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 7.1.10 Set Primary Address (SCTP_PRIMARY_ADDR)
584224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
585224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *  Requests that the local SCTP stack use the enclosed peer address as
586224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *  the association primary. The enclosed address must be one of the
587224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *  association peer's addresses. The following structure is used to
588224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *  make a set peer primary request:
589224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
590224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct sctp_prim {
591224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	sctp_assoc_t            ssp_assoc_id;
592224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	struct sockaddr_storage ssp_addr;
593224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng} __attribute__((packed, aligned(4)));
594224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
595224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/* For backward compatibility use, define the old name too */
596224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define sctp_setprim	sctp_prim
597224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
598224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/*
599224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 7.1.11 Set Adaptation Layer Indicator (SCTP_ADAPTATION_LAYER)
600224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
601224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * Requests that the local endpoint set the specified Adaptation Layer
602224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * Indication parameter for all future INIT and INIT-ACK exchanges.
603224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
604224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct sctp_setadaptation {
605224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32	ssb_adaptation_ind;
606224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
607224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
608224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/*
609224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 7.1.13 Peer Address Parameters  (SCTP_PEER_ADDR_PARAMS)
610224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
611224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   Applications can enable or disable heartbeats for any peer address
612224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   of an association, modify an address's heartbeat interval, force a
613224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   heartbeat to be sent immediately, and adjust the address's maximum
614224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   number of retransmissions sent before an address is considered
615224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   unreachable. The following structure is used to access and modify an
616224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   address's parameters:
617224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
618224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum  sctp_spp_flags {
619224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SPP_HB_ENABLE = 1<<0,		/*Enable heartbeats*/
620224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SPP_HB_DISABLE = 1<<1,		/*Disable heartbeats*/
621224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE,
622224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SPP_HB_DEMAND = 1<<2,		/*Send heartbeat immediately*/
623224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SPP_PMTUD_ENABLE = 1<<3,	/*Enable PMTU discovery*/
624224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SPP_PMTUD_DISABLE = 1<<4,	/*Disable PMTU discovery*/
625224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE,
626224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SPP_SACKDELAY_ENABLE = 1<<5,	/*Enable SACK*/
627224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SPP_SACKDELAY_DISABLE = 1<<6,	/*Disable SACK*/
628224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE,
629224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SPP_HB_TIME_IS_ZERO = 1<<7,	/* Set HB delay to 0 */
630224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
631224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
632224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct sctp_paddrparams {
633224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	sctp_assoc_t		spp_assoc_id;
634224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	struct sockaddr_storage	spp_address;
635224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32			spp_hbinterval;
636224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16			spp_pathmaxrxt;
637224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32			spp_pathmtu;
638224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32			spp_sackdelay;
639224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32			spp_flags;
640224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng} __attribute__((packed, aligned(4)));
641224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
642224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/*
643224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 7.1.18.  Add a chunk that must be authenticated (SCTP_AUTH_CHUNK)
644224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
645224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * This set option adds a chunk type that the user is requesting to be
646224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * received only in an authenticated way.  Changes to the list of chunks
647224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * will only effect future associations on the socket.
648224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
649224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct sctp_authchunk {
650224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u8		sauth_chunk;
651224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
652224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
653224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/*
654224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 7.1.19.  Get or set the list of supported HMAC Identifiers (SCTP_HMAC_IDENT)
655224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
656224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * This option gets or sets the list of HMAC algorithms that the local
657224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * endpoint requires the peer to use.
658224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
659224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#ifndef __KERNEL__
660224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/* This here is only used by user space as is. It might not be a good idea
661224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * to export/reveal the whole structure with reserved fields etc.
662224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
663224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum {
664224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_AUTH_HMAC_ID_SHA1 = 1,
665224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_AUTH_HMAC_ID_SHA256 = 3,
666224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
667224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#endif
668224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
669224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct sctp_hmacalgo {
670224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32		shmac_num_idents;
671224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16		shmac_idents[];
672224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
673224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
674224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/* Sadly, user and kernel space have different names for
675224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * this structure member, so this is to not break anything.
676224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
677224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define shmac_number_of_idents	shmac_num_idents
678224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
679224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/*
680224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 7.1.20.  Set a shared key (SCTP_AUTH_KEY)
681224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
682224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * This option will set a shared secret key which is used to build an
683224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * association shared key.
684224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
685224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct sctp_authkey {
686224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	sctp_assoc_t	sca_assoc_id;
687224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16		sca_keynumber;
688224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16		sca_keylength;
689224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u8		sca_key[];
690224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
691224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
692224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/*
693224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 7.1.21.  Get or set the active shared key (SCTP_AUTH_ACTIVE_KEY)
694224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
695224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * This option will get or set the active shared key to be used to build
696224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * the association shared key.
697224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
698224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
699224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct sctp_authkeyid {
700224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	sctp_assoc_t	scact_assoc_id;
701224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16		scact_keynumber;
702224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
703224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
704224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
705224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/*
706224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 7.1.23.  Get or set delayed ack timer (SCTP_DELAYED_SACK)
707224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
708224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * This option will effect the way delayed acks are performed.  This
709224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * option allows you to get or set the delayed ack time, in
710224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * milliseconds.  It also allows changing the delayed ack frequency.
711224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * Changing the frequency to 1 disables the delayed sack algorithm.  If
712224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * the assoc_id is 0, then this sets or gets the endpoints default
713224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * values.  If the assoc_id field is non-zero, then the set or get
714224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * effects the specified association for the one to many model (the
715224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * assoc_id field is ignored by the one to one model).  Note that if
716224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * sack_delay or sack_freq are 0 when setting this option, then the
717224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * current values will remain unchanged.
718224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
719224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct sctp_sack_info {
720224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	sctp_assoc_t	sack_assoc_id;
721224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	uint32_t	sack_delay;
722224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	uint32_t	sack_freq;
723224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
724224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
725224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct sctp_assoc_value {
726224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng    sctp_assoc_t            assoc_id;
727224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng    uint32_t                assoc_value;
728224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
729224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
730224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/*
731224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 7.2.2 Peer Address Information
732224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
733224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   Applications can retrieve information about a specific peer address
734224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   of an association, including its reachability state, congestion
735224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   window, and retransmission timer values.  This information is
736224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   read-only. The following structure is used to access this
737224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   information:
738224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
739224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct sctp_paddrinfo {
740224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	sctp_assoc_t		spinfo_assoc_id;
741224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	struct sockaddr_storage	spinfo_address;
742224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__s32			spinfo_state;
743224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32			spinfo_cwnd;
744224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32			spinfo_srtt;
745224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32			spinfo_rto;
746224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32			spinfo_mtu;
747224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng} __attribute__((packed, aligned(4)));
748224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
749224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/* Peer addresses's state. */
750224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/* UNKNOWN: Peer address passed by the upper layer in sendmsg or connect[x]
751224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * calls.
752224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * UNCONFIRMED: Peer address received in INIT/INIT-ACK address parameters.
753224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *              Not yet confirmed by a heartbeat and not available for data
754224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *		transfers.
755224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * ACTIVE : Peer address confirmed, active and available for data transfers.
756224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * INACTIVE: Peer address inactive and not available for data transfers.
757224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
758224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum sctp_spinfo_state {
759224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_INACTIVE,
760224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_PF,
761224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_ACTIVE,
762224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_UNCONFIRMED,
763224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_UNKNOWN = 0xffff  /* Value used for transport state unknown */
764224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
765224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
766224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/*
767224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 7.2.1 Association Status (SCTP_STATUS)
768224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
769224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   Applications can retrieve current status information about an
770224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   association, including association state, peer receiver window size,
771224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   number of unacked data chunks, and number of data chunks pending
772224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   receipt.  This information is read-only.  The following structure is
773224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *   used to access this information:
774224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
775224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct sctp_status {
776224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	sctp_assoc_t		sstat_assoc_id;
777224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__s32			sstat_state;
778224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32			sstat_rwnd;
779224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16			sstat_unackdata;
780224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16			sstat_penddata;
781224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16			sstat_instrms;
782224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16			sstat_outstrms;
783224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32			sstat_fragmentation_point;
784224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	struct sctp_paddrinfo	sstat_primary;
785224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
786224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
787224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/*
788224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 7.2.3.  Get the list of chunks the peer requires to be authenticated
789224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *         (SCTP_PEER_AUTH_CHUNKS)
790224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
791224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * This option gets a list of chunks for a specified association that
792224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * the peer requires to be received authenticated only.
793224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
794224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct sctp_authchunks {
795224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	sctp_assoc_t	gauth_assoc_id;
796224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32		gauth_number_of_chunks;
797224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	uint8_t		gauth_chunks[];
798224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
799224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
800224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/* The broken spelling has been released already in lksctp-tools header,
801224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * so don't break anyone, now that it's fixed.
802224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
803224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define guth_number_of_chunks	gauth_number_of_chunks
804224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
805224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/* Association states.  */
806224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengenum sctp_sstat_state {
807224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_EMPTY                = 0,
808224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_CLOSED               = 1,
809224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_COOKIE_WAIT          = 2,
810224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_COOKIE_ECHOED        = 3,
811224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_ESTABLISHED          = 4,
812224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_SHUTDOWN_PENDING     = 5,
813224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_SHUTDOWN_SENT        = 6,
814224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_SHUTDOWN_RECEIVED    = 7,
815224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	SCTP_SHUTDOWN_ACK_SENT    = 8,
816224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
817224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
818224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/*
819224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 8.2.6. Get the Current Identifiers of Associations
820224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *        (SCTP_GET_ASSOC_ID_LIST)
821224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
822224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * This option gets the current list of SCTP association identifiers of
823224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * the SCTP associations handled by a one-to-many style socket.
824224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
825224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct sctp_assoc_ids {
826224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32		gaids_number_of_ids;
827224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	sctp_assoc_t	gaids_assoc_id[];
828224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
829224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
830224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/*
831224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 8.3, 8.5 get all peer/local addresses in an association.
832224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * This parameter struct is used by SCTP_GET_PEER_ADDRS and
833224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * SCTP_GET_LOCAL_ADDRS socket options used internally to implement
834224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * sctp_getpaddrs() and sctp_getladdrs() API.
835224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
836224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct sctp_getaddrs_old {
837224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	sctp_assoc_t            assoc_id;
838224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	int			addr_num;
839224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#ifdef __KERNEL__
840224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	struct sockaddr		__user *addrs;
841224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#else
842224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	struct sockaddr		*addrs;
843224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#endif
844224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
845224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
846224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct sctp_getaddrs {
847224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	sctp_assoc_t		assoc_id; /*input*/
848224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u32			addr_num; /*output*/
849224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u8			addrs[0]; /*output, variable size*/
850224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
851224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
852224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/* A socket user request obtained via SCTP_GET_ASSOC_STATS that retrieves
853224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * association stats. All stats are counts except sas_maxrto and
854224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * sas_obs_rto_ipaddr. maxrto is the max observed rto + transport since
855224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * the last call. Will return 0 when RTO was not update since last call
856224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
857224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct sctp_assoc_stats {
858224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	sctp_assoc_t	sas_assoc_id;    /* Input */
859224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng					 /* Transport of observed max RTO */
860224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	struct sockaddr_storage sas_obs_rto_ipaddr;
861224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u64		sas_maxrto;      /* Maximum Observed RTO for period */
862224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u64		sas_isacks;	 /* SACKs received */
863224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u64		sas_osacks;	 /* SACKs sent */
864224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u64		sas_opackets;	 /* Packets sent */
865224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u64		sas_ipackets;	 /* Packets received */
866224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u64		sas_rtxchunks;   /* Retransmitted Chunks */
867224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u64		sas_outofseqtsns;/* TSN received > next expected */
868224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u64		sas_idupchunks;  /* Dups received (ordered+unordered) */
869224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u64		sas_gapcnt;      /* Gap Acknowledgements Received */
870224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u64		sas_ouodchunks;  /* Unordered data chunks sent */
871224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u64		sas_iuodchunks;  /* Unordered data chunks received */
872224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u64		sas_oodchunks;	 /* Ordered data chunks sent */
873224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u64		sas_iodchunks;	 /* Ordered data chunks received */
874224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u64		sas_octrlchunks; /* Control chunks sent */
875224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u64		sas_ictrlchunks; /* Control chunks received */
876224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
877224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
878224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/*
879224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * 8.1 sctp_bindx()
880224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *
881224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * The flags parameter is formed from the bitwise OR of zero or more of the
882224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * following currently defined flags:
883224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
884224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_BINDX_ADD_ADDR 0x01
885224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#define SCTP_BINDX_REM_ADDR 0x02
886224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
887224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/* This is the structure that is passed as an argument(optval) to
888224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng * getsockopt(SCTP_SOCKOPT_PEELOFF).
889224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
890224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengtypedef struct {
891224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	sctp_assoc_t associd;
892224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	int sd;
893224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng} sctp_peeloff_arg_t;
894224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
895224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng/*
896224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng *  Peer Address Thresholds socket option
897224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng */
898224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Chengstruct sctp_paddrthlds {
899224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	sctp_assoc_t spt_assoc_id;
900224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	struct sockaddr_storage spt_address;
901224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 spt_pathmaxrxt;
902224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng	__u16 spt_pathpfthld;
903224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng};
904224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng
905224b54f69543a5c0ec18f99bd717d2b724582eb6Ben Cheng#endif /* _UAPI_SCTP_H */
906