loadlwipv6 inlined
[vde.git] / vde-2 / src / slirpvde / slirp.h
blob120918c056551f511f27d3d161f356cc03f5bcd6
1 #ifndef __SLIRP_H__
2 #define __SLIRP_H__
4 #include <config.h>
6 #define CONFIG_QEMU
9 #ifndef CONFIG_QEMU
10 #include <version.h>
11 #endif
12 #include "slirp_config.h"
14 #include <sys/types.h>
15 #ifdef HAVE_SYS_BITYPES_H
16 # include <sys/bitypes.h>
17 #endif
19 #ifdef NEED_TYPEDEFS
20 typedef char int8_t;
21 typedef unsigned char u_int8_t;
23 # if SIZEOF_SHORT == 2
24 typedef short int16_t;
25 typedef unsigned short u_int16_t;
26 # else
27 # if SIZEOF_INT == 2
28 typedef int int16_t;
29 typedef unsigned int u_int16_t;
30 # else
31 #error Cannot find a type with sizeof() == 2
32 # endif
33 # endif
35 # if SIZEOF_SHORT == 4
36 typedef short int32_t;
37 typedef unsigned short u_int32_t;
38 # else
39 # if SIZEOF_INT == 4
40 typedef int int32_t;
41 typedef unsigned int u_int32_t;
42 # else
43 #error Cannot find a type with sizeof() == 4
44 # endif
45 # endif
46 #endif /* NEED_TYPEDEFS */
48 #ifdef HAVE_UNISTD_H
49 # include <unistd.h>
50 #endif
52 #ifdef HAVE_STDLIB_H
53 # include <stdlib.h>
54 #endif
56 #include <stdio.h>
57 #include <errno.h>
60 #if TIME_WITH_SYS_TIME
61 # include <sys/time.h>
62 # include <time.h>
63 #else
64 # if HAVE_SYS_TIME_H
65 # include <sys/time.h>
66 # else
67 # include <time.h>
68 # endif
69 #endif
71 #ifdef HAVE_STRING_H
72 # include <string.h>
73 #else
74 # include <strings.h>
75 #endif
77 #include <sys/uio.h>
79 #ifndef _P
80 /*#ifndef NO_PROTOTYPES*/
81 # define _P(x) x
82 /*#else
83 # define _P(x) ()
84 #endif*/
85 #endif
87 #include <netinet/in.h>
88 #include <arpa/inet.h>
90 #ifdef GETTIMEOFDAY_ONE_ARG
91 #define gettimeofday(x, y) gettimeofday(x)
92 #endif
94 /* Systems lacking strdup() definition in <string.h>. */
95 #if defined(ultrix)
96 char *strdup _P((const char *));
97 #endif
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));
103 #endif
105 #ifndef HAVE_INET_ATON
106 int inet_aton _P((const char *cp, struct in_addr *ia));
107 #endif
109 #include <fcntl.h>
110 #ifndef NO_UNIX_SOCKETS
111 #include <sys/un.h>
112 #endif
113 #include <signal.h>
114 #ifdef HAVE_SYS_SIGNAL_H
115 # include <sys/signal.h>
116 #endif
117 #include <sys/socket.h>
119 #if defined(WANT_SYS_IOCTL_H) && defined(HAVE_SYS_IOCTL_H)
120 # include <sys/ioctl.h>
121 #else
122 # define WANT_SYS_TERMIOS_H
123 #endif
125 #ifdef WANT_SYS_TERMIOS_H
126 # ifndef INCLUDED_TERMIOS_H
127 # ifdef HAVE_TERMIOS_H
128 # include <termios.h>
129 # else
130 # include <termio.h>
131 # endif
132 # define INCLUDED_TERMIOS_H
133 # endif
134 #endif
138 #ifdef HAVE_SYS_SELECT_H
139 # include <sys/select.h>
140 #endif
142 #ifdef HAVE_SYS_WAIT_H
143 # include <sys/wait.h>
144 #endif
146 #ifdef HAVE_SYS_FILIO_H
147 # include <sys/filio.h>
148 #endif
150 #ifdef USE_PPP
151 #include <ppp/slirppp.h>
152 #endif
154 #ifdef __STDC__
155 #include <stdarg.h>
156 #else
157 #include <varargs.h>
158 #endif
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>
169 #endif
171 #include "debug.h"
173 #include "ip.h"
174 #include "tcp.h"
175 #include "tcp_timer.h"
176 #include "tcp_var.h"
177 #include "tcpip.h"
178 #include "udp.h"
179 #include "icmp_var.h"
180 #include "mbuf.h"
181 #include "sbuf.h"
182 #include "socket.h"
183 #include "if.h"
184 #include "main.h"
185 #include "misc.h"
186 #include "ctl.h"
187 #ifdef USE_PPP
188 #include <ppp/pppd.h>
189 #include <ppp/ppp.h>
190 #endif
192 #include "bootp.h"
193 #include "libslirp.h"
195 extern struct ttys *ttys_unit[MAX_INTERFACES];
197 #ifndef NULL
198 #define NULL (void *)0
199 #endif
201 #ifndef FULL_BOLT
202 void if_start _P((void));
203 #else
204 void if_start _P((struct ttys *));
205 #endif
207 #ifdef BAD_SPRINTF
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 *, ...));
212 #endif
214 #ifdef DECLARE_SPRINTF
215 # ifndef BAD_SPRINTF
216 extern int vsprintf _P((char *, const char *, va_list));
217 # endif
218 extern int vfprintf _P((FILE *, const char *, va_list));
219 #endif
221 #ifndef HAVE_STRERROR
222 extern char *strerror _P((int error));
223 #endif
225 #ifndef HAVE_INDEX
226 char *index _P((const char *, int));
227 #endif
229 #ifndef HAVE_GETHOSTID
230 long gethostid _P((void));
231 #endif
233 void lprint _P((const char *, ...));
235 extern int do_echo;
237 #if SIZEOF_CHAR_P == 4
238 # define insque_32 insque
239 # define remque_32 remque
240 #else
241 inline void insque_32 _P((void *, void *));
242 inline void remque_32 _P((void *));
243 #endif
245 #include <pwd.h>
246 #include <netdb.h>
248 #define DEFAULT_BAUD 115200
250 void client_eth_register(const unsigned char *eth_addr, const unsigned char *ip_addr);
252 /* cksum.c */
253 int cksum(struct mbuf *m, int len);
255 /* if.c */
256 void if_init _P((void));
257 void if_output _P((struct socket *, struct mbuf *));
259 /* ip_input.c */
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 *));
269 /* ip_output.c */
270 int ip_output _P((struct socket *, struct mbuf *));
272 /* tcp_input.c */
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));
279 /* tcp_output.c */
280 int tcp_output _P((register struct tcpcb *));
281 void tcp_setpersist _P((register struct tcpcb *));
283 /* tcp_subr.c */
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);
299 #ifdef USE_PPP
300 #define MIN_MRU MINMRU
301 #define MAX_MRU MAXMRU
302 #else
303 #define MIN_MRU 128
304 #define MAX_MRU 16384
305 #endif
307 #endif