|
|
1.1 root 1: /*
2: * Copyright (c) 1995 Danny Gasparovski.
1.1.1.2 ! root 3: *
! 4: * Please read the file COPYRIGHT for the
1.1 root 5: * terms and conditions of the copyright.
6: */
7:
8: /* MINE */
9:
10: #ifndef _SLIRP_SOCKET_H_
11: #define _SLIRP_SOCKET_H_
12:
13: #define SO_EXPIRE 240000
14: #define SO_EXPIREFAST 10000
15:
16: /*
17: * Our socket structure
18: */
19:
20: struct socket {
21: struct socket *so_next,*so_prev; /* For a linked list of sockets */
22:
23: int s; /* The actual socket */
24:
25: /* XXX union these with not-yet-used sbuf params */
26: struct mbuf *so_m; /* Pointer to the original SYN packet,
27: * for non-blocking connect()'s, and
28: * PING reply's */
29: struct tcpiphdr *so_ti; /* Pointer to the original ti within
30: * so_mconn, for non-blocking connections */
31: int so_urgc;
32: struct in_addr so_faddr; /* foreign host table entry */
33: struct in_addr so_laddr; /* local host table entry */
34: u_int16_t so_fport; /* foreign port */
35: u_int16_t so_lport; /* local port */
1.1.1.2 ! root 36:
1.1 root 37: u_int8_t so_iptos; /* Type of service */
38: u_int8_t so_emu; /* Is the socket emulated? */
1.1.1.2 ! root 39:
1.1 root 40: u_char so_type; /* Type of socket, UDP or TCP */
41: int so_state; /* internal state flags SS_*, below */
1.1.1.2 ! root 42:
1.1 root 43: struct tcpcb *so_tcpcb; /* pointer to TCP protocol control block */
44: u_int so_expire; /* When the socket will expire */
1.1.1.2 ! root 45:
1.1 root 46: int so_queued; /* Number of packets queued from this socket */
47: int so_nqueued; /* Number of packets queued in a row
48: * Used to determine when to "downgrade" a session
49: * from fastq to batchq */
1.1.1.2 ! root 50:
1.1 root 51: struct sbuf so_rcv; /* Receive buffer */
52: struct sbuf so_snd; /* Send buffer */
53: void * extra; /* Extra pointer */
54: };
55:
56:
57: /*
58: * Socket state bits. (peer means the host on the Internet,
59: * local host means the host on the other end of the modem)
60: */
61: #define SS_NOFDREF 0x001 /* No fd reference */
62:
63: #define SS_ISFCONNECTING 0x002 /* Socket is connecting to peer (non-blocking connect()'s) */
64: #define SS_ISFCONNECTED 0x004 /* Socket is connected to peer */
65: #define SS_FCANTRCVMORE 0x008 /* Socket can't receive more from peer (for half-closes) */
66: #define SS_FCANTSENDMORE 0x010 /* Socket can't send more to peer (for half-closes) */
67: /* #define SS_ISFDISCONNECTED 0x020*/ /* Socket has disconnected from peer, in 2MSL state */
68: #define SS_FWDRAIN 0x040 /* We received a FIN, drain data and set SS_FCANTSENDMORE */
69:
70: #define SS_CTL 0x080
71: #define SS_FACCEPTCONN 0x100 /* Socket is accepting connections from a host on the internet */
72: #define SS_FACCEPTONCE 0x200 /* If set, the SS_FACCEPTCONN socket will die after one accept */
73:
74: extern struct socket tcb;
75:
76:
77: #if defined(DECLARE_IOVEC) && !defined(HAVE_READV)
78: struct iovec {
79: char *iov_base;
80: size_t iov_len;
81: };
82: #endif
83:
84: struct socket * solookup _P((struct socket *, struct in_addr, u_int, struct in_addr, u_int));
85: struct socket * socreate _P((void));
86: void sofree _P((struct socket *));
87: int soread _P((struct socket *));
88: void sorecvoob _P((struct socket *));
89: int sosendoob _P((struct socket *));
90: int sowrite _P((struct socket *));
91: void sorecvfrom _P((struct socket *));
92: int sosendto _P((struct socket *, struct mbuf *));
93: struct socket * solisten _P((u_int, u_int32_t, u_int, int));
94: void soisfconnecting _P((register struct socket *));
95: void soisfconnected _P((register struct socket *));
96: void soisfdisconnected _P((struct socket *));
97: void sofwdrain _P((struct socket *));
98:
99: #endif /* _SOCKET_H_ */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.