130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/* SCTP kernel implementation
230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * (C) Copyright IBM Corp. 2001, 2004
330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * Copyright (c) 1999-2000 Cisco, Inc.
430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * Copyright (c) 1999-2001 Motorola, Inc.
530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * Copyright (c) 2002 Intel Corp.
630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * This file is part of the SCTP kernel implementation
830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * This header represents the structures and constants needed to support
1030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * the SCTP Extension to the Sockets API.
1130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
1230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * This SCTP implementation is free software;
1330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * you can redistribute it and/or modify it under the terms of
1430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * the GNU General Public License as published by
1530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * the Free Software Foundation; either version 2, or (at your option)
1630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * any later version.
1730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
1830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * This SCTP implementation is distributed in the hope that it
1930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * will be useful, but WITHOUT ANY WARRANTY; without even the implied
2030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *                 ************************
2130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
2230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * See the GNU General Public License for more details.
2330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
2430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * You should have received a copy of the GNU General Public License
25e87eaf040ab639e94ed0a58ff0eac68d1d38fb0aEd Heyl * along with GNU CC; see the file COPYING.  If not, see
26e87eaf040ab639e94ed0a58ff0eac68d1d38fb0aEd Heyl * <http://www.gnu.org/licenses/>.
2730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
2830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * Please send any bug reports or fixes you make to the
2930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * email address(es):
30e87eaf040ab639e94ed0a58ff0eac68d1d38fb0aEd Heyl *    lksctp developers <linux-sctp@vger.kernel.org>
3130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
3230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * Or submit a bug report through the following website:
3330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *    http://www.sf.net/projects/lksctp
3430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
3530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * Written or modified by:
3630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *    La Monte H.P. Yarroll    <piggy@acm.org>
3730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *    R. Stewart               <randall@sctp.chicago.il.us>
3830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *    K. Morneau               <kmorneau@cisco.com>
3930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *    Q. Xie                   <qxie1@email.mot.com>
4030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *    Karl Knutson             <karl@athena.chicago.il.us>
4130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *    Jon Grimm                <jgrimm@us.ibm.com>
4230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *    Daisy Chang              <daisyc@us.ibm.com>
4330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *    Ryan Layer               <rmlayer@us.ibm.com>
4430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *    Ardelle Fan              <ardelle.fan@intel.com>
4530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *    Sridhar Samudrala        <sri@us.ibm.com>
4630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *    Inaky Perez-Gonzalez     <inaky.gonzalez@intel.com>
4730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *    Vlad Yasevich            <vladislav.yasevich@hp.com>
4830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
4930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * Any bugs reported given to us we will try to fix... any fixes shared will
5030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * be incorporated into the next SCTP release.
5130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
5230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
5330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#ifndef _UAPI_SCTP_H
5430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define _UAPI_SCTP_H
5530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
5630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#include <linux/types.h>
5730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#include <linux/socket.h>
5830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
5930692c65c4174412c90e79489e98ab85c1a7412fBen Chengtypedef __s32 sctp_assoc_t;
6030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
6130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/* The following symbols come from the Sockets API Extensions for
6230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * SCTP <draft-ietf-tsvwg-sctpsocket-07.txt>.
6330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
6430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_RTOINFO	0
6530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_ASSOCINFO  1
6630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_INITMSG	2
6730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_NODELAY	3		/* Get/set nodelay option. */
6830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_AUTOCLOSE	4
6930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_SET_PEER_PRIMARY_ADDR 5
7030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_PRIMARY_ADDR	6
7130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_ADAPTATION_LAYER	7
7230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_DISABLE_FRAGMENTS	8
7330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_PEER_ADDR_PARAMS	9
7430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_DEFAULT_SEND_PARAM	10
7530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_EVENTS	11
7630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_I_WANT_MAPPED_V4_ADDR 12	/* Turn on/off mapped v4 addresses  */
7730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_MAXSEG	13		/* Get/set maximum fragment. */
7830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_STATUS	14
7930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_GET_PEER_ADDR_INFO	15
8030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_DELAYED_ACK_TIME	16
8130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_DELAYED_ACK SCTP_DELAYED_ACK_TIME
8230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_DELAYED_SACK SCTP_DELAYED_ACK_TIME
8330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_CONTEXT	17
8430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_FRAGMENT_INTERLEAVE	18
8530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_PARTIAL_DELIVERY_POINT	19 /* Set/Get partial delivery point */
8630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_MAX_BURST	20		/* Set/Get max burst */
8730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_AUTH_CHUNK	21	/* Set only: add a chunk type to authenticate */
8830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_HMAC_IDENT	22
8930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_AUTH_KEY	23
9030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_AUTH_ACTIVE_KEY	24
9130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_AUTH_DELETE_KEY	25
9230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_PEER_AUTH_CHUNKS	26	/* Read only */
9330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_LOCAL_AUTH_CHUNKS	27	/* Read only */
9430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_GET_ASSOC_NUMBER	28	/* Read only */
9530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_GET_ASSOC_ID_LIST	29	/* Read only */
9630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_AUTO_ASCONF       30
9730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_PEER_ADDR_THLDS	31
9830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
9930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/* Internal Socket Options. Some of the sctp library functions are
10030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * implemented using these socket options.
10130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
10230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_SOCKOPT_BINDX_ADD	100	/* BINDX requests for adding addrs */
10330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_SOCKOPT_BINDX_REM	101	/* BINDX requests for removing addrs. */
10430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_SOCKOPT_PEELOFF	102	/* peel off association. */
10530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/* Options 104-106 are deprecated and removed. Do not use this space */
10630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_SOCKOPT_CONNECTX_OLD	107	/* CONNECTX old requests. */
10730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_GET_PEER_ADDRS	108		/* Get all peer address. */
10830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_GET_LOCAL_ADDRS	109		/* Get all local address. */
10930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_SOCKOPT_CONNECTX	110		/* CONNECTX requests. */
11030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_SOCKOPT_CONNECTX3	111	/* CONNECTX requests (updated) */
11130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_GET_ASSOC_STATS	112	/* Read only */
11230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
11330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
11430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * 5.2.1 SCTP Initiation Structure (SCTP_INIT)
11530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
11630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   This cmsghdr structure provides information for initializing new
11730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   SCTP associations with sendmsg().  The SCTP_INITMSG socket option
11830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   uses this same data structure.  This structure is not used for
11930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   recvmsg().
12030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
12130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   cmsg_level    cmsg_type      cmsg_data[]
12230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   ------------  ------------   ----------------------
12330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   IPPROTO_SCTP  SCTP_INIT      struct sctp_initmsg
12430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
12530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
12630692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sctp_initmsg {
12730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 sinit_num_ostreams;
12830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 sinit_max_instreams;
12930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 sinit_max_attempts;
13030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 sinit_max_init_timeo;
13130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
13230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
13330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
13430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * 5.2.2 SCTP Header Information Structure (SCTP_SNDRCV)
13530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
13630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   This cmsghdr structure specifies SCTP options for sendmsg() and
13730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   describes SCTP header information about a received message through
13830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   recvmsg().
13930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
14030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   cmsg_level    cmsg_type      cmsg_data[]
14130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   ------------  ------------   ----------------------
14230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   IPPROTO_SCTP  SCTP_SNDRCV    struct sctp_sndrcvinfo
14330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
14430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
14530692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sctp_sndrcvinfo {
14630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 sinfo_stream;
14730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 sinfo_ssn;
14830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 sinfo_flags;
14930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32 sinfo_ppid;
15030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32 sinfo_context;
15130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32 sinfo_timetolive;
15230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32 sinfo_tsn;
15330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32 sinfo_cumtsn;
15430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	sctp_assoc_t sinfo_assoc_id;
15530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
15630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
15730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
15830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *  sinfo_flags: 16 bits (unsigned integer)
15930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
16030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   This field may contain any of the following flags and is composed of
16130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   a bitwise OR of these values.
16230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
16330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
16430692c65c4174412c90e79489e98ab85c1a7412fBen Chengenum sctp_sinfo_flags {
16530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_UNORDERED = 1,  /* Send/receive message unordered. */
16630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_ADDR_OVER = 2,  /* Override the primary destination. */
16730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_ABORT=4,        /* Send an ABORT message to the peer. */
16830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_SACK_IMMEDIATELY = 8,	/* SACK should be sent without delay */
16930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_EOF=MSG_FIN,    /* Initiate graceful shutdown process. */
17030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
17130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
17230692c65c4174412c90e79489e98ab85c1a7412fBen Chengtypedef union {
17330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u8   			raw;
17430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	struct sctp_initmsg	init;
17530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	struct sctp_sndrcvinfo	sndrcv;
17630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng} sctp_cmsg_data_t;
17730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
17830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/* These are cmsg_types.  */
17930692c65c4174412c90e79489e98ab85c1a7412fBen Chengtypedef enum sctp_cmsg_type {
18030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_INIT,              /* 5.2.1 SCTP Initiation Structure */
18130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_INIT	SCTP_INIT
18230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_SNDRCV,            /* 5.2.2 SCTP Header Information Structure */
18330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_SNDRCV	SCTP_SNDRCV
18430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng} sctp_cmsg_t;
18530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
18630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
18730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * 5.3.1.1 SCTP_ASSOC_CHANGE
18830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
18930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   Communication notifications inform the ULP that an SCTP association
19030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   has either begun or ended. The identifier for a new association is
19130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   provided by this notificaion. The notification information has the
19230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   following format:
19330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
19430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
19530692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sctp_assoc_change {
19630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 sac_type;
19730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 sac_flags;
19830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32 sac_length;
19930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 sac_state;
20030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 sac_error;
20130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 sac_outbound_streams;
20230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 sac_inbound_streams;
20330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	sctp_assoc_t sac_assoc_id;
20430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u8 sac_info[0];
20530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
20630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
20730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
20830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   sac_state: 32 bits (signed integer)
20930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
21030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   This field holds one of a number of values that communicate the
21130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   event that happened to the association.  They include:
21230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
21330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   Note:  The following state names deviate from the API draft as
21430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   the names clash too easily with other kernel symbols.
21530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
21630692c65c4174412c90e79489e98ab85c1a7412fBen Chengenum sctp_sac_state {
21730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_COMM_UP,
21830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_COMM_LOST,
21930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_RESTART,
22030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_SHUTDOWN_COMP,
22130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_CANT_STR_ASSOC,
22230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
22330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
22430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
22530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * 5.3.1.2 SCTP_PEER_ADDR_CHANGE
22630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
22730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   When a destination address on a multi-homed peer encounters a change
22830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   an interface details event is sent.  The information has the
22930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   following structure:
23030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
23130692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sctp_paddr_change {
23230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 spc_type;
23330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 spc_flags;
23430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32 spc_length;
23530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	struct sockaddr_storage spc_aaddr;
23630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	int spc_state;
23730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	int spc_error;
23830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	sctp_assoc_t spc_assoc_id;
23930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng} __attribute__((packed, aligned(4)));
24030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
24130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
24230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *    spc_state:  32 bits (signed integer)
24330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
24430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   This field holds one of a number of values that communicate the
24530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   event that happened to the address.  They include:
24630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
24730692c65c4174412c90e79489e98ab85c1a7412fBen Chengenum sctp_spc_state {
24830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_ADDR_AVAILABLE,
24930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_ADDR_UNREACHABLE,
25030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_ADDR_REMOVED,
25130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_ADDR_ADDED,
25230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_ADDR_MADE_PRIM,
25330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_ADDR_CONFIRMED,
25430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
25530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
25630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
25730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
25830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * 5.3.1.3 SCTP_REMOTE_ERROR
25930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
26030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   A remote peer may send an Operational Error message to its peer.
26130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   This message indicates a variety of error conditions on an
26230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   association. The entire error TLV as it appears on the wire is
26330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   included in a SCTP_REMOTE_ERROR event.  Please refer to the SCTP
26430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   specification [SCTP] and any extensions for a list of possible
26530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   error formats. SCTP error TLVs have the format:
26630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
26730692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sctp_remote_error {
26830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 sre_type;
26930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 sre_flags;
27030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32 sre_length;
27130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 sre_error;
27230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	sctp_assoc_t sre_assoc_id;
27330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u8 sre_data[0];
27430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
27530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
27630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
27730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
27830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * 5.3.1.4 SCTP_SEND_FAILED
27930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
28030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   If SCTP cannot deliver a message it may return the message as a
28130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   notification.
28230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
28330692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sctp_send_failed {
28430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 ssf_type;
28530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 ssf_flags;
28630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32 ssf_length;
28730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32 ssf_error;
28830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	struct sctp_sndrcvinfo ssf_info;
28930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	sctp_assoc_t ssf_assoc_id;
29030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u8 ssf_data[0];
29130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
29230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
29330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
29430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   ssf_flags: 16 bits (unsigned integer)
29530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
29630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   The flag value will take one of the following values
29730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
29830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   SCTP_DATA_UNSENT  - Indicates that the data was never put on
29930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *                       the wire.
30030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
30130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   SCTP_DATA_SENT    - Indicates that the data was put on the wire.
30230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *                       Note that this does not necessarily mean that the
30330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *                       data was (or was not) successfully delivered.
30430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
30530692c65c4174412c90e79489e98ab85c1a7412fBen Chengenum sctp_ssf_flags {
30630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_DATA_UNSENT,
30730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_DATA_SENT,
30830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
30930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
31030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
31130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * 5.3.1.5 SCTP_SHUTDOWN_EVENT
31230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
31330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   When a peer sends a SHUTDOWN, SCTP delivers this notification to
31430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   inform the application that it should cease sending data.
31530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
31630692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sctp_shutdown_event {
31730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 sse_type;
31830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 sse_flags;
31930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32 sse_length;
32030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	sctp_assoc_t sse_assoc_id;
32130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
32230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
32330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
32430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * 5.3.1.6 SCTP_ADAPTATION_INDICATION
32530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
32630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   When a peer sends a Adaptation Layer Indication parameter , SCTP
32730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   delivers this notification to inform the application
32830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   that of the peers requested adaptation layer.
32930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
33030692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sctp_adaptation_event {
33130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 sai_type;
33230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 sai_flags;
33330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32 sai_length;
33430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32 sai_adaptation_ind;
33530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	sctp_assoc_t sai_assoc_id;
33630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
33730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
33830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
33930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * 5.3.1.7 SCTP_PARTIAL_DELIVERY_EVENT
34030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
34130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   When a receiver is engaged in a partial delivery of a
34230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   message this notification will be used to indicate
34330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   various events.
34430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
34530692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sctp_pdapi_event {
34630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 pdapi_type;
34730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 pdapi_flags;
34830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32 pdapi_length;
34930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32 pdapi_indication;
35030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	sctp_assoc_t pdapi_assoc_id;
35130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
35230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
35330692c65c4174412c90e79489e98ab85c1a7412fBen Chengenum { SCTP_PARTIAL_DELIVERY_ABORTED=0, };
35430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
35530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
35630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * 5.3.1.8.  SCTP_AUTHENTICATION_EVENT
35730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
35830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *  When a receiver is using authentication this message will provide
35930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *  notifications regarding new keys being made active as well as errors.
36030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
36130692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sctp_authkey_event {
36230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 auth_type;
36330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 auth_flags;
36430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32 auth_length;
36530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 auth_keynumber;
36630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 auth_altkeynumber;
36730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32 auth_indication;
36830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	sctp_assoc_t auth_assoc_id;
36930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
37030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
37130692c65c4174412c90e79489e98ab85c1a7412fBen Chengenum { SCTP_AUTH_NEWKEY = 0, };
37230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
37330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
37430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * 6.1.9. SCTP_SENDER_DRY_EVENT
37530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
37630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * When the SCTP stack has no more user data to send or retransmit, this
37730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * notification is given to the user. Also, at the time when a user app
37830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * subscribes to this event, if there is no data to be sent or
37930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * retransmit, the stack will immediately send up this notification.
38030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
38130692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sctp_sender_dry_event {
38230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 sender_dry_type;
38330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 sender_dry_flags;
38430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32 sender_dry_length;
38530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	sctp_assoc_t sender_dry_assoc_id;
38630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
38730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
38830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
38930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * Described in Section 7.3
39030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   Ancillary Data and Notification Interest Options
39130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
39230692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sctp_event_subscribe {
39330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u8 sctp_data_io_event;
39430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u8 sctp_association_event;
39530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u8 sctp_address_event;
39630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u8 sctp_send_failure_event;
39730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u8 sctp_peer_error_event;
39830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u8 sctp_shutdown_event;
39930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u8 sctp_partial_delivery_event;
40030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u8 sctp_adaptation_layer_event;
40130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u8 sctp_authentication_event;
40230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u8 sctp_sender_dry_event;
40330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
40430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
40530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
40630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * 5.3.1 SCTP Notification Structure
40730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
40830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   The notification structure is defined as the union of all
40930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   notification types.
41030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
41130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
41230692c65c4174412c90e79489e98ab85c1a7412fBen Chengunion sctp_notification {
41330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	struct {
41430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng		__u16 sn_type;             /* Notification type. */
41530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng		__u16 sn_flags;
41630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng		__u32 sn_length;
41730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	} sn_header;
41830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	struct sctp_assoc_change sn_assoc_change;
41930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	struct sctp_paddr_change sn_paddr_change;
42030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	struct sctp_remote_error sn_remote_error;
42130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	struct sctp_send_failed sn_send_failed;
42230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	struct sctp_shutdown_event sn_shutdown_event;
42330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	struct sctp_adaptation_event sn_adaptation_event;
42430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	struct sctp_pdapi_event sn_pdapi_event;
42530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	struct sctp_authkey_event sn_authkey_event;
42630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	struct sctp_sender_dry_event sn_sender_dry_event;
42730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
42830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
42930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/* Section 5.3.1
43030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * All standard values for sn_type flags are greater than 2^15.
43130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * Values from 2^15 and down are reserved.
43230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
43330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
43430692c65c4174412c90e79489e98ab85c1a7412fBen Chengenum sctp_sn_type {
43530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_SN_TYPE_BASE     = (1<<15),
43630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_ASSOC_CHANGE,
43730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_ASSOC_CHANGE		SCTP_ASSOC_CHANGE
43830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_PEER_ADDR_CHANGE,
43930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_PEER_ADDR_CHANGE		SCTP_PEER_ADDR_CHANGE
44030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_SEND_FAILED,
44130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_SEND_FAILED		SCTP_SEND_FAILED
44230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_REMOTE_ERROR,
44330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_REMOTE_ERROR		SCTP_REMOTE_ERROR
44430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_SHUTDOWN_EVENT,
44530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_SHUTDOWN_EVENT		SCTP_SHUTDOWN_EVENT
44630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_PARTIAL_DELIVERY_EVENT,
44730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_PARTIAL_DELIVERY_EVENT	SCTP_PARTIAL_DELIVERY_EVENT
44830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_ADAPTATION_INDICATION,
44930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_ADAPTATION_INDICATION	SCTP_ADAPTATION_INDICATION
45030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_AUTHENTICATION_EVENT,
45130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_AUTHENTICATION_INDICATION	SCTP_AUTHENTICATION_EVENT
45230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_SENDER_DRY_EVENT,
45330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_SENDER_DRY_EVENT		SCTP_SENDER_DRY_EVENT
45430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
45530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
45630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/* Notification error codes used to fill up the error fields in some
45730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * notifications.
45830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * SCTP_PEER_ADDRESS_CHAGE 	: spc_error
45930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * SCTP_ASSOC_CHANGE		: sac_error
46030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * These names should be potentially included in the draft 04 of the SCTP
46130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * sockets API specification.
46230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
46330692c65c4174412c90e79489e98ab85c1a7412fBen Chengtypedef enum sctp_sn_error {
46430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_FAILED_THRESHOLD,
46530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_RECEIVED_SACK,
46630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_HEARTBEAT_SUCCESS,
46730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_RESPONSE_TO_USER_REQ,
46830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_INTERNAL_ERROR,
46930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_SHUTDOWN_GUARD_EXPIRES,
47030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_PEER_FAULTY,
47130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng} sctp_sn_error_t;
47230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
47330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
47430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * 7.1.1 Retransmission Timeout Parameters (SCTP_RTOINFO)
47530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
47630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   The protocol parameters used to initialize and bound retransmission
47730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   timeout (RTO) are tunable.  See [SCTP] for more information on how
47830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   these parameters are used in RTO calculation.
47930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
48030692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sctp_rtoinfo {
48130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	sctp_assoc_t	srto_assoc_id;
48230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32		srto_initial;
48330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32		srto_max;
48430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32		srto_min;
48530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
48630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
48730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
48830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * 7.1.2 Association Parameters (SCTP_ASSOCINFO)
48930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
49030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   This option is used to both examine and set various association and
49130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   endpoint parameters.
49230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
49330692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sctp_assocparams {
49430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	sctp_assoc_t	sasoc_assoc_id;
49530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16		sasoc_asocmaxrxt;
49630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16		sasoc_number_peer_destinations;
49730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32		sasoc_peer_rwnd;
49830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32		sasoc_local_rwnd;
49930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32		sasoc_cookie_life;
50030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
50130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
50230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
50330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * 7.1.9 Set Peer Primary Address (SCTP_SET_PEER_PRIMARY_ADDR)
50430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
50530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *  Requests that the peer mark the enclosed address as the association
50630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *  primary. The enclosed address must be one of the association's
50730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *  locally bound addresses. The following structure is used to make a
50830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   set primary request:
50930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
51030692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sctp_setpeerprim {
51130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	sctp_assoc_t            sspp_assoc_id;
51230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	struct sockaddr_storage sspp_addr;
51330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng} __attribute__((packed, aligned(4)));
51430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
51530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
51630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * 7.1.10 Set Primary Address (SCTP_PRIMARY_ADDR)
51730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
51830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *  Requests that the local SCTP stack use the enclosed peer address as
51930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *  the association primary. The enclosed address must be one of the
52030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *  association peer's addresses. The following structure is used to
52130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *  make a set peer primary request:
52230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
52330692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sctp_prim {
52430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	sctp_assoc_t            ssp_assoc_id;
52530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	struct sockaddr_storage ssp_addr;
52630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng} __attribute__((packed, aligned(4)));
52730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
52830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/* For backward compatibility use, define the old name too */
52930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define sctp_setprim	sctp_prim
53030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
53130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
53230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * 7.1.11 Set Adaptation Layer Indicator (SCTP_ADAPTATION_LAYER)
53330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
53430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * Requests that the local endpoint set the specified Adaptation Layer
53530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * Indication parameter for all future INIT and INIT-ACK exchanges.
53630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
53730692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sctp_setadaptation {
53830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32	ssb_adaptation_ind;
53930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
54030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
54130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
54230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * 7.1.13 Peer Address Parameters  (SCTP_PEER_ADDR_PARAMS)
54330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
54430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   Applications can enable or disable heartbeats for any peer address
54530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   of an association, modify an address's heartbeat interval, force a
54630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   heartbeat to be sent immediately, and adjust the address's maximum
54730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   number of retransmissions sent before an address is considered
54830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   unreachable. The following structure is used to access and modify an
54930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   address's parameters:
55030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
55130692c65c4174412c90e79489e98ab85c1a7412fBen Chengenum  sctp_spp_flags {
55230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SPP_HB_ENABLE = 1<<0,		/*Enable heartbeats*/
55330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SPP_HB_DISABLE = 1<<1,		/*Disable heartbeats*/
55430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE,
55530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SPP_HB_DEMAND = 1<<2,		/*Send heartbeat immediately*/
55630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SPP_PMTUD_ENABLE = 1<<3,	/*Enable PMTU discovery*/
55730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SPP_PMTUD_DISABLE = 1<<4,	/*Disable PMTU discovery*/
55830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE,
55930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SPP_SACKDELAY_ENABLE = 1<<5,	/*Enable SACK*/
56030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SPP_SACKDELAY_DISABLE = 1<<6,	/*Disable SACK*/
56130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE,
56230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SPP_HB_TIME_IS_ZERO = 1<<7,	/* Set HB delay to 0 */
56330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
56430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
56530692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sctp_paddrparams {
56630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	sctp_assoc_t		spp_assoc_id;
56730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	struct sockaddr_storage	spp_address;
56830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32			spp_hbinterval;
56930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16			spp_pathmaxrxt;
57030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32			spp_pathmtu;
57130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32			spp_sackdelay;
57230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32			spp_flags;
57330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng} __attribute__((packed, aligned(4)));
57430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
57530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
57630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * 7.1.18.  Add a chunk that must be authenticated (SCTP_AUTH_CHUNK)
57730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
57830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * This set option adds a chunk type that the user is requesting to be
57930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * received only in an authenticated way.  Changes to the list of chunks
58030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * will only effect future associations on the socket.
58130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
58230692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sctp_authchunk {
58330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u8		sauth_chunk;
58430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
58530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
58630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
58730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * 7.1.19.  Get or set the list of supported HMAC Identifiers (SCTP_HMAC_IDENT)
58830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
58930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * This option gets or sets the list of HMAC algorithms that the local
59030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * endpoint requires the peer to use.
59130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
59230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#ifndef __KERNEL__
59330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/* This here is only used by user space as is. It might not be a good idea
59430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * to export/reveal the whole structure with reserved fields etc.
59530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
59630692c65c4174412c90e79489e98ab85c1a7412fBen Chengenum {
59730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_AUTH_HMAC_ID_SHA1 = 1,
59830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_AUTH_HMAC_ID_SHA256 = 3,
59930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
60030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#endif
60130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
60230692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sctp_hmacalgo {
60330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32		shmac_num_idents;
60430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16		shmac_idents[];
60530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
60630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
60730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/* Sadly, user and kernel space have different names for
60830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * this structure member, so this is to not break anything.
60930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
61030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define shmac_number_of_idents	shmac_num_idents
61130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
61230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
61330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * 7.1.20.  Set a shared key (SCTP_AUTH_KEY)
61430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
61530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * This option will set a shared secret key which is used to build an
61630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * association shared key.
61730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
61830692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sctp_authkey {
61930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	sctp_assoc_t	sca_assoc_id;
62030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16		sca_keynumber;
62130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16		sca_keylength;
62230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u8		sca_key[];
62330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
62430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
62530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
62630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * 7.1.21.  Get or set the active shared key (SCTP_AUTH_ACTIVE_KEY)
62730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
62830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * This option will get or set the active shared key to be used to build
62930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * the association shared key.
63030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
63130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
63230692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sctp_authkeyid {
63330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	sctp_assoc_t	scact_assoc_id;
63430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16		scact_keynumber;
63530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
63630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
63730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
63830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
63930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * 7.1.23.  Get or set delayed ack timer (SCTP_DELAYED_SACK)
64030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
64130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * This option will effect the way delayed acks are performed.  This
64230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * option allows you to get or set the delayed ack time, in
64330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * milliseconds.  It also allows changing the delayed ack frequency.
64430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * Changing the frequency to 1 disables the delayed sack algorithm.  If
64530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * the assoc_id is 0, then this sets or gets the endpoints default
64630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * values.  If the assoc_id field is non-zero, then the set or get
64730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * effects the specified association for the one to many model (the
64830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * assoc_id field is ignored by the one to one model).  Note that if
64930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * sack_delay or sack_freq are 0 when setting this option, then the
65030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * current values will remain unchanged.
65130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
65230692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sctp_sack_info {
65330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	sctp_assoc_t	sack_assoc_id;
65430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	uint32_t	sack_delay;
65530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	uint32_t	sack_freq;
65630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
65730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
65830692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sctp_assoc_value {
65930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng    sctp_assoc_t            assoc_id;
66030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng    uint32_t                assoc_value;
66130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
66230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
66330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
66430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * 7.2.2 Peer Address Information
66530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
66630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   Applications can retrieve information about a specific peer address
66730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   of an association, including its reachability state, congestion
66830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   window, and retransmission timer values.  This information is
66930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   read-only. The following structure is used to access this
67030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   information:
67130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
67230692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sctp_paddrinfo {
67330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	sctp_assoc_t		spinfo_assoc_id;
67430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	struct sockaddr_storage	spinfo_address;
67530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__s32			spinfo_state;
67630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32			spinfo_cwnd;
67730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32			spinfo_srtt;
67830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32			spinfo_rto;
67930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32			spinfo_mtu;
68030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng} __attribute__((packed, aligned(4)));
68130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
68230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/* Peer addresses's state. */
68330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/* UNKNOWN: Peer address passed by the upper layer in sendmsg or connect[x]
68430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * calls.
68530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * UNCONFIRMED: Peer address received in INIT/INIT-ACK address parameters.
68630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *              Not yet confirmed by a heartbeat and not available for data
68730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *		transfers.
68830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * ACTIVE : Peer address confirmed, active and available for data transfers.
68930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * INACTIVE: Peer address inactive and not available for data transfers.
69030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
69130692c65c4174412c90e79489e98ab85c1a7412fBen Chengenum sctp_spinfo_state {
69230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_INACTIVE,
69330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_PF,
69430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_ACTIVE,
69530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_UNCONFIRMED,
69630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_UNKNOWN = 0xffff  /* Value used for transport state unknown */
69730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
69830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
69930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
70030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * 7.2.1 Association Status (SCTP_STATUS)
70130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
70230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   Applications can retrieve current status information about an
70330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   association, including association state, peer receiver window size,
70430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   number of unacked data chunks, and number of data chunks pending
70530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   receipt.  This information is read-only.  The following structure is
70630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *   used to access this information:
70730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
70830692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sctp_status {
70930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	sctp_assoc_t		sstat_assoc_id;
71030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__s32			sstat_state;
71130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32			sstat_rwnd;
71230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16			sstat_unackdata;
71330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16			sstat_penddata;
71430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16			sstat_instrms;
71530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16			sstat_outstrms;
71630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32			sstat_fragmentation_point;
71730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	struct sctp_paddrinfo	sstat_primary;
71830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
71930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
72030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
72130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * 7.2.3.  Get the list of chunks the peer requires to be authenticated
72230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *         (SCTP_PEER_AUTH_CHUNKS)
72330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
72430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * This option gets a list of chunks for a specified association that
72530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * the peer requires to be received authenticated only.
72630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
72730692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sctp_authchunks {
72830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	sctp_assoc_t	gauth_assoc_id;
72930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32		gauth_number_of_chunks;
73030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	uint8_t		gauth_chunks[];
73130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
73230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
73330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/* The broken spelling has been released already in lksctp-tools header,
73430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * so don't break anyone, now that it's fixed.
73530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
73630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define guth_number_of_chunks	gauth_number_of_chunks
73730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
73830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/* Association states.  */
73930692c65c4174412c90e79489e98ab85c1a7412fBen Chengenum sctp_sstat_state {
74030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_EMPTY                = 0,
74130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_CLOSED               = 1,
74230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_COOKIE_WAIT          = 2,
74330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_COOKIE_ECHOED        = 3,
74430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_ESTABLISHED          = 4,
74530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_SHUTDOWN_PENDING     = 5,
74630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_SHUTDOWN_SENT        = 6,
74730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_SHUTDOWN_RECEIVED    = 7,
74830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	SCTP_SHUTDOWN_ACK_SENT    = 8,
74930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
75030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
75130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
75230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * 8.2.6. Get the Current Identifiers of Associations
75330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *        (SCTP_GET_ASSOC_ID_LIST)
75430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
75530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * This option gets the current list of SCTP association identifiers of
75630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * the SCTP associations handled by a one-to-many style socket.
75730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
75830692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sctp_assoc_ids {
75930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32		gaids_number_of_ids;
76030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	sctp_assoc_t	gaids_assoc_id[];
76130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
76230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
76330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
76430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * 8.3, 8.5 get all peer/local addresses in an association.
76530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * This parameter struct is used by SCTP_GET_PEER_ADDRS and
76630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * SCTP_GET_LOCAL_ADDRS socket options used internally to implement
76730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * sctp_getpaddrs() and sctp_getladdrs() API.
76830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
76930692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sctp_getaddrs_old {
77030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	sctp_assoc_t            assoc_id;
77130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	int			addr_num;
77230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#ifdef __KERNEL__
77330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	struct sockaddr		__user *addrs;
77430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#else
77530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	struct sockaddr		*addrs;
77630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#endif
77730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
77830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
77930692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sctp_getaddrs {
78030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	sctp_assoc_t		assoc_id; /*input*/
78130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u32			addr_num; /*output*/
78230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u8			addrs[0]; /*output, variable size*/
78330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
78430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
78530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/* A socket user request obtained via SCTP_GET_ASSOC_STATS that retrieves
78630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * association stats. All stats are counts except sas_maxrto and
78730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * sas_obs_rto_ipaddr. maxrto is the max observed rto + transport since
78830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * the last call. Will return 0 when RTO was not update since last call
78930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
79030692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sctp_assoc_stats {
79130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	sctp_assoc_t	sas_assoc_id;    /* Input */
79230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng					 /* Transport of observed max RTO */
79330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	struct sockaddr_storage sas_obs_rto_ipaddr;
79430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u64		sas_maxrto;      /* Maximum Observed RTO for period */
79530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u64		sas_isacks;	 /* SACKs received */
79630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u64		sas_osacks;	 /* SACKs sent */
79730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u64		sas_opackets;	 /* Packets sent */
79830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u64		sas_ipackets;	 /* Packets received */
79930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u64		sas_rtxchunks;   /* Retransmitted Chunks */
80030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u64		sas_outofseqtsns;/* TSN received > next expected */
80130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u64		sas_idupchunks;  /* Dups received (ordered+unordered) */
80230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u64		sas_gapcnt;      /* Gap Acknowledgements Received */
80330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u64		sas_ouodchunks;  /* Unordered data chunks sent */
80430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u64		sas_iuodchunks;  /* Unordered data chunks received */
80530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u64		sas_oodchunks;	 /* Ordered data chunks sent */
80630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u64		sas_iodchunks;	 /* Ordered data chunks received */
80730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u64		sas_octrlchunks; /* Control chunks sent */
80830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u64		sas_ictrlchunks; /* Control chunks received */
80930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
81030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
81130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/* These are bit fields for msghdr->msg_flags.  See section 5.1.  */
81230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/* On user space Linux, these live in <bits/socket.h> as an enum.  */
81330692c65c4174412c90e79489e98ab85c1a7412fBen Chengenum sctp_msg_flags {
81430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	MSG_NOTIFICATION = 0x8000,
81530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define MSG_NOTIFICATION MSG_NOTIFICATION
81630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
81730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
81830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
81930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * 8.1 sctp_bindx()
82030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *
82130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * The flags parameter is formed from the bitwise OR of zero or more of the
82230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * following currently defined flags:
82330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
82430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_BINDX_ADD_ADDR 0x01
82530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#define SCTP_BINDX_REM_ADDR 0x02
82630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
82730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/* This is the structure that is passed as an argument(optval) to
82830692c65c4174412c90e79489e98ab85c1a7412fBen Cheng * getsockopt(SCTP_SOCKOPT_PEELOFF).
82930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
83030692c65c4174412c90e79489e98ab85c1a7412fBen Chengtypedef struct {
83130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	sctp_assoc_t associd;
83230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	int sd;
83330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng} sctp_peeloff_arg_t;
83430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
83530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng/*
83630692c65c4174412c90e79489e98ab85c1a7412fBen Cheng *  Peer Address Thresholds socket option
83730692c65c4174412c90e79489e98ab85c1a7412fBen Cheng */
83830692c65c4174412c90e79489e98ab85c1a7412fBen Chengstruct sctp_paddrthlds {
83930692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	sctp_assoc_t spt_assoc_id;
84030692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	struct sockaddr_storage spt_address;
84130692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 spt_pathmaxrxt;
84230692c65c4174412c90e79489e98ab85c1a7412fBen Cheng	__u16 spt_pathpfthld;
84330692c65c4174412c90e79489e98ab85c1a7412fBen Cheng};
84430692c65c4174412c90e79489e98ab85c1a7412fBen Cheng
84530692c65c4174412c90e79489e98ab85c1a7412fBen Cheng#endif /* _UAPI_SCTP_H */
846