12 #include "slirp_config.h"
14 #include <sys/types.h>
15 #ifdef HAVE_SYS_BITYPES_H
16 # include <sys/bitypes.h>
21 typedef unsigned char u_int8_t
;
23 # if SIZEOF_SHORT == 2
24 typedef short int16_t;
25 typedef unsigned short u_int16_t
;
29 typedef unsigned int u_int16_t
;
31 #error Cannot find a type with sizeof() == 2
35 # if SIZEOF_SHORT == 4
36 typedef short int32_t;
37 typedef unsigned short u_int32_t
;
41 typedef unsigned int u_int32_t
;
43 #error Cannot find a type with sizeof() == 4
46 #endif /* NEED_TYPEDEFS */
60 #if TIME_WITH_SYS_TIME
61 # include <sys/time.h>
65 # include <sys/time.h>
80 /*#ifndef NO_PROTOTYPES*/
87 #include <netinet/in.h>
88 #include <arpa/inet.h>
90 #ifdef GETTIMEOFDAY_ONE_ARG
91 #define gettimeofday(x, y) gettimeofday(x)
94 /* Systems lacking strdup() definition in <string.h>. */
96 char *strdup
_P((const char *));
99 /* Systems lacking malloc() definition in <stdlib.h>. */
100 #if defined(ultrix) || defined(hcx)
101 void *malloc
_P((size_t arg
));
102 void free
_P((void *ptr
));
105 #ifndef HAVE_INET_ATON
106 int inet_aton
_P((const char *cp
, struct in_addr
*ia
));
110 #ifndef NO_UNIX_SOCKETS
114 #ifdef HAVE_SYS_SIGNAL_H
115 # include <sys/signal.h>
117 #include <sys/socket.h>
119 #if defined(WANT_SYS_IOCTL_H) && defined(HAVE_SYS_IOCTL_H)
120 # include <sys/ioctl.h>
122 # define WANT_SYS_TERMIOS_H
125 #ifdef WANT_SYS_TERMIOS_H
126 # ifndef INCLUDED_TERMIOS_H
127 # ifdef HAVE_TERMIOS_H
128 # include <termios.h>
132 # define INCLUDED_TERMIOS_H
138 #ifdef HAVE_SYS_SELECT_H
139 # include <sys/select.h>
142 #ifdef HAVE_SYS_WAIT_H
143 # include <sys/wait.h>
146 #ifdef HAVE_SYS_FILIO_H
147 # include <sys/filio.h>
151 #include <ppp/slirppp.h>
160 #include <sys/stat.h>
162 /* Avoid conflicting with the libc insque() and remque(), which
163 have different prototypes. */
164 #define insque slirp_insque
165 #define remque slirp_remque
167 #ifdef HAVE_SYS_STROPTS_H
168 #include <sys/stropts.h>
175 #include "tcp_timer.h"
179 #include "icmp_var.h"
188 #include <ppp/pppd.h>
193 #include "libslirp.h"
195 extern struct ttys
*ttys_unit
[MAX_INTERFACES
];
198 #define NULL (void *)0
202 void if_start
_P((void));
204 void if_start
_P((struct ttys
*));
208 # define vsprintf vsprintf_len
209 # define sprintf sprintf_len
210 extern int vsprintf_len
_P((char *, const char *, va_list));
211 extern int sprintf_len
_P((char *, const char *, ...));
214 #ifdef DECLARE_SPRINTF
216 extern int vsprintf
_P((char *, const char *, va_list));
218 extern int vfprintf
_P((FILE *, const char *, va_list));
221 #ifndef HAVE_STRERROR
222 extern char *strerror
_P((int error
));
226 char *index
_P((const char *, int));
229 #ifndef HAVE_GETHOSTID
230 long gethostid
_P((void));
233 void lprint
_P((const char *, ...));
237 #if SIZEOF_CHAR_P == 4
238 # define insque_32 insque
239 # define remque_32 remque
241 inline void insque_32
_P((void *, void *));
242 inline void remque_32
_P((void *));
248 #define DEFAULT_BAUD 115200
250 void client_eth_register(const unsigned char *eth_addr
, const unsigned char *ip_addr
);
253 int cksum(struct mbuf
*m
, int len
);
256 void if_init
_P((void));
257 void if_output
_P((struct socket
*, struct mbuf
*));
260 void ip_init
_P((void));
261 void ip_input
_P((struct mbuf
*));
262 struct ip
* ip_reass
_P((register struct ipasfrag
*, register struct ipq
*));
263 void ip_freef
_P((struct ipq
*));
264 void ip_enq
_P((register struct ipasfrag
*, register struct ipasfrag
*));
265 void ip_deq
_P((register struct ipasfrag
*));
266 void ip_slowtimo
_P((void));
267 void ip_stripoptions
_P((register struct mbuf
*, struct mbuf
*));
270 int ip_output
_P((struct socket
*, struct mbuf
*));
273 int tcp_reass
_P((register struct tcpcb
*, register struct tcpiphdr
*, struct mbuf
*));
274 void tcp_input
_P((register struct mbuf
*, int, struct socket
*));
275 void tcp_dooptions
_P((struct tcpcb
*, u_char
*, int, struct tcpiphdr
*));
276 void tcp_xmit_timer
_P((register struct tcpcb
*, int));
277 int tcp_mss
_P((register struct tcpcb
*, u_int
));
280 int tcp_output
_P((register struct tcpcb
*));
281 void tcp_setpersist
_P((register struct tcpcb
*));
284 void tcp_init
_P((void));
285 void tcp_template
_P((struct tcpcb
*));
286 void tcp_respond
_P((struct tcpcb
*, register struct tcpiphdr
*, register struct mbuf
*, tcp_seq
, tcp_seq
, int));
287 struct tcpcb
* tcp_newtcpcb
_P((struct socket
*));
288 struct tcpcb
* tcp_close
_P((register struct tcpcb
*));
289 void tcp_drain
_P((void));
290 void tcp_sockclosed
_P((struct tcpcb
*));
291 int tcp_fconnect
_P((struct socket
*));
292 void tcp_connect
_P((struct socket
*));
293 int tcp_attach
_P((struct socket
*));
294 u_int8_t tcp_tos
_P((struct socket
*));
295 int tcp_emu
_P((struct socket
*, struct mbuf
*));
296 int tcp_ctl
_P((struct socket
*));
297 struct tcpcb
*tcp_drop(struct tcpcb
*tp
, int err
);
300 #define MIN_MRU MINMRU
301 #define MAX_MRU MAXMRU
304 #define MAX_MRU 16384