xref: /minix3/minix/include/net/gen/tcp_hdr.h (revision 433d6423c39e34ec4b79c950597bb2d236f886be)
1*433d6423SLionel Sambuc /*
2*433d6423SLionel Sambuc server/ip/gen/tcp_hdr.h
3*433d6423SLionel Sambuc */
4*433d6423SLionel Sambuc 
5*433d6423SLionel Sambuc #ifndef __SERVER__IP__GEN__TCP_HDR_H__
6*433d6423SLionel Sambuc #define __SERVER__IP__GEN__TCP_HDR_H__
7*433d6423SLionel Sambuc 
8*433d6423SLionel Sambuc typedef struct tcp_hdr
9*433d6423SLionel Sambuc {
10*433d6423SLionel Sambuc 	tcpport_t th_srcport;
11*433d6423SLionel Sambuc 	tcpport_t th_dstport;
12*433d6423SLionel Sambuc 	u32_t th_seq_nr;
13*433d6423SLionel Sambuc 	u32_t th_ack_nr;
14*433d6423SLionel Sambuc 	u8_t th_data_off;
15*433d6423SLionel Sambuc 	u8_t th_flags;
16*433d6423SLionel Sambuc 	u16_t th_window;
17*433d6423SLionel Sambuc 	u16_t th_chksum;
18*433d6423SLionel Sambuc 	u16_t th_urgptr;
19*433d6423SLionel Sambuc } tcp_hdr_t;
20*433d6423SLionel Sambuc 
21*433d6423SLionel Sambuc #define TH_DO_MASK	0xf0
22*433d6423SLionel Sambuc 
23*433d6423SLionel Sambuc #define TH_FLAGS_MASK	0x3f
24*433d6423SLionel Sambuc #define THF_FIN		0x1
25*433d6423SLionel Sambuc #define THF_SYN		0x2
26*433d6423SLionel Sambuc #define THF_RST		0x4
27*433d6423SLionel Sambuc #define THF_PSH		0x8
28*433d6423SLionel Sambuc #define THF_ACK		0x10
29*433d6423SLionel Sambuc #define THF_URG		0x20
30*433d6423SLionel Sambuc 
31*433d6423SLionel Sambuc typedef struct tcp_hdropt
32*433d6423SLionel Sambuc {
33*433d6423SLionel Sambuc 	int tho_opt_siz;
34*433d6423SLionel Sambuc 	u8_t tho_data[TCP_MAX_HDR_SIZE-TCP_MIN_HDR_SIZE];
35*433d6423SLionel Sambuc } tcp_hdropt_t;
36*433d6423SLionel Sambuc 
37*433d6423SLionel Sambuc #define TCP_OPT_EOL	 0
38*433d6423SLionel Sambuc #define TCP_OPT_NOP	 1
39*433d6423SLionel Sambuc #define TCP_OPT_MSS	 2
40*433d6423SLionel Sambuc #define TCP_OPT_WSOPT	 3	/* RFC-1323, window scale option */
41*433d6423SLionel Sambuc #define TCP_OPT_SACKOK	 4	/* RFC-2018, SACK permitted */
42*433d6423SLionel Sambuc #define TCP_OPT_TS	 8	/* RFC-1323, Timestamps option */
43*433d6423SLionel Sambuc #define TCP_OPT_CCNEW	12	/* RFC-1644, new connection count */
44*433d6423SLionel Sambuc 
45*433d6423SLionel Sambuc #endif /* __SERVER__IP__GEN__TCP_HDR_H__ */
46*433d6423SLionel Sambuc 
47*433d6423SLionel Sambuc /*
48*433d6423SLionel Sambuc  * $PchId: tcp_hdr.h,v 1.4 2002/06/10 07:12:22 philip Exp $
49*433d6423SLionel Sambuc  */
50