man pages license/see also updates
[vde.git] / vde-2 / slirpvde / slirp.h
blobd7a5757989a531adfaca70ae5dbbe173422c66fe
1 #ifndef __COMMON_H__
2 #define __COMMON_H__
4 #define CONFIG_QEMU
6 #ifndef CONFIG_QEMU
7 #include <version.h>
8 #endif
9 #include <slirp_config.h>
11 #include <sys/types.h>
12 #ifdef HAVE_SYS_BITYPES_H
13 # include <sys/bitypes.h>
14 #endif
16 #ifdef NEED_TYPEDEFS
17 typedef char int8_t;
18 typedef unsigned char u_int8_t;
20 # if SIZEOF_SHORT == 2
21 typedef short int16_t;
22 typedef unsigned short u_int16_t;
23 # else
24 # if SIZEOF_INT == 2
25 typedef int int16_t;
26 typedef unsigned int u_int16_t;
27 # else
28 #error Cannot find a type with sizeof() == 2
29 # endif
30 # endif
32 # if SIZEOF_SHORT == 4
33 typedef short int32_t;
34 typedef unsigned short u_int32_t;
35 # else
36 # if SIZEOF_INT == 4
37 typedef int int32_t;
38 typedef unsigned int u_int32_t;
39 # else
40 #error Cannot find a type with sizeof() == 4
41 # endif
42 # endif
43 #endif /* NEED_TYPEDEFS */
45 #ifdef HAVE_UNISTD_H
46 # include <unistd.h>
47 #endif
49 #ifdef HAVE_STDLIB_H
50 # include <stdlib.h>
51 #endif
53 #include <stdio.h>
54 #include <errno.h>
56 #ifndef HAVE_MEMMOVE
57 #define memmove(x, y, z) bcopy(y, x, z)
58 #endif
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 /* cksum.c */
251 int cksum(struct mbuf *m, int len);
253 /* if.c */
254 void if_init _P((void));
255 void if_output _P((struct socket *, struct mbuf *));
257 /* ip_input.c */
258 void ip_init _P((void));
259 void ip_input _P((struct mbuf *));
260 struct ip * ip_reass _P((register struct ipasfrag *, register struct ipq *));
261 void ip_freef _P((struct ipq *));
262 void ip_enq _P((register struct ipasfrag *, register struct ipasfrag *));
263 void ip_deq _P((register struct ipasfrag *));
264 void ip_slowtimo _P((void));
265 void ip_stripoptions _P((register struct mbuf *, struct mbuf *));
267 /* ip_output.c */
268 int ip_output _P((struct socket *, struct mbuf *));
270 /* tcp_input.c */
271 int tcp_reass _P((register struct tcpcb *, register struct tcpiphdr *, struct mbuf *));
272 void tcp_input _P((register struct mbuf *, int, struct socket *));
273 void tcp_dooptions _P((struct tcpcb *, u_char *, int, struct tcpiphdr *));
274 void tcp_xmit_timer _P((register struct tcpcb *, int));
275 int tcp_mss _P((register struct tcpcb *, u_int));
277 /* tcp_output.c */
278 int tcp_output _P((register struct tcpcb *));
279 void tcp_setpersist _P((register struct tcpcb *));
281 /* tcp_subr.c */
282 void tcp_init _P((void));
283 void tcp_template _P((struct tcpcb *));
284 void tcp_respond _P((struct tcpcb *, register struct tcpiphdr *, register struct mbuf *, tcp_seq, tcp_seq, int));
285 struct tcpcb * tcp_newtcpcb _P((struct socket *));
286 struct tcpcb * tcp_close _P((register struct tcpcb *));
287 void tcp_drain _P((void));
288 void tcp_sockclosed _P((struct tcpcb *));
289 int tcp_fconnect _P((struct socket *));
290 void tcp_connect _P((struct socket *));
291 int tcp_attach _P((struct socket *));
292 u_int8_t tcp_tos _P((struct socket *));
293 int tcp_emu _P((struct socket *, struct mbuf *));
294 int tcp_ctl _P((struct socket *));
295 struct tcpcb *tcp_drop(struct tcpcb *tp, int err);
297 #ifdef USE_PPP
298 #define MIN_MRU MINMRU
299 #define MAX_MRU MAXMRU
300 #else
301 #define MIN_MRU 128
302 #define MAX_MRU 16384
303 #endif
305 #endif