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(HAVE_SYS_IOCTL_H)
125 # include <sys/ioctl.h>
128 #ifdef HAVE_SYS_SELECT_H
129 # include <sys/select.h>
132 #ifdef HAVE_SYS_WAIT_H
133 # include <sys/wait.h>
136 #ifdef HAVE_SYS_FILIO_H
137 # include <sys/filio.h>
141 #include <ppp/slirppp.h>
150 #include <sys/stat.h>
152 /* Avoid conflicting with the libc insque() and remque(), which
153 have different prototypes. */
154 #define insque slirp_insque
155 #define remque slirp_remque
157 #ifdef HAVE_SYS_STROPTS_H
158 #include <sys/stropts.h>
165 #include "tcp_timer.h"
169 #include "icmp_var.h"
178 #include "ppp/pppd.h"
183 #include "libslirp.h"
185 extern struct ttys *ttys_unit[MAX_INTERFACES];
188 #define NULL (void *)0
192 void if_start _P((void));
194 void if_start _P((struct ttys *));
198 # define vsprintf vsprintf_len
199 # define sprintf sprintf_len
200 extern int vsprintf_len _P((char *, const char *, va_list));
201 extern int sprintf_len _P((char *, const char *, ...));
204 #ifdef DECLARE_SPRINTF
206 extern int vsprintf _P((char *, const char *, va_list));
208 extern int vfprintf _P((FILE *, const char *, va_list));
211 #ifndef HAVE_STRERROR
212 extern char *strerror _P((int error));
216 char *index _P((const char *, int));
219 #ifndef HAVE_GETHOSTID
220 long gethostid _P((void));
223 void lprint _P((const char *, ...));
227 #if SIZEOF_CHAR_P == 4
228 # define insque_32 insque
229 # define remque_32 remque
231 inline void insque_32 _P((void *, void *));
232 inline void remque_32 _P((void *));
238 #define DEFAULT_BAUD 115200
241 int cksum(struct mbuf *m, int len);
244 void if_init _P((void));
245 void if_output _P((struct socket *, struct mbuf *));
248 void ip_init _P((void));
249 void ip_input _P((struct mbuf *));
250 struct ip * ip_reass _P((register struct ipasfrag *, register struct ipq *));
251 void ip_freef _P((struct ipq *));
252 void ip_enq _P((register struct ipasfrag *, register struct ipasfrag *));
253 void ip_deq _P((register struct ipasfrag *));
254 void ip_slowtimo _P((void));
255 void ip_stripoptions _P((register struct mbuf *, struct mbuf *));
258 int ip_output _P((struct socket *, struct mbuf *));
261 int tcp_reass _P((register struct tcpcb *, register struct tcpiphdr *, struct mbuf *));
262 void tcp_input _P((register struct mbuf *, int, struct socket *));
263 void tcp_dooptions _P((struct tcpcb *, u_char *, int, struct tcpiphdr *));
264 void tcp_xmit_timer _P((register struct tcpcb *, int));
265 int tcp_mss _P((register struct tcpcb *, u_int));
268 int tcp_output _P((register struct tcpcb *));
269 void tcp_setpersist _P((register struct tcpcb *));
272 void tcp_init _P((void));
273 void tcp_template _P((struct tcpcb *));
274 void tcp_respond _P((struct tcpcb *, register struct tcpiphdr *, register struct mbuf *, tcp_seq, tcp_seq, int));
275 struct tcpcb * tcp_newtcpcb _P((struct socket *));
276 struct tcpcb * tcp_close _P((register struct tcpcb *));
277 void tcp_drain _P((void));
278 void tcp_sockclosed _P((struct tcpcb *));
279 int tcp_fconnect _P((struct socket *));
280 void tcp_connect _P((struct socket *));
281 int tcp_attach _P((struct socket *));
282 u_int8_t tcp_tos _P((struct socket *));
283 int tcp_emu _P((struct socket *, struct mbuf *));
284 int tcp_ctl _P((struct socket *));
285 struct tcpcb *tcp_drop(struct tcpcb *tp, int err);
288 #define MIN_MRU MINMRU
289 #define MAX_MRU MAXMRU
292 #define MAX_MRU 16384