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

📄 sctp.h

📁 SCTP 协议实现源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
 *   message this notification will be used to indicate *   various events. */struct sctp_pdapi_event {	__u16 pdapi_type;	__u16 pdapi_flags;	__u32 pdapi_length;	__u32 pdapi_indication;	sctp_assoc_t pdapi_assoc_id;};enum { SCTP_PARTIAL_DELIVERY_ABORTED=0, };/* * Described in Section 7.3 *   Ancillary Data and Notification Interest Options */struct sctp_event_subscribe {	__u8 sctp_data_io_event;	__u8 sctp_association_event;	__u8 sctp_address_event;	__u8 sctp_send_failure_event;	__u8 sctp_peer_error_event;	__u8 sctp_shutdown_event;	__u8 sctp_partial_delivery_event;	__u8 sctp_adaptation_layer_event;};/* * 5.3.1 SCTP Notification Structure * *   The notification structure is defined as the union of all *   notification types. * */union sctp_notification {	struct {		__u16 sn_type;             /* Notification type. */		__u16 sn_flags;		__u32 sn_length;	} sn_header;	struct sctp_assoc_change sn_assoc_change;	struct sctp_paddr_change sn_paddr_change;	struct sctp_remote_error sn_remote_error;	struct sctp_send_failed sn_send_failed;	struct sctp_shutdown_event sn_shutdown_event;	struct sctp_adaptation_event sn_adaptation_event;	struct sctp_pdapi_event sn_pdapi_event;};/* Section 5.3.1 * All standard values for sn_type flags are greater than 2^15. * Values from 2^15 and down are reserved. */enum sctp_sn_type {	SCTP_SN_TYPE_BASE     = (1<<15),	SCTP_ASSOC_CHANGE,	SCTP_PEER_ADDR_CHANGE,	SCTP_SEND_FAILED,	SCTP_REMOTE_ERROR,	SCTP_SHUTDOWN_EVENT,	SCTP_PARTIAL_DELIVERY_EVENT,	SCTP_ADAPTATION_INDICATION,};/* Notification error codes used to fill up the error fields in some * notifications. * SCTP_PEER_ADDRESS_CHAGE 	: spc_error * SCTP_ASSOC_CHANGE		: sac_error * These names should be potentially included in the draft 04 of the SCTP * sockets API specification. */typedef enum sctp_sn_error {	SCTP_FAILED_THRESHOLD,	SCTP_RECEIVED_SACK,	SCTP_HEARTBEAT_SUCCESS,	SCTP_RESPONSE_TO_USER_REQ,	SCTP_INTERNAL_ERROR,	SCTP_SHUTDOWN_GUARD_EXPIRES,	SCTP_PEER_FAULTY,} sctp_sn_error_t;/* * 7.1.1 Retransmission Timeout Parameters (SCTP_RTOINFO) * *   The protocol parameters used to initialize and bound retransmission *   timeout (RTO) are tunable.  See [SCTP] for more information on how *   these parameters are used in RTO calculation.  */struct sctp_rtoinfo {	sctp_assoc_t	srto_assoc_id;	__u32		srto_initial;	__u32		srto_max;	__u32		srto_min;};/* * 7.1.2 Association Parameters (SCTP_ASSOCINFO) * *   This option is used to both examine and set various association and *   endpoint parameters. */struct sctp_assocparams {	sctp_assoc_t	sasoc_assoc_id;	__u16		sasoc_asocmaxrxt;	__u16		sasoc_number_peer_destinations;	__u32		sasoc_peer_rwnd;	__u32		sasoc_local_rwnd;	__u32		sasoc_cookie_life;};/* * 7.1.9 Set Peer Primary Address (SCTP_SET_PEER_PRIMARY_ADDR) * *  Requests that the peer mark the enclosed address as the association *  primary. The enclosed address must be one of the association's *  locally bound addresses. The following structure is used to make a *   set primary request: */struct sctp_setpeerprim {	sctp_assoc_t            sspp_assoc_id;	struct sockaddr_storage sspp_addr;} __attribute__((packed, aligned(4)));/* * 7.1.10 Set Primary Address (SCTP_PRIMARY_ADDR) * *  Requests that the local SCTP stack use the enclosed peer address as *  the association primary. The enclosed address must be one of the *  association peer's addresses. The following structure is used to *  make a set peer primary request: */struct sctp_setprim {	sctp_assoc_t            ssp_assoc_id;	struct sockaddr_storage ssp_addr;} __attribute__((packed, aligned(4)));/* For backward compatibility use, define the old name too */#define sctp_prim sctp_setprim/* * 7.1.11 Set Adaptation Layer Indicator (SCTP_ADAPTATION_LAYER) * * Requests that the local endpoint set the specified Adaptation Layer * Indication parameter for all future INIT and INIT-ACK exchanges. */struct sctp_setadaptation {	__u32	ssb_adaptation_ind;};/* * 7.1.13 Peer Address Parameters  (SCTP_PEER_ADDR_PARAMS) * *   Applications can enable or disable heartbeats for any peer address *   of an association, modify an address's heartbeat interval, force a *   heartbeat to be sent immediately, and adjust the address's maximum *   number of retransmissions sent before an address is considered *   unreachable. The following structure is used to access and modify an *   address's parameters: */enum  sctp_spp_flags {	SPP_HB_ENABLE = 1<<0,		/*Enable heartbeats*/	SPP_HB_DISABLE = 1<<1,		/*Disable heartbeats*/	SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE,	SPP_HB_DEMAND = 1<<2,		/*Send heartbeat immediately*/	SPP_PMTUD_ENABLE = 1<<3,	/*Enable PMTU discovery*/	SPP_PMTUD_DISABLE = 1<<4,	/*Disable PMTU discovery*/	SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE,	SPP_SACKDELAY_ENABLE = 1<<5,	/*Enable SACK*/	SPP_SACKDELAY_DISABLE = 1<<6,	/*Disable SACK*/	SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE,	SPP_HB_TIME_IS_ZERO = 1<<7,	/* Set HB delay to 0 */};struct sctp_paddrparams {	sctp_assoc_t		spp_assoc_id;	struct sockaddr_storage	spp_address;	__u32			spp_hbinterval;	__u16			spp_pathmaxrxt;	__u32			spp_pathmtu;	__u32			spp_sackdelay;	__u32			spp_flags;} __attribute__((packed, aligned(4)));/* 7.1.24. Delayed Ack Timer (SCTP_DELAYED_ACK_TIME) * *   This options will get or set the delayed ack timer.  The time is set *   in milliseconds.  If the assoc_id is 0, then this sets or gets the *   endpoints default delayed ack timer value.  If the assoc_id field is *   non-zero, then the set or get effects the specified association. */struct sctp_assoc_value {    sctp_assoc_t            assoc_id;    uint32_t                assoc_value;};/* * 7.2.2 Peer Address Information * *   Applications can retrieve information about a specific peer address *   of an association, including its reachability state, congestion *   window, and retransmission timer values.  This information is *   read-only. The following structure is used to access this *   information: */struct sctp_paddrinfo {	sctp_assoc_t		spinfo_assoc_id;	struct sockaddr_storage	spinfo_address;	__s32			spinfo_state;	__u32			spinfo_cwnd;	__u32			spinfo_srtt;	__u32			spinfo_rto;	__u32			spinfo_mtu;} __attribute__((packed, aligned(4)));/* Peer addresses's state. */enum sctp_spinfo_state {	SCTP_INACTIVE,	SCTP_ACTIVE,	SCTP_UNCONFIRMED};/* * 7.2.1 Association Status (SCTP_STATUS) * *   Applications can retrieve current status information about an *   association, including association state, peer receiver window size, *   number of unacked data chunks, and number of data chunks pending *   receipt.  This information is read-only.  The following structure is *   used to access this information: */struct sctp_status {	sctp_assoc_t		sstat_assoc_id;	__s32			sstat_state;	__u32			sstat_rwnd;	__u16			sstat_unackdata;	__u16			sstat_penddata;	__u16			sstat_instrms;	__u16			sstat_outstrms;	__u32			sstat_fragmentation_point;	struct sctp_paddrinfo	sstat_primary;};/* Association states.  */enum sctp_sstat_state {	SCTP_EMPTY                = 0,	SCTP_CLOSED               = 1,	SCTP_COOKIE_WAIT          = 2,	SCTP_COOKIE_ECHOED        = 3,	SCTP_ESTABLISHED          = 4,	SCTP_SHUTDOWN_PENDING     = 5,	SCTP_SHUTDOWN_SENT        = 6,	SCTP_SHUTDOWN_RECEIVED    = 7,	SCTP_SHUTDOWN_ACK_SENT    = 8,};/* * 8.3, 8.5 get all peer/local addresses in an association. * This parameter struct is used by SCTP_GET_PEER_ADDRS and * SCTP_GET_LOCAL_ADDRS socket options used internally to implement * sctp_getpaddrs() and sctp_getladdrs() API.  */struct sctp_getaddrs_old {	sctp_assoc_t            assoc_id;	int			addr_num;	struct sockaddr		*addrs;};struct sctp_getaddrs {	sctp_assoc_t		assoc_id; /*input*/	__u32			addr_num; /*output*/	__u8			addrs[0]; /*output, variable size*/};/* These are bit fields for msghdr->msg_flags.  See section 5.1.  *//* On user space Linux, these live in <bits/socket.h> as an enum.  */enum sctp_msg_flags {	MSG_NOTIFICATION = 0x8000,#define MSG_NOTIFICATION MSG_NOTIFICATION};/* * 8.1 sctp_bindx() * * The flags parameter is formed from the bitwise OR of zero or more of the * following currently defined flags: */#define SCTP_BINDX_ADD_ADDR 0x01#define SCTP_BINDX_REM_ADDR 0x02/* This is the structure that is passed as an argument(optval) to * getsockopt(SCTP_SOCKOPT_PEELOFF). */typedef struct {	sctp_assoc_t associd;	int sd;} sctp_peeloff_arg_t;int sctp_bindx(int sd, struct sockaddr *addrs, int addrcnt, int flags);int sctp_connectx(int sd, struct sockaddr *addrs, int addrcnt);int sctp_peeloff(int sd, sctp_assoc_t assoc_id);/* Prototype for the library function sctp_opt_info defined in * API 7. Socket Options. */int sctp_opt_info(int sd, sctp_assoc_t id, int opt, void *arg, socklen_t *size);/* Get all peer address on a socket.  This is a new SCTP API * described in the section 8.3 of the Sockets API Extensions for SCTP. * This is implemented using the getsockopt() interface. */int sctp_getpaddrs(int sd, sctp_assoc_t id, struct sockaddr **addrs);/* Frees all resources allocated by sctp_getpaddrs().  This is a new SCTP API * described in the section 8.4 of the Sockets API Extensions for SCTP. */int sctp_freepaddrs(struct sockaddr *addrs);/* Get all locally bound address on a socket.  This is a new SCTP API * described in the section 8.5 of the Sockets API Extensions for SCTP. * This is implemented using the getsockopt() interface. */int sctp_getladdrs(int sd, sctp_assoc_t id, struct sockaddr **addrs);/* Frees all resources allocated by sctp_getladdrs().  This is a new SCTP API * described in the section 8.6 of the Sockets API Extensions for SCTP. */int sctp_freeladdrs(struct sockaddr *addrs);/* This library function assists the user with the advanced features * of SCTP.  This is a new SCTP API described in the section 8.7 of the * Sockets API Extensions for SCTP. This is implemented using the * sendmsg() interface. */int sctp_sendmsg(int s, const void *msg, size_t len, struct sockaddr *to,		 socklen_t tolen, uint32_t ppid, uint32_t flags,		 uint16_t stream_no, uint32_t timetolive, uint32_t context);/* This library function assist the user with sending a message without * dealing directly with the CMSG header. */int sctp_send(int s, const void *msg, size_t len,              const struct sctp_sndrcvinfo *sinfo, int flags);/* This library function assists the user with the advanced features * of SCTP.  This is a new SCTP API described in the section 8.8 of the * Sockets API Extensions for SCTP. This is implemented using the * recvmsg() interface. */int sctp_recvmsg(int s, void *msg, size_t len, struct sockaddr *from,		 socklen_t *fromlen, struct sctp_sndrcvinfo *sinfo,		 int *msg_flags);/* Return the address length for an address family. */int sctp_getaddrlen(sa_family_t family);__END_DECLS#endif /* __linux_sctp_h__ */

⌨️ 快捷键说明

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