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 Slirp *slirp;
24
25
26 struct mbuf *so_m;
27
28
29 struct tcpiphdr *so_ti;
30
31 int so_urgc;
32 struct in_addr so_faddr;
33 struct in_addr so_laddr;
34 uint16_t so_fport;
35 uint16_t so_lport;
36
37 uint8_t so_iptos;
38 uint8_t so_emu;
39
40 u_char so_type;
41 int so_state;
42
43 struct tcpcb *so_tcpcb;
44 u_int so_expire;
45
46 int so_queued;
47 int so_nqueued;
48
49
50
51 struct sbuf so_rcv;
52 struct sbuf so_snd;
53 void * extra;
54};
55
56
57
58
59
60
61#define SS_NOFDREF 0x001
62
63#define SS_ISFCONNECTING 0x002
64#define SS_ISFCONNECTED 0x004
65#define SS_FCANTRCVMORE 0x008
66#define SS_FCANTSENDMORE 0x010
67#define SS_FWDRAIN 0x040
68
69#define SS_CTL 0x080
70#define SS_FACCEPTCONN 0x100
71#define SS_FACCEPTONCE 0x200
72
73#define SS_PERSISTENT_MASK 0xf000
74#define SS_HOSTFWD 0x1000
75#define SS_INCOMING 0x2000
76
77struct socket * solookup(struct socket *, struct in_addr, u_int, struct in_addr, u_int);
78struct socket * socreate(Slirp *);
79void sofree(struct socket *);
80int soread(struct socket *);
81void sorecvoob(struct socket *);
82int sosendoob(struct socket *);
83int sowrite(struct socket *);
84void sorecvfrom(struct socket *);
85int sosendto(struct socket *, struct mbuf *);
86struct socket * tcp_listen(Slirp *, uint32_t, u_int, uint32_t, u_int,
87 int);
88void soisfconnecting(register struct socket *);
89void soisfconnected(register struct socket *);
90void sofwdrain(struct socket *);
91struct iovec;
92size_t sopreprbuf(struct socket *so, struct iovec *iov, int *np);
93int soreadbuf(struct socket *so, const char *buf, int size);
94
95#endif
96