Commit | Line | Data |
---|---|---|
8ae0e4b4 | 1 | /* |
0880b18e | 2 | * Copyright (c) 1982, 1986 Regents of the University of California. |
8ae0e4b4 KM |
3 | * All rights reserved. The Berkeley software License Agreement |
4 | * specifies the terms and conditions for redistribution. | |
5 | * | |
0880b18e | 6 | * @(#)tcp_var.h 7.1 (Berkeley) %G% |
8ae0e4b4 | 7 | */ |
ad6d0022 BJ |
8 | |
9 | /* | |
10 | * Kernel variables for tcp. | |
11 | */ | |
12 | ||
13 | /* | |
405c9168 | 14 | * Tcp control block, one per tcp; fields: |
ad6d0022 | 15 | */ |
53a5409e | 16 | struct tcpcb { |
a6503abf BJ |
17 | struct tcpiphdr *seg_next; /* sequencing queue */ |
18 | struct tcpiphdr *seg_prev; | |
4aed14e3 | 19 | short t_state; /* state of this connection */ |
a41e26c7 | 20 | short t_timer[TCPT_NTIMERS]; /* tcp timers */ |
405c9168 | 21 | short t_rxtshift; /* log(2) of rexmt exp. backoff */ |
a41e26c7 | 22 | struct mbuf *t_tcpopt; /* tcp options */ |
faa26a98 | 23 | u_short t_maxseg; /* maximum segment size */ |
4aed14e3 | 24 | char t_force; /* 1 if forcing out a byte */ |
2ff61f9d | 25 | u_char t_flags; |
6f638424 MK |
26 | #define TF_ACKNOW 0x01 /* ack peer immediately */ |
27 | #define TF_DELACK 0x02 /* ack, but try to delay it */ | |
28 | #define TF_NODELAY 0x04 /* don't delay packets to coalesce */ | |
29 | #define TF_NOOPT 0x08 /* don't use tcp options */ | |
faa26a98 | 30 | #define TF_SENTFIN 0x10 /* have sent FIN */ |
2ff61f9d BJ |
31 | struct tcpiphdr *t_template; /* skeletal packet for transmit */ |
32 | struct inpcb *t_inpcb; /* back pointer to internet pcb */ | |
ad6d0022 | 33 | /* |
2ff61f9d BJ |
34 | * The following fields are used as in the protocol specification. |
35 | * See RFC783, Dec. 1981, page 21. | |
ad6d0022 | 36 | */ |
2ff61f9d BJ |
37 | /* send sequence variables */ |
38 | tcp_seq snd_una; /* send unacknowledged */ | |
39 | tcp_seq snd_nxt; /* send next */ | |
2ff61f9d BJ |
40 | tcp_seq snd_up; /* send urgent pointer */ |
41 | tcp_seq snd_wl1; /* window update seg seq number */ | |
42 | tcp_seq snd_wl2; /* window update seg ack number */ | |
43 | tcp_seq iss; /* initial send sequence number */ | |
4aed14e3 | 44 | u_short snd_wnd; /* send window */ |
2ff61f9d | 45 | /* receive sequence variables */ |
6f638424 | 46 | u_short rcv_wnd; /* receive window */ |
4aed14e3 | 47 | tcp_seq rcv_nxt; /* receive next */ |
2ff61f9d BJ |
48 | tcp_seq rcv_up; /* receive urgent pointer */ |
49 | tcp_seq irs; /* initial receive sequence number */ | |
ad6d0022 | 50 | /* |
2ff61f9d | 51 | * Additional variables for this implementation. |
ad6d0022 | 52 | */ |
2ff61f9d | 53 | /* receive variables */ |
a6503abf BJ |
54 | tcp_seq rcv_adv; /* advertised window */ |
55 | /* retransmit variables */ | |
a41e26c7 | 56 | tcp_seq snd_max; /* highest sequence number sent |
05586739 MK |
57 | * used to recognize retransmits |
58 | */ | |
59 | /* congestion control (for source quench) */ | |
60 | u_short snd_cwnd; /* congestion-controlled window */ | |
405c9168 BJ |
61 | /* transmit timing stuff */ |
62 | short t_idle; /* inactivity time */ | |
63 | short t_rtt; /* round trip time */ | |
22b0776e | 64 | u_short max_rcvd; /* most peer has sent into window */ |
405c9168 BJ |
65 | tcp_seq t_rtseq; /* sequence number being timed */ |
66 | float t_srtt; /* smoothed round-trip time */ | |
18a438b6 | 67 | u_short max_sndwnd; /* largest window peer has offered */ |
8b5a83bb BJ |
68 | /* out-of-band data */ |
69 | char t_oobflags; /* have some */ | |
b2db9217 | 70 | char t_iobc; /* input character */ |
8b5a83bb | 71 | #define TCPOOB_HAVEDATA 0x01 |
22b0776e | 72 | #define TCPOOB_HADDATA 0x02 |
2ff61f9d | 73 | }; |
ad6d0022 | 74 | |
2ff61f9d BJ |
75 | #define intotcpcb(ip) ((struct tcpcb *)(ip)->inp_ppcb) |
76 | #define sototcpcb(so) (intotcpcb(sotoinpcb(so))) | |
ad6d0022 | 77 | |
2b4b57cd BJ |
78 | struct tcpstat { |
79 | int tcps_badsum; | |
80 | int tcps_badoff; | |
81 | int tcps_hdrops; | |
82 | int tcps_badsegs; | |
83 | int tcps_unack; | |
84 | }; | |
85 | ||
ad6d0022 | 86 | #ifdef KERNEL |
2ff61f9d BJ |
87 | struct inpcb tcb; /* head of queue of active tcpcb's */ |
88 | struct tcpstat tcpstat; /* tcp statistics */ | |
53a5409e | 89 | struct tcpiphdr *tcp_template(); |
0e3936fa SL |
90 | struct tcpcb *tcp_close(), *tcp_drop(); |
91 | struct tcpcb *tcp_timers(), *tcp_disconnect(), *tcp_usrclosed(); | |
ad6d0022 | 92 | #endif |