VirtualBox

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

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

typo

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