1: /*
2: * Copyright (c) 1982, 1986 Regents of the University of California.
3: * All rights reserved.
4: *
5: * Redistribution and use in source and binary forms are permitted
6: * provided that this notice is preserved and that due credit is given
7: * to the University of California at Berkeley. The name of the University
8: * may not be used to endorse or promote products derived from this
9: * software without specific prior written permission. This software
10: * is provided ``as is'' without express or implied warranty.
11: *
12: * @(#)tcp.h 7.4.1.1 (Berkeley) 2/7/88
13: */
14: #ifndef BYTE_ORDER
15: /*
16: * Definitions for byte order,
17: * according to byte significance from low address to high.
18: */
19: #define LITTLE_ENDIAN 1234 /* least-significant byte first (vax) */
20: #define BIG_ENDIAN 4321 /* most-significant byte first (IBM, net) */
21: #define PDP_ENDIAN 3412 /* LSB first in word, MSW first in long (pdp) */
22:
23: #ifdef vax
24: #define BYTE_ORDER LITTLE_ENDIAN
25: #else
26: #ifdef pdp11
27: #define BYTE_ORDER PDP_ENDIAN
28: #else
29: #define BYTE_ORDER BIG_ENDIAN /* mc68000, tahoe, most others */
30: #endif
31: #endif
32: #endif BYTE_ORDER
33:
34: typedef u_long tcp_seq;
35: /*
36: * TCP header.
37: * Per RFC 793, September, 1981.
38: */
39: struct tcphdr {
40: u_short th_sport; /* source port */
41: u_short th_dport; /* destination port */
42: tcp_seq th_seq; /* sequence number */
43: tcp_seq th_ack; /* acknowledgement number */
44: #if BYTE_ORDER == LITTLE_ENDIAN
45: u_char th_x2:4, /* (unused) */
46: th_off:4; /* data offset */
47: #endif
48: #if BYTE_ORDER == BIG_ENDIAN
49: u_char th_off:4, /* data offset */
50: th_x2:4; /* (unused) */
51: #endif
52: #if BYTE_ORDER == PDP_ENDIAN
53: u_int th_x2:4, /* (unused) */
54: th_off:4; /* data offset */
55: #endif
56: u_char th_flags;
57: #define TH_FIN 0x01
58: #define TH_SYN 0x02
59: #define TH_RST 0x04
60: #define TH_PUSH 0x08
61: #define TH_ACK 0x10
62: #define TH_URG 0x20
63: u_short th_win; /* window */
64: u_short th_sum; /* checksum */
65: u_short th_urp; /* urgent pointer */
66: };
67:
68: #define TCPOPT_EOL 0
69: #define TCPOPT_NOP 1
70: #define TCPOPT_MAXSEG 2
71:
72: /*
73: * Default maximum segment size for TCP.
74: * With an IP MSS of 576, this is 536,
75: * but 512 is probably more convenient.
76: */
77: #ifdef lint
78: #define TCP_MSS 536
79: #else
80: #ifndef IP_MSS
81: #define IP_MSS 576
82: #endif
83: #define TCP_MSS MIN(512, IP_MSS - sizeof (struct tcpiphdr))
84: #endif
85:
86: /*
87: * User-settable options (used with setsockopt).
88: */
89: #define TCP_NODELAY 0x01 /* don't delay send to coalesce packets */
90: #define TCP_MAXSEG 0x02 /* set maximum segment size */
Defined struct's
tcphdr
defined in line
39; used 22 times
Defined macros
TH_ACK
defined in line
61; used 10 times
TH_FIN
defined in line
57; used 15 times
- in /usr/src/sys/netinet/tcp_input.c line
61,
158,
506,
533,
546,
552,
630,
1035,
1052,
1059
- in /usr/src/sys/netinet/tcp_output.c line
113,
122,
234,
251,
343
TH_RST
defined in line
59; used 10 times
TH_SYN
defined in line
58; used 12 times
Usage of this include