constants.h

来自「linux 内核源代码」· C头文件 代码 · 共 468 行 · 第 1/2 页

H
468
字号
/* SCTP kernel reference Implementation * (C) Copyright IBM Corp. 2001, 2004 * Copyright (c) 1999-2000 Cisco, Inc. * Copyright (c) 1999-2001 Motorola, Inc. * Copyright (c) 2001 Intel Corp. * * This file is part of the SCTP kernel reference Implementation * * 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> *   Karl Knutson          <karl@athena.chicago.il.us> *   Randall Stewart       <randall@stewart.chicago.il.us> *   Ken Morneau           <kmorneau@cisco.com> *   Qiaobing Xie          <qxie1@motorola.com> *   Xingang Guo           <xingang.guo@intel.com> *   Sridhar Samudrala     <samudrala@us.ibm.com> *   Daisy Chang           <daisyc@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 __sctp_constants_h__#define __sctp_constants_h__#include <linux/sctp.h>#include <linux/ipv6.h> /* For ipv6hdr. */#include <net/sctp/user.h>#include <net/tcp_states.h>  /* For TCP states used in sctp_sock_state_t *//* Value used for stream negotiation. */enum { SCTP_MAX_STREAM = 0xffff };enum { SCTP_DEFAULT_OUTSTREAMS = 10 };enum { SCTP_DEFAULT_INSTREAMS = SCTP_MAX_STREAM };/* Since CIDs are sparse, we need all four of the following * symbols.  CIDs are dense through SCTP_CID_BASE_MAX. */#define SCTP_CID_BASE_MAX		SCTP_CID_SHUTDOWN_COMPLETE#define SCTP_CID_MAX			SCTP_CID_ASCONF_ACK#define SCTP_NUM_BASE_CHUNK_TYPES	(SCTP_CID_BASE_MAX + 1)#define SCTP_NUM_ADDIP_CHUNK_TYPES	2#define SCTP_NUM_PRSCTP_CHUNK_TYPES	1#define SCTP_NUM_AUTH_CHUNK_TYPES	1#define SCTP_NUM_CHUNK_TYPES		(SCTP_NUM_BASE_CHUNK_TYPES + \					 SCTP_NUM_ADDIP_CHUNK_TYPES +\					 SCTP_NUM_PRSCTP_CHUNK_TYPES +\					 SCTP_NUM_AUTH_CHUNK_TYPES)/* These are the different flavours of event.  */typedef enum {	SCTP_EVENT_T_CHUNK = 1,	SCTP_EVENT_T_TIMEOUT,	SCTP_EVENT_T_OTHER,	SCTP_EVENT_T_PRIMITIVE} sctp_event_t;#define SCTP_EVENT_T_MAX SCTP_EVENT_T_PRIMITIVE#define SCTP_EVENT_T_NUM (SCTP_EVENT_T_MAX + 1)/* As a convenience for the state machine, we append SCTP_EVENT_* and * SCTP_ULP_* to the list of possible chunks. */typedef enum {	SCTP_EVENT_TIMEOUT_NONE = 0,	SCTP_EVENT_TIMEOUT_T1_COOKIE,	SCTP_EVENT_TIMEOUT_T1_INIT,	SCTP_EVENT_TIMEOUT_T2_SHUTDOWN,	SCTP_EVENT_TIMEOUT_T3_RTX,	SCTP_EVENT_TIMEOUT_T4_RTO,	SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD,	SCTP_EVENT_TIMEOUT_HEARTBEAT,	SCTP_EVENT_TIMEOUT_SACK,	SCTP_EVENT_TIMEOUT_AUTOCLOSE,} sctp_event_timeout_t;#define SCTP_EVENT_TIMEOUT_MAX		SCTP_EVENT_TIMEOUT_AUTOCLOSE#define SCTP_NUM_TIMEOUT_TYPES		(SCTP_EVENT_TIMEOUT_MAX + 1)typedef enum {	SCTP_EVENT_NO_PENDING_TSN = 0,	SCTP_EVENT_ICMP_PROTO_UNREACH,} sctp_event_other_t;#define SCTP_EVENT_OTHER_MAX		SCTP_EVENT_ICMP_PROTO_UNREACH#define SCTP_NUM_OTHER_TYPES		(SCTP_EVENT_OTHER_MAX + 1)/* These are primitive requests from the ULP.  */typedef enum {	SCTP_PRIMITIVE_ASSOCIATE = 0,	SCTP_PRIMITIVE_SHUTDOWN,	SCTP_PRIMITIVE_ABORT,	SCTP_PRIMITIVE_SEND,	SCTP_PRIMITIVE_REQUESTHEARTBEAT,	SCTP_PRIMITIVE_ASCONF,} sctp_event_primitive_t;#define SCTP_EVENT_PRIMITIVE_MAX	SCTP_PRIMITIVE_ASCONF#define SCTP_NUM_PRIMITIVE_TYPES	(SCTP_EVENT_PRIMITIVE_MAX + 1)/* We define here a utility type for manipulating subtypes. * The subtype constructors all work like this: * * 	sctp_subtype_t foo = SCTP_ST_CHUNK(SCTP_CID_INIT); */typedef union {	sctp_cid_t chunk;	sctp_event_timeout_t timeout;	sctp_event_other_t other;	sctp_event_primitive_t primitive;} sctp_subtype_t;#define SCTP_SUBTYPE_CONSTRUCTOR(_name, _type, _elt) \static inline sctp_subtype_t	\SCTP_ST_## _name (_type _arg)		\{ sctp_subtype_t _retval; _retval._elt = _arg; return _retval; }SCTP_SUBTYPE_CONSTRUCTOR(CHUNK,		sctp_cid_t,		chunk)SCTP_SUBTYPE_CONSTRUCTOR(TIMEOUT,	sctp_event_timeout_t,	timeout)SCTP_SUBTYPE_CONSTRUCTOR(OTHER,		sctp_event_other_t,	other)SCTP_SUBTYPE_CONSTRUCTOR(PRIMITIVE,	sctp_event_primitive_t,	primitive)#define sctp_chunk_is_control(a) (a->chunk_hdr->type != SCTP_CID_DATA)#define sctp_chunk_is_data(a) (a->chunk_hdr->type == SCTP_CID_DATA)/* Calculate the actual data size in a data chunk */#define SCTP_DATA_SNDSIZE(c) ((int)((unsigned long)(c->chunk_end)\		       		- (unsigned long)(c->chunk_hdr)\				- sizeof(sctp_data_chunk_t)))#define SCTP_MAX_ERROR_CAUSE  SCTP_ERROR_NONEXIST_IP#define SCTP_NUM_ERROR_CAUSE  10/* Internal error codes */typedef enum {	SCTP_IERROR_NO_ERROR	        = 0,	SCTP_IERROR_BASE		= 1000,	SCTP_IERROR_NO_COOKIE,	SCTP_IERROR_BAD_SIG,	SCTP_IERROR_STALE_COOKIE,	SCTP_IERROR_NOMEM,	SCTP_IERROR_MALFORMED,	SCTP_IERROR_BAD_TAG,	SCTP_IERROR_BIG_GAP,	SCTP_IERROR_DUP_TSN,	SCTP_IERROR_HIGH_TSN,	SCTP_IERROR_IGNORE_TSN,	SCTP_IERROR_NO_DATA,	SCTP_IERROR_BAD_STREAM,	SCTP_IERROR_BAD_PORTS,	SCTP_IERROR_AUTH_BAD_HMAC,	SCTP_IERROR_AUTH_BAD_KEYID,	SCTP_IERROR_PROTO_VIOLATION,	SCTP_IERROR_ERROR,	SCTP_IERROR_ABORT,} sctp_ierror_t;/* SCTP state defines for internal state machine */typedef enum {	SCTP_STATE_EMPTY		= 0,	SCTP_STATE_CLOSED		= 1,	SCTP_STATE_COOKIE_WAIT		= 2,	SCTP_STATE_COOKIE_ECHOED	= 3,	SCTP_STATE_ESTABLISHED		= 4,	SCTP_STATE_SHUTDOWN_PENDING	= 5,	SCTP_STATE_SHUTDOWN_SENT	= 6,	SCTP_STATE_SHUTDOWN_RECEIVED	= 7,	SCTP_STATE_SHUTDOWN_ACK_SENT	= 8,} sctp_state_t;#define SCTP_STATE_MAX			SCTP_STATE_SHUTDOWN_ACK_SENT#define SCTP_STATE_NUM_STATES		(SCTP_STATE_MAX + 1)/* These are values for sk->state. * For a UDP-style SCTP socket, the states are defined as follows * - A socket in SCTP_SS_CLOSED state indicates that it is not willing to *   accept new associations, but it can initiate the creation of new ones. * - A socket in SCTP_SS_LISTENING state indicates that it is willing to *   accept new  associations and can initiate the creation of new ones. * - A socket in SCTP_SS_ESTABLISHED state indicates that it is a peeled off *   socket with one association. * For a TCP-style SCTP socket, the states are defined as follows * - A socket in SCTP_SS_CLOSED state indicates that it is not willing to *   accept new associations, but it can initiate the creation of new ones. * - A socket in SCTP_SS_LISTENING state indicates that it is willing to *   accept new associations, but cannot initiate the creation of new ones. * - A socket in SCTP_SS_ESTABLISHED state indicates that it has a single  *   association. */typedef enum {	SCTP_SS_CLOSED         = TCP_CLOSE,	SCTP_SS_LISTENING      = TCP_LISTEN,	SCTP_SS_ESTABLISHING   = TCP_SYN_SENT,	SCTP_SS_ESTABLISHED    = TCP_ESTABLISHED,	SCTP_SS_DISCONNECTING  = TCP_CLOSING,

⌨️ 快捷键说明

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