|
|
1.1 root 1: /* tcp_var.h 6.1 83/07/29 */
2:
3: /*
4: * Kernel variables for tcp.
5: */
6:
7: /*
8: * Tcp control block, one per tcp; fields:
9: */
10: struct tcpcb {
11: struct tcpiphdr *seg_next; /* sequencing queue for tcpiphdr */
12: struct queue *so_rq;
13: struct queue *so_wq;
14: int so_rcount;
15: int so_wcount; /* because q->count is inaccurate */
16: struct tcpcb *so_head; /* parent who listened */
17: int so_dev;
18: int so_state;
19: int so_options;
20: in_addr so_laddr;
21: in_addr so_faddr;
22: tcp_port so_lport;
23: tcp_port so_fport;
24: int so_oobmark;
25: int so_delimcnt; /* to detect logical eof */
26: short t_state; /* state of this connection */
27: short t_timer[TCPT_NTIMERS]; /* tcp timers */
28: short t_rxtshift; /* log(2) of rexmt exp. backoff */
29: struct block *t_tcpopt; /* tcp options */
30: struct block *t_ipopt; /* ip options */
31: short t_maxseg; /* maximum segment size */
32: char t_force; /* 1 if forcing out a byte */
33: u_char t_flags;
34: #define TF_ACKNOW 0x01 /* ack peer immediately */
35: #define TF_DELACK 0x02 /* ack, but try to delay it */
36: #define TF_DONTKEEP 0x04 /* don't use keep-alives */
37: #define TF_NOOPT 0x08 /* don't use tcp options */
38: struct block *t_template; /* skeletal tcpiphdr - packet for transmit */
39: struct inpcb *t_inpcb; /* back pointer to internet pcb */
40: /*
41: * The following fields are used as in the protocol specification.
42: * See RFC783, Dec. 1981, page 21.
43: */
44: /* send sequence variables */
45: tcp_seq snd_una; /* send unacknowledged */
46: tcp_seq snd_nxt; /* send next */
47: tcp_seq snd_up; /* send urgent pointer */
48: tcp_seq snd_wl1; /* window update seg seq number */
49: tcp_seq snd_wl2; /* window update seg ack number */
50: tcp_seq iss; /* initial send sequence number */
51: u_short snd_wnd; /* send window */
52: /* receive sequence variables */
53: short rcv_wnd; /* receive window */
54: tcp_seq rcv_nxt; /* receive next */
55: tcp_seq rcv_up; /* receive urgent pointer */
56: tcp_seq irs; /* initial receive sequence number */
57: /*
58: * Additional variables for this implementation.
59: */
60: /* receive variables */
61: tcp_seq rcv_adv; /* advertised window */
62: /* retransmit variables */
63: tcp_seq snd_max; /* highest sequence number sent
64: used to recognize retransmits */
65: /* transmit timing stuff */
66: short t_idle; /* inactivity time */
67: short t_rtt; /* round trip time */
68: tcp_seq t_rtseq; /* sequence number being timed */
69: float t_srtt; /* smoothed round-trip time */
70: /* out-of-band data */
71: char t_oobflags; /* have some */
72: char t_iobc; /* input character */
73: #define TCPOOB_HAVEDATA 0x01
74: };
75:
76: struct tcpstat {
77: int tcps_badsum;
78: int tcps_badoff;
79: int tcps_hdrops;
80: int tcps_badsegs;
81: int tcps_unack;
82: int tcps_timeouts[4]; /* timeouts while ESTABLISHED */
83: int tcps_duplicates; /* other side retransmitting */
84: int tcps_delayed; /* packets out of sequence? */
85: };
86:
87: #define SO_DONTROUTE 0x1
88: #define SO_KEEPALIVE 0x2
89: #define SO_ACCEPTCONN 0x4 /* this is real */
90: #define SO_TRUSTED 0x8 /* use a trusted < 1024 port */
91:
92: #define SS_OPEN 0x1 /* by user */
93: #define SS_PLEASEOPEN 0x2 /* waiting for user open */
94: #define SS_RCVATMARK 0x4 /* some kind of OOB */
95: #define SS_WAITING 0x8 /* wait for user control */
96: #define SS_HANGUP 0x20 /* HANGUP on TH_FIN */
97: #define SS_HUNGUP 0x40 /* socket has been hung up (avoid multiple) */
98: #define SS_WCLOSED 0x80 /* write side is closed */
99:
100: #define socantsendmore(tp) (tp->so_delimcnt>1 || tp->so_state&SS_WCLOSED)
101: #define sbrcvspace(tp) (tp->so_rq ?\
102: (sorcvhiwat(tp) - tp->so_rcount)\
103: : 0)
104: #define sosndcc(tp) (tp->so_wq ? (tp->so_wcount) : 0)
105: #define sototcpcb(tp) (tp->so_tcpcb)
106: #define sorcvhiwat(tp) (tp->so_rq ? (tp->so_rq->qinfo->limit)\
107: : 0)
108: #define sohasoutofband(tp)
109:
110: #ifdef KERNEL
111: extern struct tcpcb *tcpcb_lookup();
112: extern struct tcpcb *tcp_newconn();
113: #endif
114: #ifdef KERNEL
115: struct tcpstat tcpstat; /* tcp statistics */
116: struct tcpcb *tcp_close(), *tcp_drop();
117: struct tcpcb *tcp_timers(), *tcp_disconnect(), *tcp_usrclosed();
118: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.