VirtualBox

source: vbox/trunk/src/VBox/Devices/Network/slirp/socket.h@ 15077

Last change on this file since 15077 was 14964, checked in by vboxsync, 16 years ago

slirp: code cosmetics for better readability (no semantics change)

  • Property svn:eol-style set to native
File size: 3.9 KB
Line 
1/*
2 * Copyright (c) 1995 Danny Gasparovski.
3 *
4 * Please read the file COPYRIGHT for the
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
20struct socket
21{
22 struct socket *so_next;
23 struct socket *so_prev; /* For a linked list of sockets */
24
25 int s; /* The actual socket */
26
27 /* XXX union these with not-yet-used sbuf params */
28 struct mbuf *so_m; /* Pointer to the original SYN packet,
29 * for non-blocking connect()'s, and
30 * PING reply's */
31 struct tcpiphdr *so_ti; /* Pointer to the original ti within
32 * so_mconn, for non-blocking connections */
33 int so_urgc;
34 struct in_addr so_faddr; /* foreign host table entry */
35 struct in_addr so_laddr; /* local host table entry */
36 u_int16_t so_fport; /* foreign port */
37 u_int16_t so_lport; /* local port */
38
39 u_int8_t so_iptos; /* Type of service */
40 u_int8_t so_emu; /* Is the socket emulated? */
41
42 u_char so_type; /* Type of socket, UDP or TCP */
43 int so_state; /* internal state flags SS_*, below */
44
45 struct tcpcb *so_tcpcb; /* pointer to TCP protocol control block */
46 u_int so_expire; /* When the socket will expire */
47
48 int so_queued; /* Number of packets queued from this socket */
49 int so_nqueued; /* Number of packets queued in a row
50 * Used to determine when to "downgrade" a session
51 * from fastq to batchq */
52
53 struct sbuf so_rcv; /* Receive buffer */
54 struct sbuf so_snd; /* Send buffer */
55};
56
57
58/*
59 * Socket state bits. (peer means the host on the Internet,
60 * local host means the host on the other end of the modem)
61 */
62#define SS_NOFDREF 0x001 /* No fd reference */
63
64#define SS_ISFCONNECTING 0x002 /* Socket is connecting to peer (non-blocking connect()'s) */
65#define SS_ISFCONNECTED 0x004 /* Socket is connected to peer */
66#define SS_FCANTRCVMORE 0x008 /* Socket can't receive more from peer (for half-closes) */
67#define SS_FCANTSENDMORE 0x010 /* Socket can't send more to peer (for half-closes) */
68/* #define SS_ISFDISCONNECTED 0x020*/ /* Socket has disconnected from peer, in 2MSL state */
69#define SS_FWDRAIN 0x040 /* We received a FIN, drain data and set SS_FCANTSENDMORE */
70
71/* #define SS_CTL 0x080 */
72#define SS_FACCEPTCONN 0x100 /* Socket is accepting connections from a host on the internet */
73#define SS_FACCEPTONCE 0x200 /* If set, the SS_FACCEPTCONN socket will die after one accept */
74
75extern struct socket tcb;
76
77#if defined(DECLARE_IOVEC) && !defined(HAVE_READV)
78struct iovec
79{
80 char *iov_base;
81 size_t iov_len;
82};
83#endif
84
85void so_init _P((void));
86struct socket * solookup _P((struct socket *, struct in_addr, u_int, struct in_addr, u_int));
87struct socket * socreate _P((void));
88void sofree _P((PNATState, struct socket *));
89int soread _P((PNATState, struct socket *));
90void sorecvoob _P((PNATState, struct socket *));
91int sosendoob _P((struct socket *));
92int sowrite _P((PNATState, struct socket *));
93void sorecvfrom _P((PNATState, struct socket *));
94int sosendto _P((PNATState, struct socket *, struct mbuf *));
95struct socket * solisten _P((PNATState, u_int, u_int32_t, u_int, int));
96void sorwakeup _P((struct socket *));
97void sowwakeup _P((struct socket *));
98void soisfconnecting _P((register struct socket *));
99void soisfconnected _P((register struct socket *));
100void sofcantrcvmore _P((struct socket *));
101void sofcantsendmore _P((struct socket *));
102void soisfdisconnected _P((struct socket *));
103void sofwdrain _P((struct socket *));
104
105#endif /* _SOCKET_H_ */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette