]> git.proxmox.com Git - qemu.git/blame - slirp/slirp.h
avoid warning
[qemu.git] / slirp / slirp.h
CommitLineData
f0cbd3ec
FB
1#ifndef __COMMON_H__
2#define __COMMON_H__
3
4#define CONFIG_QEMU
5
6#define DEBUG 1
7
8#ifndef CONFIG_QEMU
9#include "version.h"
10#endif
11#include "config.h"
12#include "slirp_config.h"
13
14#include <sys/types.h>
15#ifdef HAVE_SYS_BITYPES_H
16# include <sys/bitypes.h>
17#endif
18
170c6f87
FB
19#include <sys/time.h>
20
f0cbd3ec
FB
21#ifdef NEED_TYPEDEFS
22typedef char int8_t;
23typedef unsigned char u_int8_t;
24
25# if SIZEOF_SHORT == 2
26 typedef short int16_t;
27 typedef unsigned short u_int16_t;
28# else
29# if SIZEOF_INT == 2
30 typedef int int16_t;
31 typedef unsigned int u_int16_t;
32# else
33 #error Cannot find a type with sizeof() == 2
34# endif
35# endif
36
37# if SIZEOF_SHORT == 4
38 typedef short int32_t;
39 typedef unsigned short u_int32_t;
40# else
41# if SIZEOF_INT == 4
42 typedef int int32_t;
43 typedef unsigned int u_int32_t;
44# else
45 #error Cannot find a type with sizeof() == 4
46# endif
47# endif
48#endif /* NEED_TYPEDEFS */
49
50#ifdef HAVE_UNISTD_H
51# include <unistd.h>
52#endif
53
54#ifdef HAVE_STDLIB_H
55# include <stdlib.h>
56#endif
57
58#include <stdio.h>
59#include <errno.h>
60
61#ifndef HAVE_MEMMOVE
62#define memmove(x, y, z) bcopy(y, x, z)
63#endif
64
65#if TIME_WITH_SYS_TIME
66# include <sys/time.h>
67# include <time.h>
68#else
69# if HAVE_SYS_TIME_H
70# include <sys/time.h>
71# else
72# include <time.h>
73# endif
74#endif
75
76#ifdef HAVE_STRING_H
77# include <string.h>
78#else
79# include <strings.h>
80#endif
81
82#include <sys/uio.h>
83
84#ifndef _P
85#ifndef NO_PROTOTYPES
86# define _P(x) x
87#else
88# define _P(x) ()
89#endif
90#endif
91
92#include <netinet/in.h>
93#include <arpa/inet.h>
94
95#ifdef GETTIMEOFDAY_ONE_ARG
96#define gettimeofday(x, y) gettimeofday(x)
97#endif
98
99/* Systems lacking strdup() definition in <string.h>. */
100#if defined(ultrix)
101char *strdup _P((const char *));
102#endif
103
104/* Systems lacking malloc() definition in <stdlib.h>. */
105#if defined(ultrix) || defined(hcx)
106void *malloc _P((size_t arg));
107void free _P((void *ptr));
108#endif
109
110#ifndef HAVE_INET_ATON
111int inet_aton _P((const char *cp, struct in_addr *ia));
112#endif
113
114#include <fcntl.h>
115#ifndef NO_UNIX_SOCKETS
116#include <sys/un.h>
117#endif
118#include <signal.h>
119#ifdef HAVE_SYS_SIGNAL_H
120# include <sys/signal.h>
121#endif
122#include <sys/socket.h>
123
124#if defined(WANT_SYS_IOCTL_H) && defined(HAVE_SYS_IOCTL_H)
125# include <sys/ioctl.h>
126#else
127# define WANT_SYS_TERMIOS_H
128#endif
129
130#ifdef WANT_SYS_TERMIOS_H
131# ifndef INCLUDED_TERMIOS_H
132# ifdef HAVE_TERMIOS_H
133# include <termios.h>
134# else
135# include <termio.h>
136# endif
137# define INCLUDED_TERMIOS_H
138# endif
139#endif
140
141
142
143#ifdef HAVE_SYS_SELECT_H
144# include <sys/select.h>
145#endif
146
147#ifdef HAVE_SYS_WAIT_H
148# include <sys/wait.h>
149#endif
150
151#ifdef HAVE_SYS_FILIO_H
152# include <sys/filio.h>
153#endif
154
155#ifdef USE_PPP
156#include <ppp/slirppp.h>
157#endif
158
159#ifdef __STDC__
160#include <stdarg.h>
161#else
162#include <varargs.h>
163#endif
164
165#include <sys/stat.h>
166
167/* Avoid conflicting with the libc insque() and remque(), which
168 have different prototypes. */
169#define insque slirp_insque
170#define remque slirp_remque
171
172#ifdef HAVE_SYS_STROPTS_H
173#include <sys/stropts.h>
174#endif
175
176#include "debug.h"
177
178#include "ip.h"
179#include "tcp.h"
180#include "tcp_timer.h"
181#include "tcp_var.h"
182#include "tcpip.h"
183#include "udp.h"
184#include "icmp_var.h"
185#include "mbuf.h"
186#include "sbuf.h"
187#include "socket.h"
188#include "if.h"
189#include "main.h"
190#include "misc.h"
191#include "ctl.h"
192#ifdef USE_PPP
193#include "ppp/pppd.h"
194#include "ppp/ppp.h"
195#endif
196
197#include "bootp.h"
198#include "libslirp.h"
199
200extern struct ttys *ttys_unit[MAX_INTERFACES];
201
202#ifndef NULL
203#define NULL (void *)0
204#endif
205
206#ifndef FULL_BOLT
207void if_start _P((void));
208#else
209void if_start _P((struct ttys *));
210#endif
211
212#ifdef BAD_SPRINTF
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 *, ...));
217#endif
218
219#ifdef DECLARE_SPRINTF
220# ifndef BAD_SPRINTF
221 extern int vsprintf _P((char *, const char *, va_list));
222# endif
223 extern int vfprintf _P((FILE *, const char *, va_list));
224#endif
225
226#ifndef HAVE_STRERROR
227 extern char *strerror _P((int error));
228#endif
229
230#ifndef HAVE_INDEX
231 char *index _P((const char *, int));
232#endif
233
234#ifndef HAVE_GETHOSTID
235 long gethostid _P((void));
236#endif
237
238void lprint _P((const char *, ...));
239
240extern int do_echo;
241
242#if SIZEOF_CHAR_P == 4
243# define insque_32 insque
244# define remque_32 remque
245#else
246 inline void insque_32 _P((void *, void *));
247 inline void remque_32 _P((void *));
248#endif
249
250#include <pwd.h>
251#include <netdb.h>
252
253#define DEFAULT_BAUD 115200
254
255/* cksum.c */
256int cksum(struct mbuf *m, int len);
257
258/* if.c */
259void if_init _P((void));
260void if_output _P((struct socket *, struct mbuf *));
261
262/* ip_input.c */
263void ip_init _P((void));
264void ip_input _P((struct mbuf *));
265struct ip * ip_reass _P((register struct ipasfrag *, register struct ipq *));
266void ip_freef _P((struct ipq *));
267void ip_enq _P((register struct ipasfrag *, register struct ipasfrag *));
268void ip_deq _P((register struct ipasfrag *));
269void ip_slowtimo _P((void));
270void ip_stripoptions _P((register struct mbuf *, struct mbuf *));
271
272/* ip_output.c */
273int ip_output _P((struct socket *, struct mbuf *));
274
275/* tcp_input.c */
276int tcp_reass _P((register struct tcpcb *, register struct tcpiphdr *, struct mbuf *));
277void tcp_input _P((register struct mbuf *, int, struct socket *));
278void tcp_dooptions _P((struct tcpcb *, u_char *, int, struct tcpiphdr *));
279void tcp_xmit_timer _P((register struct tcpcb *, int));
280int tcp_mss _P((register struct tcpcb *, u_int));
281
282/* tcp_output.c */
283int tcp_output _P((register struct tcpcb *));
284void tcp_setpersist _P((register struct tcpcb *));
285
286/* tcp_subr.c */
287void tcp_init _P((void));
288void tcp_template _P((struct tcpcb *));
289void tcp_respond _P((struct tcpcb *, register struct tcpiphdr *, register struct mbuf *, tcp_seq, tcp_seq, int));
290struct tcpcb * tcp_newtcpcb _P((struct socket *));
291struct tcpcb * tcp_close _P((register struct tcpcb *));
292void tcp_drain _P((void));
293void tcp_sockclosed _P((struct tcpcb *));
294int tcp_fconnect _P((struct socket *));
295void tcp_connect _P((struct socket *));
296int tcp_attach _P((struct socket *));
297u_int8_t tcp_tos _P((struct socket *));
298int tcp_emu _P((struct socket *, struct mbuf *));
299int tcp_ctl _P((struct socket *));
9fafc9ea 300struct tcpcb *tcp_drop(struct tcpcb *tp, int err);
f0cbd3ec
FB
301
302#ifdef USE_PPP
303#define MIN_MRU MINMRU
304#define MAX_MRU MAXMRU
305#else
306#define MIN_MRU 128
307#define MAX_MRU 16384
308#endif
309
310#endif