]>
git.proxmox.com Git - qemu.git/blob - slirp/slirp.h
6 // Uncomment the following line to enable SLIRP statistics printing in Qemu
10 #define STAT(expr) expr
12 #define STAT(expr) do { } while(0)
15 #include "config-host.h"
16 #include "slirp_config.h"
19 # include <inttypes.h>
21 typedef uint8_t u_int8_t
;
22 typedef uint16_t u_int16_t
;
23 typedef uint32_t u_int32_t
;
24 typedef uint64_t u_int64_t
;
25 typedef char *caddr_t
;
28 # include <winsock2.h>
29 # include <ws2tcpip.h>
30 # include <sys/timeb.h>
31 # include <iphlpapi.h>
33 # define EWOULDBLOCK WSAEWOULDBLOCK
34 # define EINPROGRESS WSAEINPROGRESS
35 # define ENOTCONN WSAENOTCONN
36 # define EHOSTUNREACH WSAEHOSTUNREACH
37 # define ENETUNREACH WSAENETUNREACH
38 # define ECONNREFUSED WSAECONNREFUSED
40 # define ioctlsocket ioctl
41 # define closesocket(s) close(s)
45 #include <sys/types.h>
46 #ifdef HAVE_SYS_BITYPES_H
47 # include <sys/bitypes.h>
54 typedef unsigned char u_int8_t
;
56 # if SIZEOF_SHORT == 2
57 typedef short int16_t;
58 typedef unsigned short u_int16_t
;
62 typedef unsigned int u_int16_t
;
64 #error Cannot find a type with sizeof() == 2
68 # if SIZEOF_SHORT == 4
69 typedef short int32_t;
70 typedef unsigned short u_int32_t
;
74 typedef unsigned int u_int32_t
;
76 #error Cannot find a type with sizeof() == 4
79 #endif /* NEED_TYPEDEFS */
93 #define memmove(x, y, z) bcopy(y, x, z)
96 #if TIME_WITH_SYS_TIME
97 # include <sys/time.h>
100 # ifdef HAVE_SYS_TIME_H
101 # include <sys/time.h>
110 # include <strings.h>
118 #ifndef NO_PROTOTYPES
125 #include <netinet/in.h>
126 #include <arpa/inet.h>
129 #ifdef GETTIMEOFDAY_ONE_ARG
130 #define gettimeofday(x, y) gettimeofday(x)
133 /* Systems lacking strdup() definition in <string.h>. */
135 char *strdup
_P((const char *));
138 /* Systems lacking malloc() definition in <stdlib.h>. */
139 #if defined(ultrix) || defined(hcx)
140 void *malloc
_P((size_t arg
));
141 void free
_P((void *ptr
));
144 #ifndef HAVE_INET_ATON
145 int inet_aton
_P((const char *cp
, struct in_addr
*ia
));
149 #ifndef NO_UNIX_SOCKETS
153 #ifdef HAVE_SYS_SIGNAL_H
154 # include <sys/signal.h>
157 #include <sys/socket.h>
160 #if defined(HAVE_SYS_IOCTL_H)
161 # include <sys/ioctl.h>
164 #ifdef HAVE_SYS_SELECT_H
165 # include <sys/select.h>
168 #ifdef HAVE_SYS_WAIT_H
169 # include <sys/wait.h>
172 #ifdef HAVE_SYS_FILIO_H
173 # include <sys/filio.h>
177 #include <ppp/slirppp.h>
186 #include <sys/stat.h>
188 /* Avoid conflicting with the libc insque() and remque(), which
189 have different prototypes. */
190 #define insque slirp_insque
191 #define remque slirp_remque
193 #ifdef HAVE_SYS_STROPTS_H
194 #include <sys/stropts.h>
201 #include "tcp_timer.h"
205 #include "icmp_var.h"
213 #include "ppp/pppd.h"
219 #include "libslirp.h"
222 #define NULL (void *)0
226 void if_start
_P((void));
228 void if_start
_P((struct ttys
*));
232 # define vsprintf vsprintf_len
233 # define sprintf sprintf_len
234 extern int vsprintf_len
_P((char *, const char *, va_list));
235 extern int sprintf_len
_P((char *, const char *, ...));
238 #ifdef DECLARE_SPRINTF
240 extern int vsprintf
_P((char *, const char *, va_list));
242 extern int vfprintf
_P((FILE *, const char *, va_list));
245 #ifndef HAVE_STRERROR
246 extern char *strerror
_P((int error
));
250 char *index
_P((const char *, int));
253 #ifndef HAVE_GETHOSTID
254 long gethostid
_P((void));
257 void lprint
_P((const char *, ...));
263 #define DEFAULT_BAUD 115200
265 #define SO_OPTIONS DO_KEEPALIVE
266 #define TCP_MAXIDLE (TCPTV_KEEPCNT * TCPTV_KEEPINTVL)
269 int cksum(struct mbuf
*m
, int len
);
272 void if_init
_P((void));
273 void if_output
_P((struct socket
*, struct mbuf
*));
276 void ip_init
_P((void));
277 void ip_input
_P((struct mbuf
*));
278 void ip_slowtimo
_P((void));
279 void ip_stripoptions
_P((register struct mbuf
*, struct mbuf
*));
282 int ip_output
_P((struct socket
*, struct mbuf
*));
285 void tcp_input
_P((register struct mbuf
*, int, struct socket
*));
286 int tcp_mss
_P((register struct tcpcb
*, u_int
));
289 int tcp_output
_P((register struct tcpcb
*));
290 void tcp_setpersist
_P((register struct tcpcb
*));
293 void tcp_init
_P((void));
294 void tcp_template
_P((struct tcpcb
*));
295 void tcp_respond
_P((struct tcpcb
*, register struct tcpiphdr
*, register struct mbuf
*, tcp_seq
, tcp_seq
, int));
296 struct tcpcb
* tcp_newtcpcb
_P((struct socket
*));
297 struct tcpcb
* tcp_close
_P((register struct tcpcb
*));
298 void tcp_sockclosed
_P((struct tcpcb
*));
299 int tcp_fconnect
_P((struct socket
*));
300 void tcp_connect
_P((struct socket
*));
301 int tcp_attach
_P((struct socket
*));
302 u_int8_t tcp_tos
_P((struct socket
*));
303 int tcp_emu
_P((struct socket
*, struct mbuf
*));
304 int tcp_ctl
_P((struct socket
*));
305 struct tcpcb
*tcp_drop(struct tcpcb
*tp
, int err
);
308 #define MIN_MRU MINMRU
309 #define MAX_MRU MAXMRU
312 #define MAX_MRU 16384
316 #define min(x,y) ((x) < (y) ? (x) : (y))
317 #define max(x,y) ((x) > (y) ? (x) : (y))
322 #define errno (WSAGetLastError())