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

📄 structs.h

📁 h内核
💻 H
📖 第 1 页 / 共 4 页
字号:
/* What is the current SSN number for this stream? */static inline __u16 sctp_ssn_peek(struct sctp_stream *stream, __u16 id){	return stream->ssn[id];}/* Return the next SSN number for this stream.	*/static inline __u16 sctp_ssn_next(struct sctp_stream *stream, __u16 id){	return stream->ssn[id]++;}/* Skip over this ssn and all below. */static inline void sctp_ssn_skip(struct sctp_stream *stream, __u16 id, 				 __u16 ssn){	stream->ssn[id] = ssn+1;}              /* * Pointers to address related SCTP functions. * (i.e. things that depend on the address family.) */struct sctp_af {	int		(*sctp_xmit)	(struct sk_buff *skb,					 struct sctp_transport *,					 int ipfragok);	int		(*setsockopt)	(struct sock *sk,					 int level,					 int optname,					 char __user *optval,					 int optlen);	int		(*getsockopt)	(struct sock *sk,					 int level,					 int optname,					 char __user *optval,					 int __user *optlen);	struct dst_entry *(*get_dst)	(struct sctp_association *asoc,					 union sctp_addr *daddr,					 union sctp_addr *saddr);	void		(*get_saddr)	(struct sctp_association *asoc,					 struct dst_entry *dst,					 union sctp_addr *daddr,					 union sctp_addr *saddr);	void		(*copy_addrlist) (struct list_head *,					  struct net_device *);	void		(*dst_saddr)	(union sctp_addr *saddr,					 struct dst_entry *dst,					 unsigned short port);	int		(*cmp_addr)	(const union sctp_addr *addr1,					 const union sctp_addr *addr2);	void		(*addr_copy)	(union sctp_addr *dst,					 union sctp_addr *src);	void		(*from_skb)	(union sctp_addr *,					 struct sk_buff *skb,					 int saddr);	void		(*from_sk)	(union sctp_addr *,					 struct sock *sk);	void		(*to_sk_saddr)	(union sctp_addr *,					 struct sock *sk);	void		(*to_sk_daddr)	(union sctp_addr *,					 struct sock *sk);	void		(*from_addr_param) (union sctp_addr *,					    union sctp_addr_param *,					    __u16 port, int iif);		int		(*to_addr_param) (const union sctp_addr *,					  union sctp_addr_param *); 	int		(*addr_valid)	(union sctp_addr *,					 struct sctp_sock *);	sctp_scope_t	(*scope) (union sctp_addr *);	void		(*inaddr_any)	(union sctp_addr *, unsigned short);	int		(*is_any)	(const union sctp_addr *);	int		(*available)	(union sctp_addr *,					 struct sctp_sock *);	int		(*skb_iif)	(const struct sk_buff *sk);	int		(*is_ce)	(const struct sk_buff *sk);	void		(*seq_dump_addr)(struct seq_file *seq,					 union sctp_addr *addr);	__u16		net_header_len;	int		sockaddr_len;	sa_family_t	sa_family;	struct list_head list;};struct sctp_af *sctp_get_af_specific(sa_family_t);int sctp_register_af(struct sctp_af *);/* Protocol family functions. */struct sctp_pf {	void (*event_msgname)(struct sctp_ulpevent *, char *, int *);	void (*skb_msgname)  (struct sk_buff *, char *, int *);	int  (*af_supported) (sa_family_t, struct sctp_sock *);	int  (*cmp_addr) (const union sctp_addr *,			  const union sctp_addr *,			  struct sctp_sock *);	int  (*bind_verify) (struct sctp_sock *, union sctp_addr *);	int  (*send_verify) (struct sctp_sock *, union sctp_addr *);	int  (*supported_addrs)(const struct sctp_sock *, __u16 *);	struct sock *(*create_accept_sk) (struct sock *sk,					  struct sctp_association *asoc);	void (*addr_v4map) (struct sctp_sock *, union sctp_addr *);	struct sctp_af *af;};/* Structure to track chunk fragments that have been acked, but peer * fragments of the same message have not. */struct sctp_datamsg {	/* Chunks waiting to be submitted to lower layer. */	struct list_head chunks;	/* Chunks that have been transmitted. */	struct list_head track;	/* Reference counting. */	atomic_t refcnt;	/* When is this message no longer interesting to the peer? */	unsigned long expires_at;	/* Did the messenge fail to send? */	int send_error;	char send_failed;	/* Control whether chunks from this message can be abandoned. */	char can_abandon;};struct sctp_datamsg *sctp_datamsg_from_user(struct sctp_association *,					    struct sctp_sndrcvinfo *,					    struct msghdr *, int len);void sctp_datamsg_put(struct sctp_datamsg *);void sctp_datamsg_free(struct sctp_datamsg *);void sctp_datamsg_track(struct sctp_chunk *);void sctp_chunk_fail(struct sctp_chunk *, int error);int sctp_chunk_abandoned(struct sctp_chunk *);/* RFC2960 1.4 Key Terms * * o Chunk: A unit of information within an SCTP packet, consisting of * a chunk header and chunk-specific content. * * As a matter of convenience, we remember the SCTP common header for * each chunk as well as a few other header pointers... */struct sctp_chunk {	/* These first three elements MUST PRECISELY match the first	 * three elements of struct sk_buff.  This allows us to reuse	 * all the skb_* queue management functions.	 */	struct sctp_chunk *next;	struct sctp_chunk *prev;	struct sk_buff_head *list;	atomic_t refcnt;	/* This is our link to the per-transport transmitted list.  */	struct list_head transmitted_list;	/* This field is used by chunks that hold fragmented data.	 * For the first fragment this is the list that holds the rest of	 * fragments. For the remaining fragments, this is the link to the	 * frag_list maintained in the first fragment.	 */	struct list_head frag_list;	/* This points to the sk_buff containing the actual data.  */	struct sk_buff *skb;	/* These are the SCTP headers by reverse order in a packet.	 * Note that some of these may happen more than once.  In that	 * case, we point at the "current" one, whatever that means	 * for that level of header.	 */	/* We point this at the FIRST TLV parameter to chunk_hdr.  */	union sctp_params param_hdr;	union {		__u8 *v;		struct sctp_datahdr *data_hdr;		struct sctp_inithdr *init_hdr;		struct sctp_sackhdr *sack_hdr;		struct sctp_heartbeathdr *hb_hdr;		struct sctp_sender_hb_info *hbs_hdr;		struct sctp_shutdownhdr *shutdown_hdr;		struct sctp_signed_cookie *cookie_hdr;		struct sctp_ecnehdr *ecne_hdr;		struct sctp_cwrhdr *ecn_cwr_hdr;		struct sctp_errhdr *err_hdr;		struct sctp_addiphdr *addip_hdr;		struct sctp_fwdtsn_hdr *fwdtsn_hdr;	} subh;	__u8 *chunk_end;	struct sctp_chunkhdr *chunk_hdr;	struct sctphdr *sctp_hdr;	/* This needs to be recoverable for SCTP_SEND_FAILED events. */	struct sctp_sndrcvinfo sinfo;	/* Which association does this belong to?  */	struct sctp_association *asoc;	/* What endpoint received this chunk? */	struct sctp_ep_common *rcvr;	/* We fill this in if we are calculating RTT. */	unsigned long sent_at;	/* What is the origin IP address for this chunk?  */	union sctp_addr source;	/* Destination address for this chunk. */	union sctp_addr dest;	/* For outbound message, track all fragments for SEND_FAILED. */	struct sctp_datamsg *msg;	/* For an inbound chunk, this tells us where it came from.	 * For an outbound chunk, it tells us where we'd like it to	 * go.	It is NULL if we have no preference.	 */	struct sctp_transport *transport;	__u8 rtt_in_progress;	/* Is this chunk used for RTT calculation? */	__u8 resent;		/* Has this chunk ever been retransmitted. */	__u8 has_tsn;		/* Does this chunk have a TSN yet? */	__u8 has_ssn;		/* Does this chunk have a SSN yet? */	__u8 singleton;		/* Was this the only chunk in the packet? */	__u8 end_of_packet;	/* Was this the last chunk in the packet? */	__u8 ecn_ce_done;	/* Have we processed the ECN CE bit? */	__u8 pdiscard;		/* Discard the whole packet now? */	__u8 tsn_gap_acked;	/* Is this chunk acked by a GAP ACK? */	__u8 fast_retransmit;	 /* Is this chunk fast retransmitted? */	__u8 tsn_missing_report; /* Data chunk missing counter. */};void sctp_chunk_hold(struct sctp_chunk *);void sctp_chunk_put(struct sctp_chunk *);int sctp_user_addto_chunk(struct sctp_chunk *chunk, int off, int len,			  struct iovec *data);void sctp_chunk_free(struct sctp_chunk *);void  *sctp_addto_chunk(struct sctp_chunk *, int len, const void *data);struct sctp_chunk *sctp_chunkify(struct sk_buff *,				 const struct sctp_association *,				 struct sock *);void sctp_init_addrs(struct sctp_chunk *, union sctp_addr *,		     union sctp_addr *);const union sctp_addr *sctp_source(const struct sctp_chunk *chunk);/* This is a structure for holding either an IPv6 or an IPv4 address.  *//* sin_family -- AF_INET or AF_INET6 * sin_port -- ordinary port number * sin_addr -- cast to either (struct in_addr) or (struct in6_addr) */struct sctp_sockaddr_entry {	struct list_head list;	union sctp_addr a;};typedef struct sctp_chunk *(sctp_packet_phandler_t)(struct sctp_association *);/* This structure holds lists of chunks as we are assembling for * transmission. */struct sctp_packet {	/* These are the SCTP header values (host order) for the packet. */	__u16 source_port;	__u16 destination_port;	__u32 vtag;	/* This contains the payload chunks.  */	struct sk_buff_head chunks;	/* This is the overhead of the sctp and ip headers. */	size_t overhead;	/* This is the total size of all chunks INCLUDING padding.  */	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;	/* This packet contains a COOKIE-ECHO chunk. */	char has_cookie_echo;	/* This packet containsa SACK chunk. */	char has_sack;	/* SCTP cannot fragment this packet. So let ip fragment it. */	char ipfragok;	int 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:	 */	__u32 rtt;		/* This is the most recent RTT.	 */	/* RTO	       : The current retransmission timeout value.  */	__u32 rto;	/* 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;	/* PMTU	      : The current known path MTU.  */	__u32 pmtu;	/* 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.	 */	int hb_interval;	/* 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;	/* active      : The current active state of this destination,	 *	       :  i.e. DOWN, UP, etc.	 */	int active;	/* hb_allowed  : The current heartbeat state of this destination,	 *	       :  i.e. ALLOW-HB, NO-HEARTBEAT, etc.	 */	int hb_allowed;	/* These are the error stats for this destination.  */	/* Error count : The current error count for this destination.	*/	unsigned short error_count;	/* This is the max_retrans value for the transport and will	 * be initialized to proto.max_retrans.path.  This can be changed

⌨️ 快捷键说明

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