⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sctp.h

📁 SCTP 协议实现源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
/* SCTP kernel Implementation: User API extensions. * * sctp.h * * Distributed under the terms of the LGPL v2.1 as described in *    http://www.gnu.org/copyleft/lesser.txt  * * This file is part of the user library that offers support for the * Linux Kernel SCTP Implementation. The main purpose of this * code is to provide the SCTP Socket API mappings for user * application to interface with SCTP in kernel. * * This header represents the structures and constants needed to support * the SCTP Extension to the Sockets API. * * (C) Copyright IBM Corp. 2001, 2004 * Copyright (c) 1999-2000 Cisco, Inc. * Copyright (c) 1999-2001 Motorola, Inc. * * Written or modified by: *    La Monte H.P. Yarroll    <piggy@acm.org> *    R. Stewart               <randall@sctp.chicago.il.us> *    K. Morneau               <kmorneau@cisco.com> *    Q. Xie                   <qxie1@email.mot.com> *    Karl Knutson             <karl@athena.chicago.il.us> *    Jon Grimm                <jgrimm@austin.ibm.com> *    Daisy Chang              <daisyc@us.ibm.com> *    Inaky Perez-Gonzalez     <inaky.gonzalez@intel.com> *    Sridhar Samudrala        <sri@us.ibm.com> *    Vlad Yasevich		<vladislav.yasevich@hp.com> */#ifndef __linux_sctp_h__#define __linux_sctp_h__#include <stdint.h>#include <linux/types.h>#include <sys/socket.h>__BEGIN_DECLStypedef __s32 sctp_assoc_t;/* Socket option layer for SCTP */#ifndef SOL_SCTP#define SOL_SCTP	132#endif#ifndef IPPROTO_SCTP#define IPPROTO_SCTP    132#endif/* 9. Preprocessor constants */#define HAVE_SCTP#define HAVE_KERNEL_SCTP#define HAVE_SCTP_MULTIBUF#define HAVE_SCTP_NOCONNECT#define HAVE_SCTP_PRSCTP#define HAVE_SCTP_ADDIP#define HAVE_SCTP_CANSET_PRIMARY/* The following symbols come from the Sockets API Extensions for * SCTP <draft-ietf-tsvwg-sctpsocket-07.txt>. */enum sctp_optname {	SCTP_RTOINFO,#define SCTP_RTOINFO SCTP_RTOINFO	SCTP_ASSOCINFO,#define SCTP_ASSOCINFO SCTP_ASSOCINFO	SCTP_INITMSG,#define SCTP_INITMSG SCTP_INITMSG	SCTP_NODELAY, 	/* Get/set nodelay option. */#define SCTP_NODELAY	SCTP_NODELAY	SCTP_AUTOCLOSE,#define SCTP_AUTOCLOSE SCTP_AUTOCLOSE	SCTP_SET_PEER_PRIMARY_ADDR, #define SCTP_SET_PEER_PRIMARY_ADDR SCTP_SET_PEER_PRIMARY_ADDR	SCTP_PRIMARY_ADDR,#define SCTP_PRIMARY_ADDR SCTP_PRIMARY_ADDR	SCTP_ADAPTATION_LAYER,#define SCTP_ADAPTATION_LAYER SCTP_ADAPTATION_LAYER	SCTP_DISABLE_FRAGMENTS,#define SCTP_DISABLE_FRAGMENTS SCTP_DISABLE_FRAGMENTS	SCTP_PEER_ADDR_PARAMS,#define SCTP_PEER_ADDR_PARAMS SCTP_PEER_ADDR_PARAMS	SCTP_DEFAULT_SEND_PARAM,#define SCTP_DEFAULT_SEND_PARAM SCTP_DEFAULT_SEND_PARAM	SCTP_EVENTS,#define SCTP_EVENTS SCTP_EVENTS	SCTP_I_WANT_MAPPED_V4_ADDR,  /* Turn on/off mapped v4 addresses  */#define SCTP_I_WANT_MAPPED_V4_ADDR SCTP_I_WANT_MAPPED_V4_ADDR	SCTP_MAXSEG, 	/* Get/set maximum fragment. */#define SCTP_MAXSEG 	SCTP_MAXSEG	SCTP_STATUS,#define SCTP_STATUS SCTP_STATUS	SCTP_GET_PEER_ADDR_INFO,#define SCTP_GET_PEER_ADDR_INFO SCTP_GET_PEER_ADDR_INFO	SCTP_DELAYED_ACK_TIME,#define SCTP_DELAYED_ACK_TIME SCTP_DELAYED_ACK_TIME	SCTP_CONTEXT,	/* Receive Context */#define SCTP_CONTEXT SCTP_CONTEXT	SCTP_FRAGMENT_INTERLEAVE,#define SCTP_FRAGMENT_INTERLEAVE SCTP_FRAGMENT_INTERLEAVE	SCTP_PARTIAL_DELIVERY_POINT,	/* Set/Get partial delivery point */#define SCTP_PARTIAL_DELIVERY_POINT SCTP_PARTIAL_DELIVERY_POINT	SCTP_MAX_BURST,		/* Set/Get max burst */#define SCTP_MAX_BURST SCTP_MAX_BURST	/* Internal Socket Options. Some of the sctp library functions are 	 * implemented using these socket options.	 */	SCTP_SOCKOPT_BINDX_ADD = 100,/* BINDX requests for adding addresses. */#define SCTP_SOCKOPT_BINDX_ADD	SCTP_SOCKOPT_BINDX_ADD	SCTP_SOCKOPT_BINDX_REM, /* BINDX requests for removing addresses. */#define SCTP_SOCKOPT_BINDX_REM	SCTP_SOCKOPT_BINDX_REM	SCTP_SOCKOPT_PEELOFF, 	/* peel off association. */#define SCTP_SOCKOPT_PEELOFF	SCTP_SOCKOPT_PEELOFF	SCTP_GET_PEER_ADDRS_NUM_OLD, 	/* Get number of peer addresss. */#define SCTP_GET_PEER_ADDRS_NUM_OLD	SCTP_GET_PEER_ADDRS_NUM_OLD	SCTP_GET_PEER_ADDRS_OLD, 	/* Get all peer addresss. */#define SCTP_GET_PEER_ADDRS_OLD	SCTP_GET_PEER_ADDRS_OLD	SCTP_GET_LOCAL_ADDRS_NUM_OLD, 	/* Get number of local addresss. */#define SCTP_GET_LOCAL_ADDRS_NUM_OLD	SCTP_GET_LOCAL_ADDRS_NUM_OLD	SCTP_GET_LOCAL_ADDRS_OLD, 	/* Get all local addresss. */#define SCTP_GET_LOCAL_ADDRS_OLD	SCTP_GET_LOCAL_ADDRS_OLD	SCTP_SOCKOPT_CONNECTX, /* CONNECTX requests. */#define SCTP_SOCKOPT_CONNECTX	SCTP_SOCKOPT_CONNECTX	SCTP_GET_PEER_ADDRS, 	/* Get all peer addresss. */#define SCTP_GET_PEER_ADDRS	SCTP_GET_PEER_ADDRS	SCTP_GET_LOCAL_ADDRS, 	/* Get all local addresss. */#define SCTP_GET_LOCAL_ADDRS	SCTP_GET_LOCAL_ADDRS};/* * 5.2.1 SCTP Initiation Structure (SCTP_INIT) * *   This cmsghdr structure provides information for initializing new *   SCTP associations with sendmsg().  The SCTP_INITMSG socket option *   uses this same data structure.  This structure is not used for *   recvmsg(). * *   cmsg_level    cmsg_type      cmsg_data[] *   ------------  ------------   ---------------------- *   IPPROTO_SCTP  SCTP_INIT      struct sctp_initmsg * */struct sctp_initmsg {	__u16 sinit_num_ostreams;	__u16 sinit_max_instreams;	__u16 sinit_max_attempts;	__u16 sinit_max_init_timeo;};/* * 5.2.2 SCTP Header Information Structure (SCTP_SNDRCV) * *   This cmsghdr structure specifies SCTP options for sendmsg() and *   describes SCTP header information about a received message through *   recvmsg(). * *   cmsg_level    cmsg_type      cmsg_data[] *   ------------  ------------   ---------------------- *   IPPROTO_SCTP  SCTP_SNDRCV    struct sctp_sndrcvinfo * */struct sctp_sndrcvinfo {	__u16 sinfo_stream;	__u16 sinfo_ssn;	__u16 sinfo_flags;	__u32 sinfo_ppid;	__u32 sinfo_context;	__u32 sinfo_timetolive;	__u32 sinfo_tsn;	__u32 sinfo_cumtsn;	sctp_assoc_t sinfo_assoc_id;};/* *  sinfo_flags: 16 bits (unsigned integer) * *   This field may contain any of the following flags and is composed of *   a bitwise OR of these values. */enum sctp_sinfo_flags {	SCTP_UNORDERED = 1,  /* Send/receive message unordered. */	SCTP_ADDR_OVER = 2,  /* Override the primary destination. */	SCTP_ABORT=4,        /* Send an ABORT message to the peer. */	SCTP_EOF=MSG_FIN,    /* Initiate graceful shutdown process. */ };typedef union {	__u8   			raw;	struct sctp_initmsg	init;	struct sctp_sndrcvinfo	sndrcv;} sctp_cmsg_data_t;/* These are cmsg_types.  */typedef enum sctp_cmsg_type {	SCTP_INIT,              /* 5.2.1 SCTP Initiation Structure */#define SCTP_INIT SCTP_INIT	SCTP_SNDRCV,            /* 5.2.2 SCTP Header Information Structure */#define SCTP_SNDRCV SCTP_SNDRCV} sctp_cmsg_t;/* * 5.3.1.1 SCTP_ASSOC_CHANGE * *   Communication notifications inform the ULP that an SCTP association *   has either begun or ended. The identifier for a new association is *   provided by this notificaion. The notification information has the *   following format: * */struct sctp_assoc_change {	__u16 sac_type;	__u16 sac_flags;	__u32 sac_length;	__u16 sac_state;	__u16 sac_error;	__u16 sac_outbound_streams;	__u16 sac_inbound_streams;	sctp_assoc_t sac_assoc_id;	__u8 sac_info[0];};/* *   sac_state: 32 bits (signed integer) * *   This field holds one of a number of values that communicate the *   event that happened to the association.  They include: * *   Note:  The following state names deviate from the API draft as *   the names clash too easily with other kernel symbols. */enum sctp_sac_state {	SCTP_COMM_UP,	SCTP_COMM_LOST,	SCTP_RESTART,	SCTP_SHUTDOWN_COMP,	SCTP_CANT_STR_ASSOC,};/* * 5.3.1.2 SCTP_PEER_ADDR_CHANGE * *   When a destination address on a multi-homed peer encounters a change *   an interface details event is sent.  The information has the *   following structure: */struct sctp_paddr_change {	__u16 spc_type;	__u16 spc_flags;	__u32 spc_length;	struct sockaddr_storage spc_aaddr;	int spc_state;	int spc_error;	sctp_assoc_t spc_assoc_id;} __attribute__((packed, aligned(4)));/* *    spc_state:  32 bits (signed integer) * *   This field holds one of a number of values that communicate the *   event that happened to the address.  They include: */enum sctp_spc_state {	SCTP_ADDR_AVAILABLE,	SCTP_ADDR_UNREACHABLE,	SCTP_ADDR_REMOVED,	SCTP_ADDR_ADDED,	SCTP_ADDR_MADE_PRIM,	SCTP_ADDR_CONFIRMED,};/* * 5.3.1.3 SCTP_REMOTE_ERROR * *   A remote peer may send an Operational Error message to its peer. *   This message indicates a variety of error conditions on an *   association. The entire error TLV as it appears on the wire is *   included in a SCTP_REMOTE_ERROR event.  Please refer to the SCTP *   specification [SCTP] and any extensions for a list of possible *   error formats. SCTP error TLVs have the format: */struct sctp_remote_error {	__u16 sre_type;	__u16 sre_flags;	__u32 sre_length;	__u16 sre_error;	sctp_assoc_t sre_assoc_id;	__u8 sre_data[0];};/* * 5.3.1.4 SCTP_SEND_FAILED * *   If SCTP cannot deliver a message it may return the message as a *   notification. */struct sctp_send_failed {	__u16 ssf_type;	__u16 ssf_flags;	__u32 ssf_length;	__u32 ssf_error;	struct sctp_sndrcvinfo ssf_info;	sctp_assoc_t ssf_assoc_id;	__u8 ssf_data[0];};/* *   ssf_flags: 16 bits (unsigned integer) * *   The flag value will take one of the following values * *   SCTP_DATA_UNSENT  - Indicates that the data was never put on *                       the wire. * *   SCTP_DATA_SENT    - Indicates that the data was put on the wire. *                       Note that this does not necessarily mean that the *                       data was (or was not) successfully delivered. */enum sctp_ssf_flags {	SCTP_DATA_UNSENT,	SCTP_DATA_SENT,};/* * 5.3.1.5 SCTP_SHUTDOWN_EVENT * *   When a peer sends a SHUTDOWN, SCTP delivers this notification to *   inform the application that it should cease sending data. */struct sctp_shutdown_event {	__u16 sse_type;	__u16 sse_flags;	__u32 sse_length;	sctp_assoc_t sse_assoc_id;};/* * 5.3.1.6 SCTP_ADAPTATION_INDICATION * *   When a peer sends a Adaptation Layer Indication parameter , SCTP *   delivers this notification to inform the application *   that of the peers requested adaptation layer. */struct sctp_adaptation_event {	__u16 sai_type;	__u16 sai_flags;	__u32 sai_length;	__u32 sai_adaptation_ind;	sctp_assoc_t sai_assoc_id;};/* * 5.3.1.7 SCTP_PARTIAL_DELIVERY_EVENT * *   When a receiver is engaged in a partial delivery of a

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -