|
|
1.1 root 1: /*
2: * socket emulation; actually structures for translating
3: * between streams and tcp control blocks.
4: * note that these sockets typically also take the place of
5: * the 4.2BSD internet control blocks.
6: */
7:
8: struct socket{
9: struct tcpcb *so_tcpcb;
10: struct queue *so_rq;
11: struct queue *so_wq;
12: int so_rcount;
13: int so_wcount; /* because q->count is inaccurate */
14: struct socket *so_head; /* parent who listened */
15: int so_dev;
16: int so_state;
17: int so_options;
18: in_addr so_laddr;
19: in_addr so_faddr;
20: tcp_port so_lport;
21: tcp_port so_fport;
22: int so_oobmark;
23: int so_delimcnt; /* to detect logical eof */
24: };
25:
26: #define SO_DONTROUTE 0x1
27: #define SO_KEEPALIVE 0x2
28: #define SO_ACCEPTCONN 0x4 /* this is real */
29:
30: #define SS_OPEN 0x1 /* by user */
31: #define SS_PLEASEOPEN 0x2 /* waiting for user open */
32: #define SS_RCVATMARK 0x4 /* some kind of OOB */
33: #define SS_WAITING 0x8 /* wait for user control */
34: #define SS_ACTIVE 0x10 /* has tcp action */
35: #define SS_HANGUP 0x20 /* HANGUP on TH_FIN */
36: #define SS_HUNGUP 0x40 /* socket has been hung up (avoid multiple) */
37: #define SS_WCLOSED 0x80 /* write side is closed */
38:
39: #define socantsendmore(so) (so->so_delimcnt>1 || so->so_state&SS_WCLOSED)
40: #define sbrcvspace(so) (so->so_rq ?\
41: (sorcvhiwat(so) - so->so_rcount)\
42: : 0)
43: #define sosndcc(so) (so->so_wq ? (so->so_wcount) : 0)
44: #define sototcpcb(so) (so->so_tcpcb)
45: #define sorcvhiwat(so) (so->so_rq ? (so->so_rq->qinfo->limit)\
46: : 0)
47: #define sohasoutofband(so)
48:
49: #ifdef KERNEL
50: extern struct socket *so_lookup();
51: extern struct socket *sonewconn();
52: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.