slirp_state.h revision 55c6dd0c4e495858f1681a45e28e04c791ef066e
/** @file
* NAT - slirp state/configuration.
*/
/*
* 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 ___slirp_state_h
#define ___slirp_state_h
#include <iprt/critsect.h>
#define COUNTERS_INIT
#include "counters.h"
#include "ip_icmp.h"
#include "dnsproxy/dnsproxy.h"
/** Where to start DHCP IP number allocation. */
#define START_ADDR 15
/** DHCP Lease time. */
/*
* ARP cache this is naive implementaion of ARP
* cache of mapping 4 byte IPv4 address to 6 byte
* ethernet one.
*/
struct arp_cache_entry
{
};
/** TFTP session entry. */
struct dns_domain_entry
{
char *dd_pszDomain;
};
typedef struct DNSMAPPINGENTRY
{
/** host name to map.
* @note If pszCName isn't null pszPattern won't be used (see alias_dns.c for
* details).
*/
char *pszCName;
/** Pattern (simple) of hostnames to map to the specified IP. */
char *pszPattern;
/** The IP Address. */
/** List entry. */
#endif
struct dns_entry
{
};
struct port_forward_rule
{
struct in_addr guest_addr;
int activated;
};
/* forward declaration */
struct proto_handler;
/** Main state/configuration structure for slirp NAT. */
typedef struct NATState
{
#include "counters.h"
/* Stuff from boot.c */
void *pbootp_clients;
const char *bootp_filename;
/* Stuff from if.c */
int if_comp;
int if_maxlinkhdr;
int if_queued;
int if_thresh;
/* Stuff from icmp.c */
struct icmpstat_t icmpstat;
/* Stuff from ip_input.c */
int maxnipq; /* Administrative limit on # of reass queues*/
int maxfragsperpacket; /* Maximum number of IPv4 fragments allowed per packet */
int nipq; /* total number of reass queues */
/* Stuff from mbuf.c */
/* Stuff from slirp.c */
void *pvUser;
bool do_slowtimo;
bool link_up;
struct in_addr alias_addr;
struct in_addr special_addr;
int tcp_rcvspace;
int tcp_sndspace;
int socket_rcv;
int socket_snd;
int soMaxConn;
#ifdef RT_OS_WINDOWS
#endif
struct dns_list_head pDnsList;
struct dns_domain_list_head pDomainList;
struct in_addr tftp_server;
struct in_addr loopback_addr;
#ifndef VBOX_WITH_NAT_SERVICE
#endif
const uint8_t *slirp_ethaddr;
char slirp_hostname[33];
bool fPassDomain;
/* Stuff from tcp_input.c */
struct socket *tcp_last_so;
/* Stuff from tcp_timer.c */
int tcp_reass_qsize;
int tcp_reass_maxqlen;
int tcp_reass_maxseg;
int tcp_reass_overflows;
/* Stuff from tftp.c */
void *pvTftpSessions;
int cTftpSession;
const char *tftp_prefix;
/* Stuff from udp.c */
struct socket *udp_last_so;
struct socket icmp_socket;
struct icmp_storage icmp_msg_head;
# ifndef RT_OS_WINDOWS
/* counter of sockets needed for allocation enough room to
*
* operation on socket queue (tcb, udb)
*/
int nsock;
# else
# define NSOCK_INC() do {} while (0)
# define NSOCK_DEC() do {} while (0)
# define NSOCK_INC_EX(ex) do {} while (0)
# define NSOCK_DEC_EX(ex) do {} while (0)
# endif
int cIcmpCacheSize;
int iIcmpCacheLimit;
# ifdef RT_OS_WINDOWS
void *pvIcmpBuffer;
/* According MSDN specification IcmpParseReplies
* function should be detected at runtime.
*/
long (WINAPI * pfIcmpParseReplies)(void *, long);
# endif
#if defined(RT_OS_WINDOWS)
#endif
#ifdef zone_mbuf
#endif
#ifdef zone_clust
#endif
#ifdef zone_pack
#endif
#ifdef zone_jumbop
#endif
#ifdef zone_jumbo9
#endif
#ifdef zone_jumbo16
#endif
#ifdef zone_ext_refcnt
int nmbclusters; /* limits number of mbuf clusters */
int nmbjumbop; /* limits number of page size jumbo clusters */
int nmbjumbo9; /* limits number of 9k jumbo clusters */
int nmbjumbo16; /* limits number of 16k jumbo clusters */
#endif
bool fUseHostResolver;
/** Flag whether using the host resolver mode is permanent
* because the user configured it that way. */
/* from dnsproxy/dnsproxy.h*/
unsigned int authoritative_port;
unsigned int authoritative_timeout;
unsigned int recursive_port;
unsigned int recursive_timeout;
unsigned int stats_timeout;
unsigned int port;
unsigned long active_queries;
unsigned long all_queries;
unsigned long authoritative_queries;
unsigned long recursive_queries;
unsigned long removed_queries;
unsigned long dropped_queries;
unsigned long answered_queries;
unsigned long dropped_answers;
unsigned long late_answers;
unsigned long hash_collisions;
/*dnsproxy/dnsproxy.c*/
unsigned short queryid;
struct sockaddr_in authoritative_addr;
struct sockaddr_in recursive_addr;
int sock_query;
int sock_answer;
#define HASHSIZE 10
/* this field control behaviour of DHCP server */
bool fUseDnsProxy;
int i32AliasMode;
struct libalias *proxy_alias;
int cRedirectionsActive;
int cRedirectionsStored;
struct arp_cache_head arp_cache;
/* libalis modules' handlers*/
struct proto_handler *ftp_module;
struct proto_handler *nbt_module;
struct proto_handler *dns_module;
#ifdef VBOX_WITH_NAT_SEND2HOME
/* array of home addresses */
struct sockaddr_in *pInSockAddrHomeAddress;
/* size of pInSockAddrHomeAddress in elements */
int cInHomeAddressSize;
#endif
#endif
} NATState;
/** Default IP time to live. */
/** Number of permanent buffers in mbuf. */
#define mbuf_thresh 30
/** Use a fixed time before sending keepalive. */
#define tcp_keepidle TCPTV_KEEP_IDLE
/** Use a fixed interval between keepalive. */
#define tcp_keepintvl TCPTV_KEEPINTVL
/** Maximum idle time before timing out a connection. */
/** Default TCP socket options. */
#define so_options DO_KEEPALIVE
/** Default TCP MSS value. */
#define tcp_mssdflt TCP_MSS
/** Default TCP round trip time. */
/** Enable RFC1323 performance enhancements.
* @todo check if it really works, it was turned off before. */
#define tcp_do_rfc1323 1
/** TCP receive buffer size. */
/** TCP receive buffer size. */
/* TCP duplicate ACK retransmit threshold. */
#define tcprexmtthresh 3
#ifndef VBOX_SLIRP_ALIAS
#else
#endif
#define queue_tcp_label tcb
#define queue_udp_label udb
#define VBOX_X2(x) x
#if 1
# define QSOCKET_LOCK(queue) do {} while (0)
# define QSOCKET_UNLOCK(queue) do {} while (0)
# define QSOCKET_LOCK_CREATE(queue) do {} while (0)
# define QSOCKET_LOCK_DESTROY(queue) do {} while (0)
{ \
# define CONTINUE_NO_UNLOCK(label) continue
do { \
} while(0)
do { \
} while(0)
do { \
} while (0)
#endif
/* dnsproxy/dnsproxy.c */
/* dnsproxy/dnsproxy.c */
#include "ext.h"
{
}
{
return pData->zone_jumbop;
}
{
return pData->zone_jumbo9;
}
{
return pData->zone_jumbo16;
}
{
return pData->zone_ext_refcnt;
}
{
}
{
return pData->zone_clust;
}
#ifndef VBOX_SLIRP_BSD
#endif
#endif /* !___slirp_state_h */