📄 user.h
字号:
/* SCTP kernel reference Implementation * (C) Copyright IBM Corp. 2001, 2004 * Copyright (c) 1999-2000 Cisco, Inc. * Copyright (c) 1999-2001 Motorola, Inc. * Copyright (c) 2002 Intel Corp. * * This file is part of the SCTP kernel reference Implementation * * This header represents the structures and constants needed to support * the SCTP Extension to the Sockets API. * * The SCTP reference implementation is free software; * you can redistribute it and/or modify it under the terms of * the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * The SCTP reference implementation is distributed in the hope that it * will be useful, but WITHOUT ANY WARRANTY; without even the implied * ************************ * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU CC; see the file COPYING. If not, write to * the Free Software Foundation, 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * * Please send any bug reports or fixes you make to the * email address(es): * lksctp developers <lksctp-developers@lists.sourceforge.net> * * Or submit a bug report through the following website: * http://www.sf.net/projects/lksctp * * 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@us.ibm.com> * Daisy Chang <daisyc@us.ibm.com> * Ryan Layer <rmlayer@us.ibm.com> * Ardelle Fan <ardelle.fan@intel.com> * Sridhar Samudrala <sri@us.ibm.com> * * Any bugs reported given to us we will try to fix... any fixes shared will * be incorporated into the next SCTP release. */#ifndef __net_sctp_user_h__#define __net_sctp_user_h__#include <linux/types.h>#include <linux/socket.h>typedef __s32 sctp_assoc_t;/* 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_ADAPTION_LAYER, #define SCTP_ADAPTION_LAYER SCTP_ADAPTION_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 /* 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 */ SCTP_SNDRCV, /* 5.2.2 SCTP Header Information Structure */} 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;};/* * 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,};/* * 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) *
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -