1
2
3
4
5
6
7
8#ifndef _SLIRP_SOCKET_H_
9#define _SLIRP_SOCKET_H_
10
11#define SO_EXPIRE 240000
12#define SO_EXPIREFAST 10000
13
14
15
16
17
18struct socket {
19 struct socket *so_next,*so_prev;
20
21 int s;
22
23 int pollfds_idx;
24
25 Slirp *slirp;
26
27
28 struct mbuf *so_m;
29
30
31 struct tcpiphdr *so_ti;
32
33 int so_urgc;
34 struct in_addr so_faddr;
35 struct in_addr so_laddr;
36 uint16_t so_fport;
37 uint16_t so_lport;
38
39 uint8_t so_iptos;
40 uint8_t so_emu;
41
42 u_char so_type;
43 int so_state;
44
45 struct tcpcb *so_tcpcb;
46 u_int so_expire;
47
48 int so_queued;
49 int so_nqueued;
50
51
52
53 struct sbuf so_rcv;
54 struct sbuf so_snd;
55 void * extra;
56};
57
58
59
60
61
62
63#define SS_NOFDREF 0x001
64
65#define SS_ISFCONNECTING 0x002
66#define SS_ISFCONNECTED 0x004
67#define SS_FCANTRCVMORE 0x008
68#define SS_FCANTSENDMORE 0x010
69#define SS_FWDRAIN 0x040
70
71#define SS_CTL 0x080
72#define SS_FACCEPTCONN 0x100
73#define SS_FACCEPTONCE 0x200
74
75#define SS_PERSISTENT_MASK 0xf000
76#define SS_HOSTFWD 0x1000
77#define SS_INCOMING 0x2000
78
79struct socket * solookup(struct socket *, struct in_addr, u_int, struct in_addr, u_int);
80struct socket * socreate(Slirp *);
81void sofree(struct socket *);
82int soread(struct socket *);
83void sorecvoob(struct socket *);
84int sosendoob(struct socket *);
85int sowrite(struct socket *);
86void sorecvfrom(struct socket *);
87int sosendto(struct socket *, struct mbuf *);
88struct socket * tcp_listen(Slirp *, uint32_t, u_int, uint32_t, u_int,
89 int);
90void soisfconnecting(register struct socket *);
91void soisfconnected(register struct socket *);
92void sofwdrain(struct socket *);
93struct iovec;
94size_t sopreprbuf(struct socket *so, struct iovec *iov, int *np);
95int soreadbuf(struct socket *so, const char *buf, int size);
96
97#endif
98