/* $Id$ */
/** @file
* NAT - slirp (declarations/defines).
*/
/*
* Copyright (C) 2006-2012 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
#ifndef __COMMON_H__
#define __COMMON_H__
#ifdef RT_OS_WINDOWS
# include <winsock2.h>
# include <ws2tcpip.h>
typedef int socklen_t;
#endif
#ifdef RT_OS_OS2 /* temporary workaround, see ticket #127 */
typedef int socklen_t;
#endif
#define CONFIG_QEMU
#ifdef DEBUG
#endif
#ifndef CONFIG_QEMU
# include "version.h"
#endif
#ifdef RT_OS_WINDOWS
# include <windows.h>
# include <io.h>
#endif
#include "slirp_config.h"
#ifdef RT_OS_WINDOWS
# ifndef _MSC_VER
# include <inttypes.h>
# endif
# include <iphlpapi.h>
/* We don't want the errno.h versions of these error defines. */
# include <errno.h>
# endif
#else /* !RT_OS_WINDOWS */
# define O_BINARY 0
#endif /* !RT_OS_WINDOWS */
#if defined(RT_OS_WINDOWS) || defined (RT_OS_SOLARIS)
typedef char *caddr_t;
#endif
#ifdef HAVE_SYS_BITYPES_H
#endif
#ifdef _MSC_VER
# include <time.h>
#else /* !_MSC_VER */
#endif /* !_MSC_VER */
#ifdef NEED_TYPEDEFS
typedef char int8_t;
typedef unsigned char u_int8_t;
# if SIZEOF_SHORT == 2
typedef short int16_t;
typedef unsigned short u_int16_t;
# else
# if SIZEOF_INT == 2
typedef int int16_t;
typedef unsigned int u_int16_t;
# else
# endif
# endif
# if SIZEOF_SHORT == 4
typedef short int32_t;
typedef unsigned short u_int32_t;
# else
# if SIZEOF_INT == 4
typedef int int32_t;
typedef unsigned int u_int32_t;
# else
# endif
# endif
#endif /* NEED_TYPEDEFS */
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#ifdef HAVE_STDLIB_H
# include <stdlib.h>
#endif
#include <errno.h>
#ifndef HAVE_MEMMOVE
#endif
# include <time.h>
#else
# if HAVE_SYS_TIME_H
# else
# include <time.h>
# endif
#endif
#ifdef HAVE_STRING_H
# include <string.h>
#else
# include <strings.h>
#endif
#ifndef RT_OS_WINDOWS
#endif
#ifndef RT_OS_WINDOWS
#endif
#ifdef GETTIMEOFDAY_ONE_ARG
#endif
#ifndef HAVE_INET_ATON
#endif
#include <fcntl.h>
#ifndef NO_UNIX_SOCKETS
#endif
#include <signal.h>
#ifdef HAVE_SYS_SIGNAL_H
#endif
#ifndef RT_OS_WINDOWS
#endif
#if defined(HAVE_SYS_IOCTL_H)
#endif
#ifdef HAVE_SYS_SELECT_H
#endif
#ifdef HAVE_SYS_WAIT_H
#endif
#ifdef HAVE_SYS_FILIO_H
#endif
# include <stdarg.h>
#else
# include <varargs.h>
#endif
/* Avoid conflicting with the libc insque() and remque(), which
* have different prototypes. */
#ifdef HAVE_SYS_STROPTS_H
#endif
#include "libslirp.h"
#include "debug.h"
#include "ip.h"
#include "tcp.h"
#include "tcp_timer.h"
#include "tcp_var.h"
#include "tcpip.h"
#include "udp.h"
#include "icmp_var.h"
#include "mbuf.h"
#include "if.h"
#include "sbuf.h"
#include "socket.h"
#include "main.h"
#include "misc.h"
#include "ctl.h"
#include "bootp.h"
#include "tftp.h"
#include "slirp_state.h"
#include "slirp_dns.h"
#ifndef NULL
# define NULL (void *)0
#endif
#ifndef HAVE_INDEX
char *index (const char *, int);
#endif
#ifndef HAVE_GETHOSTID
long gethostid (void);
#endif
#ifndef RT_OS_WINDOWS
#include <netdb.h>
#endif
#include "dnsproxy/dnsproxy.h"
/* cksum.c */
typedef unsigned int u_int;
#include "in_cksum.h"
/* if.c */
/* ip_input.c */
void ip_slowtimo (PNATState);
/* ip_output.c */
/* tcp_input.c */
/* tcp_output.c */
void tcp_setpersist (register struct tcpcb *);
/* tcp_subr.c */
void tcp_template (struct tcpcb *);
void tcp_respond (PNATState, struct tcpcb *, register struct tcpiphdr *, register struct mbuf *, tcp_seq, tcp_seq, int);
void tcp_drain (void);
/*slirp.c*/
#ifndef RT_OS_WINDOWS
# define min(x, y) ((x) < (y) ? (x) : (y))
# define max(x, y) ((x) > (y) ? (x) : (y))
#endif
#ifdef RT_OS_WINDOWS
# if 0 /* debugging */
# else
# endif
#endif
struct ethhdr
{
};
/*
* (vvl) externing of sscanf.
*/
#if defined(VBOX_SLIRP_ALIAS) || defined(VBOX_SLIRP_BSD)
# define NO_FW_PUNCH
/* Two wrongs don't make a right, but this at least averts harm. */
# define NO_USE_SOCKETS
# ifdef alias_addr
# ifndef VBOX_SLIRP_BSD
# else
# endif
# endif
# ifndef __unused
# define __unused
# endif
# ifdef VBOX_WITH_DEBUG_LIBALIAS
# define LIBALIAS_DEBUG
# endif
# define fflush(x) do{} while(0)
# include "ext.h"
#endif /*VBOX_SLIRP_ALIAS*/
/**
* @todo might be useful to make it configurable, especially in terms of Intnet behind NAT
*/
# define max_protohdr 0
/**
* @todo (vvl) for now ignore these values, later perhaps initialize tuning parameters
*/
# define EVENTHANDLER_INVOKE(a) do{}while(0)
struct dummy_req
{
void *newptr;
};
void mbuf_init(void *);
int ftp_alias_load(PNATState);
int ftp_alias_unload(PNATState);
int nbt_alias_load(PNATState);
int nbt_alias_unload(PNATState);
int dns_alias_load(PNATState);
int dns_alias_unload(PNATState);
{
return MCLBYTES;
return MCLBYTES;
else if (if_mtu < MJUM9BYTES)
return MJUM9BYTES;
else if (if_mtu < MJUM16BYTES)
return MJUM16BYTES;
else
AssertMsgFailed(("Unsupported size"));
return 0;
}
{
/* if_encap assumes that all packets goes through aliased address(gw) */
if (u8ServiceId == CTL_ALIAS)
return true;
if (!t)
return false;
m_tag_prepend(m, t);
return true;
}
/**
* This function tags mbuf allocated for special services.
* @todo: add service id verification.
*/
{
if (!m)
return m;
{
return NULL;
}
return m;
}
{
}
{
}
{
bool fWideCasting = false;
return fWideCasting;
}
#endif