]>
git.proxmox.com Git - qemu.git/blob - slirp/slirp.h
12 #include "slirp_config.h"
15 # include <inttypes.h>
17 typedef uint8_t u_int8_t
;
18 typedef uint16_t u_int16_t
;
19 typedef uint32_t u_int32_t
;
20 typedef uint64_t u_int64_t
;
21 typedef char *caddr_t
;
23 # include <winsock2.h>
24 # include <sys/timeb.h>
25 # include <iphlpapi.h>
27 # define EWOULDBLOCK WSAEWOULDBLOCK
28 # define EINPROGRESS WSAEINPROGRESS
29 # define ENOTCONN WSAENOTCONN
30 # define EHOSTUNREACH WSAEHOSTUNREACH
31 # define ENETUNREACH WSAENETUNREACH
32 # define ECONNREFUSED WSAECONNREFUSED
34 # define ioctlsocket ioctl
35 # define closesocket(s) close(s)
39 #include <sys/types.h>
40 #ifdef HAVE_SYS_BITYPES_H
41 # include <sys/bitypes.h>
48 typedef unsigned char u_int8_t
;
50 # if SIZEOF_SHORT == 2
51 typedef short int16_t;
52 typedef unsigned short u_int16_t
;
56 typedef unsigned int u_int16_t
;
58 #error Cannot find a type with sizeof() == 2
62 # if SIZEOF_SHORT == 4
63 typedef short int32_t;
64 typedef unsigned short u_int32_t
;
68 typedef unsigned int u_int32_t
;
70 #error Cannot find a type with sizeof() == 4
73 #endif /* NEED_TYPEDEFS */
87 #define memmove(x, y, z) bcopy(y, x, z)
90 #if TIME_WITH_SYS_TIME
91 # include <sys/time.h>
95 # include <sys/time.h>
104 # include <strings.h>
112 #ifndef NO_PROTOTYPES
120 #include <netinet/in.h>
121 #include <arpa/inet.h>
124 #ifdef GETTIMEOFDAY_ONE_ARG
125 #define gettimeofday(x, y) gettimeofday(x)
128 /* Systems lacking strdup() definition in <string.h>. */
130 char *strdup
_P((const char *));
133 /* Systems lacking malloc() definition in <stdlib.h>. */
134 #if defined(ultrix) || defined(hcx)
135 void *malloc
_P((size_t arg
));
136 void free
_P((void *ptr
));
139 #ifndef HAVE_INET_ATON
140 int inet_aton
_P((const char *cp
, struct in_addr
*ia
));
144 #ifndef NO_UNIX_SOCKETS
148 #ifdef HAVE_SYS_SIGNAL_H
149 # include <sys/signal.h>
152 #include <sys/socket.h>
155 #if defined(HAVE_SYS_IOCTL_H)
156 # include <sys/ioctl.h>
159 #ifdef HAVE_SYS_SELECT_H
160 # include <sys/select.h>
163 #ifdef HAVE_SYS_WAIT_H
164 # include <sys/wait.h>
167 #ifdef HAVE_SYS_FILIO_H
168 # include <sys/filio.h>
172 #include <ppp/slirppp.h>
181 #include <sys/stat.h>
183 /* Avoid conflicting with the libc insque() and remque(), which
184 have different prototypes. */
185 #define insque slirp_insque
186 #define remque slirp_remque
188 #ifdef HAVE_SYS_STROPTS_H
189 #include <sys/stropts.h>
196 #include "tcp_timer.h"
200 #include "icmp_var.h"
209 #include "ppp/pppd.h"
215 #include "libslirp.h"
217 extern struct ttys
*ttys_unit
[MAX_INTERFACES
];
220 #define NULL (void *)0
224 void if_start
_P((void));
226 void if_start
_P((struct ttys
*));
230 # define vsprintf vsprintf_len
231 # define sprintf sprintf_len
232 extern int vsprintf_len
_P((char *, const char *, va_list));
233 extern int sprintf_len
_P((char *, const char *, ...));
236 #ifdef DECLARE_SPRINTF
238 extern int vsprintf
_P((char *, const char *, va_list));
240 extern int vfprintf
_P((FILE *, const char *, va_list));
243 #ifndef HAVE_STRERROR
244 extern char *strerror
_P((int error
));
248 char *index
_P((const char *, int));
251 #ifndef HAVE_GETHOSTID
252 long gethostid
_P((void));
255 void lprint
_P((const char *, ...));
259 #if SIZEOF_CHAR_P == 4
260 # define insque_32 insque
261 # define remque_32 remque
263 inline void insque_32
_P((void *, void *));
264 inline void remque_32
_P((void *));
271 #define DEFAULT_BAUD 115200
274 int cksum(struct mbuf
*m
, int len
);
277 void if_init
_P((void));
278 void if_output
_P((struct socket
*, struct mbuf
*));
281 void ip_init
_P((void));
282 void ip_input
_P((struct mbuf
*));
283 struct ip
* ip_reass
_P((register struct ipasfrag
*, register struct ipq
*));
284 void ip_freef
_P((struct ipq
*));
285 void ip_enq
_P((register struct ipasfrag
*, register struct ipasfrag
*));
286 void ip_deq
_P((register struct ipasfrag
*));
287 void ip_slowtimo
_P((void));
288 void ip_stripoptions
_P((register struct mbuf
*, struct mbuf
*));
291 int ip_output
_P((struct socket
*, struct mbuf
*));
294 int tcp_reass
_P((register struct tcpcb
*, register struct tcpiphdr
*, struct mbuf
*));
295 void tcp_input
_P((register struct mbuf
*, int, struct socket
*));
296 void tcp_dooptions
_P((struct tcpcb
*, u_char
*, int, struct tcpiphdr
*));
297 void tcp_xmit_timer
_P((register struct tcpcb
*, int));
298 int tcp_mss
_P((register struct tcpcb
*, u_int
));
301 int tcp_output
_P((register struct tcpcb
*));
302 void tcp_setpersist
_P((register struct tcpcb
*));
305 void tcp_init
_P((void));
306 void tcp_template
_P((struct tcpcb
*));
307 void tcp_respond
_P((struct tcpcb
*, register struct tcpiphdr
*, register struct mbuf
*, tcp_seq
, tcp_seq
, int));
308 struct tcpcb
* tcp_newtcpcb
_P((struct socket
*));
309 struct tcpcb
* tcp_close
_P((register struct tcpcb
*));
310 void tcp_drain
_P((void));
311 void tcp_sockclosed
_P((struct tcpcb
*));
312 int tcp_fconnect
_P((struct socket
*));
313 void tcp_connect
_P((struct socket
*));
314 int tcp_attach
_P((struct socket
*));
315 u_int8_t tcp_tos
_P((struct socket
*));
316 int tcp_emu
_P((struct socket
*, struct mbuf
*));
317 int tcp_ctl
_P((struct socket
*));
318 struct tcpcb
*tcp_drop(struct tcpcb
*tp
, int err
);
321 #define MIN_MRU MINMRU
322 #define MAX_MRU MAXMRU
325 #define MAX_MRU 16384
329 #define min(x,y) ((x) < (y) ? (x) : (y))
330 #define max(x,y) ((x) > (y) ? (x) : (y))
334 #define errno (WSAGetLastError())