structs.h

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

H
1,965
字号
	size_t size;	/* The packet is destined for this transport address.	 * The function we finally use to pass down to the next lower	 * layer lives in the transport structure.	 */	struct sctp_transport *transport;	/* pointer to the auth chunk for this packet */	struct sctp_chunk *auth;	/* This packet contains a COOKIE-ECHO chunk. */	__u8 has_cookie_echo;	/* This packet contains a SACK chunk. */	__u8 has_sack;	/* This packet contains an AUTH chunk */	__u8 has_auth;	/* This packet contains at least 1 DATA chunk */	__u8 has_data;	/* SCTP cannot fragment this packet. So let ip fragment it. */	__u8 ipfragok;	__u8 malloced;};struct sctp_packet *sctp_packet_init(struct sctp_packet *,				     struct sctp_transport *,				     __u16 sport, __u16 dport);struct sctp_packet *sctp_packet_config(struct sctp_packet *, __u32 vtag, int);sctp_xmit_t sctp_packet_transmit_chunk(struct sctp_packet *,                                       struct sctp_chunk *);sctp_xmit_t sctp_packet_append_chunk(struct sctp_packet *,                                     struct sctp_chunk *);int sctp_packet_transmit(struct sctp_packet *);void sctp_packet_free(struct sctp_packet *);static inline int sctp_packet_empty(struct sctp_packet *packet){	return (packet->size == packet->overhead);}/* This represents a remote transport address. * For local transport addresses, we just use union sctp_addr. * * RFC2960 Section 1.4 Key Terms * *   o	Transport address:  A Transport Address is traditionally defined *	by Network Layer address, Transport Layer protocol and Transport *	Layer port number.  In the case of SCTP running over IP, a *	transport address is defined by the combination of an IP address *	and an SCTP port number (where SCTP is the Transport protocol). * * RFC2960 Section 7.1 SCTP Differences from TCP Congestion control * *   o	The sender keeps a separate congestion control parameter set for *	each of the destination addresses it can send to (not each *	source-destination pair but for each destination).  The parameters *	should decay if the address is not used for a long enough time *	period. * */struct sctp_transport {	/* A list of transports. */	struct list_head transports;	/* Reference counting. */	atomic_t refcnt;	int	 dead;	/* This is the peer's IP address and port. */	union sctp_addr ipaddr;	/* These are the functions we call to handle LLP stuff.	 */	struct sctp_af *af_specific;	/* Which association do we belong to?  */	struct sctp_association *asoc;	/* RFC2960	 *	 * 12.3 Per Transport Address Data	 *	 * For each destination transport address in the peer's	 * address list derived from the INIT or INIT ACK chunk, a	 * number of data elements needs to be maintained including:	 */	/* RTO	       : The current retransmission timeout value.  */	unsigned long rto;	unsigned long last_rto;	__u32 rtt;		/* This is the most recent RTT.	 */	/* RTTVAR      : The current RTT variation.  */	__u32 rttvar;	/* SRTT	       : The current smoothed round trip time.	*/	__u32 srtt;	/* RTO-Pending : A flag used to track if one of the DATA	 *		chunks sent to this address is currently being	 *		used to compute a RTT. If this flag is 0,	 *		the next DATA chunk sent to this destination	 *		should be used to compute a RTT and this flag	 *		should be set. Every time the RTT	 *		calculation completes (i.e. the DATA chunk	 *		is SACK'd) clear this flag.	 */	int rto_pending;	/*	 * These are the congestion stats.	 */	/* cwnd	       : The current congestion window.	 */	__u32 cwnd;		  /* This is the actual cwnd.  */	/* ssthresh    : The current slow start threshold value.  */	__u32 ssthresh;	/* partial     : The tracking method for increase of cwnd when in	 * bytes acked : congestion avoidance mode (see Section 6.2.2)	 */	__u32 partial_bytes_acked;	/* Data that has been sent, but not acknowledged. */	__u32 flight_size;	/* Destination */	struct dst_entry *dst;	/* Source address. */	union sctp_addr saddr;	/* When was the last time(in jiffies) that a data packet was sent on	 * this transport?  This is used to adjust the cwnd when the transport	 * becomes inactive.	 */	unsigned long last_time_used;	/* Heartbeat interval: The endpoint sends out a Heartbeat chunk to	 * the destination address every heartbeat interval.	 */	unsigned long hbinterval;	/* SACK delay timeout */	unsigned long sackdelay;	/* When was the last time (in jiffies) that we heard from this	 * transport?  We use this to pick new active and retran paths.	 */	unsigned long last_time_heard;	/* Last time(in jiffies) when cwnd is reduced due to the congestion	 * indication based on ECNE chunk.	 */	unsigned long last_time_ecne_reduced;	/* This is the max_retrans value for the transport and will	 * be initialized from the assocs value.  This can be changed	 * using SCTP_SET_PEER_ADDR_PARAMS socket option.	 */	__u16 pathmaxrxt;	/* is the Path MTU update pending on this tranport */	__u8 pmtu_pending;	/* PMTU	      : The current known path MTU.  */	__u32 pathmtu;	/* Flags controlling Heartbeat, SACK delay, and Path MTU Discovery. */	__u32 param_flags;	/* The number of times INIT has been sent on this transport. */	int init_sent_count;	/* state       : The current state of this destination,	 *             : i.e. SCTP_ACTIVE, SCTP_INACTIVE, SCTP_UNKOWN.	 */	int state;	/* These are the error stats for this destination.  */	/* Error count : The current error count for this destination.	*/	unsigned short error_count;	/* Per	       : A timer used by each destination.	 * Destination :	 * Timer       :	 *	 * [Everywhere else in the text this is called T3-rtx. -ed]	 */	struct timer_list T3_rtx_timer;	/* Heartbeat timer is per destination. */	struct timer_list hb_timer;	/* Since we're using per-destination retransmission timers	 * (see above), we're also using per-destination "transmitted"	 * queues.  This probably ought to be a private struct	 * accessible only within the outqueue, but it's not, yet.	 */	struct list_head transmitted;	/* We build bundle-able packets for this transport here.  */	struct sctp_packet packet;	/* This is the list of transports that have chunks to send.  */	struct list_head send_ready;	int malloced; /* Is this structure kfree()able? */	/* State information saved for SFR_CACC algorithm. The key	 * idea in SFR_CACC is to maintain state at the sender on a	 * per-destination basis when a changeover happens.	 *	char changeover_active;	 *	char cycling_changeover;	 *	__u32 next_tsn_at_change;	 *	char cacc_saw_newack;	 */	struct {		/* An unsigned integer, which stores the next TSN to be		 * used by the sender, at the moment of changeover.		 */		__u32 next_tsn_at_change;		/* A flag which indicates the occurrence of a changeover */		char changeover_active;		/* A flag which indicates whether the change of primary is		 * the first switch to this destination address during an		 * active switch.		 */		char cycling_changeover;		/* A temporary flag, which is used during the processing of		 * a SACK to estimate the causative TSN(s)'s group.		 */		char cacc_saw_newack;	} cacc;	/* 64-bit random number sent with heartbeat. */	__u64 hb_nonce;};struct sctp_transport *sctp_transport_new(const union sctp_addr *,					  gfp_t);void sctp_transport_set_owner(struct sctp_transport *,			      struct sctp_association *);void sctp_transport_route(struct sctp_transport *, union sctp_addr *,			  struct sctp_sock *);void sctp_transport_pmtu(struct sctp_transport *);void sctp_transport_free(struct sctp_transport *);void sctp_transport_reset_timers(struct sctp_transport *);void sctp_transport_hold(struct sctp_transport *);void sctp_transport_put(struct sctp_transport *);void sctp_transport_update_rto(struct sctp_transport *, __u32);void sctp_transport_raise_cwnd(struct sctp_transport *, __u32, __u32);void sctp_transport_lower_cwnd(struct sctp_transport *, sctp_lower_cwnd_t);unsigned long sctp_transport_timeout(struct sctp_transport *);void sctp_transport_reset(struct sctp_transport *);void sctp_transport_update_pmtu(struct sctp_transport *, u32);/* This is the structure we use to queue packets as they come into * SCTP.  We write packets to it and read chunks from it. */struct sctp_inq {	/* This is actually a queue of sctp_chunk each	 * containing a partially decoded packet.	 */	struct list_head in_chunk_list;	/* This is the packet which is currently off the in queue and is	 * being worked on through the inbound chunk processing.	 */	struct sctp_chunk *in_progress;	/* This is the delayed task to finish delivering inbound	 * messages.	 */	struct work_struct immediate;	int malloced;	     /* Is this structure kfree()able?	*/};void sctp_inq_init(struct sctp_inq *);void sctp_inq_free(struct sctp_inq *);void sctp_inq_push(struct sctp_inq *, struct sctp_chunk *packet);struct sctp_chunk *sctp_inq_pop(struct sctp_inq *);struct sctp_chunkhdr *sctp_inq_peek(struct sctp_inq *);void sctp_inq_set_th_handler(struct sctp_inq *, work_func_t);/* This is the structure we use to hold outbound chunks.  You push * chunks in and they automatically pop out the other end as bundled * packets (it calls (*output_handler)()). * * This structure covers sections 6.3, 6.4, 6.7, 6.8, 6.10, 7., 8.1, * and 8.2 of the v13 draft. * * It handles retransmissions.	The connection to the timeout portion * of the state machine is through sctp_..._timeout() and timeout_handler. * * If you feed it SACKs, it will eat them. * * If you give it big chunks, it will fragment them. * * It assigns TSN's to data chunks.  This happens at the last possible * instant before transmission. * * When free()'d, it empties itself out via output_handler(). */struct sctp_outq {	struct sctp_association *asoc;	/* Data pending that has never been transmitted.  */	struct list_head out_chunk_list;	unsigned out_qlen;	/* Total length of queued data chunks. */	/* Error of send failed, may used in SCTP_SEND_FAILED event. */	unsigned error;	/* These are control chunks we want to send.  */	struct list_head control_chunk_list;	/* These are chunks that have been sacked but are above the	 * CTSN, or cumulative tsn ack point.	 */	struct list_head sacked;	/* Put chunks on this list to schedule them for	 * retransmission.	 */	struct list_head retransmit;	/* Put chunks on this list to save them for FWD TSN processing as	 * they were abandoned.	 */	struct list_head abandoned;	/* How many unackd bytes do we have in-flight?	*/	__u32 outstanding_bytes;	/* Corked? */	char cork;	/* Is this structure empty?  */	char empty;	/* Are we kfree()able? */	char malloced;};void sctp_outq_init(struct sctp_association *, struct sctp_outq *);void sctp_outq_teardown(struct sctp_outq *);void sctp_outq_free(struct sctp_outq*);int sctp_outq_tail(struct sctp_outq *, struct sctp_chunk *chunk);int sctp_outq_flush(struct sctp_outq *, int);int sctp_outq_sack(struct sctp_outq *, struct sctp_sackhdr *);int sctp_outq_is_empty(const struct sctp_outq *);void sctp_outq_restart(struct sctp_outq *);void sctp_retransmit(struct sctp_outq *, struct sctp_transport *,		     sctp_retransmit_reason_t);void sctp_retransmit_mark(struct sctp_outq *, struct sctp_transport *, __u8);int sctp_outq_uncork(struct sctp_outq *);/* Uncork and flush an outqueue.  */static inline void sctp_outq_cork(struct sctp_outq *q){	q->cork = 1;}/* These bind address data fields common between endpoints and associations */struct sctp_bind_addr {	/* RFC 2960 12.1 Parameters necessary for the SCTP instance	 *	 * SCTP Port:	The local SCTP port number the endpoint is	 *		bound to.	 */	__u16 port;	/* RFC 2960 12.1 Parameters necessary for the SCTP instance	 *	 * Address List: The list of IP addresses that this instance	 *	has bound.  This information is passed to one's	 *	peer(s) in INIT and INIT ACK chunks.	 */	struct list_head address_list;	int malloced;	     /* Are we kfree()able?  */};

⌨️ 快捷键说明

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