12 #include "slirp_config.h"
14 #include <sys/types.h>
15 #ifdef HAVE_SYS_BITYPES_H
16 # include <sys/bitypes.h>
23 typedef unsigned char u_int8_t;
25 # if SIZEOF_SHORT == 2
26 typedef short int16_t;
27 typedef unsigned short u_int16_t;
31 typedef unsigned int u_int16_t;
33 #error Cannot find a type with sizeof() == 2
37 # if SIZEOF_SHORT == 4
38 typedef short int32_t;
39 typedef unsigned short u_int32_t;
43 typedef unsigned int u_int32_t;
45 #error Cannot find a type with sizeof() == 4
48 #endif /* NEED_TYPEDEFS */
62 #define memmove(x, y, z) bcopy(y, x, z)
65 #if TIME_WITH_SYS_TIME
66 # include <sys/time.h>
70 # include <sys/time.h>
92 #include <netinet/in.h>
93 #include <arpa/inet.h>
95 #ifdef GETTIMEOFDAY_ONE_ARG
96 #define gettimeofday(x, y) gettimeofday(x)
99 /* Systems lacking strdup() definition in <string.h>. */
101 char *strdup _P((const char *));
104 /* Systems lacking malloc() definition in <stdlib.h>. */
105 #if defined(ultrix) || defined(hcx)
106 void *malloc _P((size_t arg));
107 void free _P((void *ptr));
110 #ifndef HAVE_INET_ATON
111 int inet_aton _P((const char *cp, struct in_addr *ia));
115 #ifndef NO_UNIX_SOCKETS
119 #ifdef HAVE_SYS_SIGNAL_H
120 # include <sys/signal.h>
122 #include <sys/socket.h>
124 #if defined(WANT_SYS_IOCTL_H) && defined(HAVE_SYS_IOCTL_H)
125 # include <sys/ioctl.h>
127 # define WANT_SYS_TERMIOS_H
130 #ifdef WANT_SYS_TERMIOS_H
131 # ifndef INCLUDED_TERMIOS_H
132 # ifdef HAVE_TERMIOS_H
133 # include <termios.h>
137 # define INCLUDED_TERMIOS_H
143 #ifdef HAVE_SYS_SELECT_H
144 # include <sys/select.h>
147 #ifdef HAVE_SYS_WAIT_H
148 # include <sys/wait.h>
151 #ifdef HAVE_SYS_FILIO_H
152 # include <sys/filio.h>
156 #include <ppp/slirppp.h>
165 #include <sys/stat.h>
167 /* Avoid conflicting with the libc insque() and remque(), which
168 have different prototypes. */
169 #define insque slirp_insque
170 #define remque slirp_remque
172 #ifdef HAVE_SYS_STROPTS_H
173 #include <sys/stropts.h>
180 #include "tcp_timer.h"
184 #include "icmp_var.h"
193 #include "ppp/pppd.h"
198 #include "libslirp.h"
200 extern struct ttys *ttys_unit[MAX_INTERFACES];
203 #define NULL (void *)0
207 void if_start _P((void));
209 void if_start _P((struct ttys *));
213 # define vsprintf vsprintf_len
214 # define sprintf sprintf_len
215 extern int vsprintf_len _P((char *, const char *, va_list));
216 extern int sprintf_len _P((char *, const char *, ...));
219 #ifdef DECLARE_SPRINTF
221 extern int vsprintf _P((char *, const char *, va_list));
223 extern int vfprintf _P((FILE *, const char *, va_list));
226 #ifndef HAVE_STRERROR
227 extern char *strerror _P((int error));
231 char *index _P((const char *, int));
234 #ifndef HAVE_GETHOSTID
235 long gethostid _P((void));
238 void lprint _P((const char *, ...));
242 #if SIZEOF_CHAR_P == 4
243 # define insque_32 insque
244 # define remque_32 remque
246 inline void insque_32 _P((void *, void *));
247 inline void remque_32 _P((void *));
253 #define DEFAULT_BAUD 115200
256 int cksum(struct mbuf *m, int len);
259 void if_init _P((void));
260 void if_output _P((struct socket *, struct mbuf *));
263 void ip_init _P((void));
264 void ip_input _P((struct mbuf *));
265 struct ip * ip_reass _P((register struct ipasfrag *, register struct ipq *));
266 void ip_freef _P((struct ipq *));
267 void ip_enq _P((register struct ipasfrag *, register struct ipasfrag *));
268 void ip_deq _P((register struct ipasfrag *));
269 void ip_slowtimo _P((void));
270 void ip_stripoptions _P((register struct mbuf *, struct mbuf *));
273 int ip_output _P((struct socket *, struct mbuf *));
276 int tcp_reass _P((register struct tcpcb *, register struct tcpiphdr *, struct mbuf *));
277 void tcp_input _P((register struct mbuf *, int, struct socket *));
278 void tcp_dooptions _P((struct tcpcb *, u_char *, int, struct tcpiphdr *));
279 void tcp_xmit_timer _P((register struct tcpcb *, int));
280 int tcp_mss _P((register struct tcpcb *, u_int));
283 int tcp_output _P((register struct tcpcb *));
284 void tcp_setpersist _P((register struct tcpcb *));
287 void tcp_init _P((void));
288 void tcp_template _P((struct tcpcb *));
289 void tcp_respond _P((struct tcpcb *, register struct tcpiphdr *, register struct mbuf *, tcp_seq, tcp_seq, int));
290 struct tcpcb * tcp_newtcpcb _P((struct socket *));
291 struct tcpcb * tcp_close _P((register struct tcpcb *));
292 void tcp_drain _P((void));
293 void tcp_sockclosed _P((struct tcpcb *));
294 int tcp_fconnect _P((struct socket *));
295 void tcp_connect _P((struct socket *));
296 int tcp_attach _P((struct socket *));
297 u_int8_t tcp_tos _P((struct socket *));
298 int tcp_emu _P((struct socket *, struct mbuf *));
299 int tcp_ctl _P((struct socket *));
300 struct tcpcb *tcp_drop(struct tcpcb *tp, int err);
303 #define MIN_MRU MINMRU
304 #define MAX_MRU MAXMRU
307 #define MAX_MRU 16384