dnsproxy.h revision 9c49c73dd1a2b84de46465cf04f6623b7de9eedc
/* $Id$ */
/*
* Copyright (c) 2003,2004,2005 Armin Wolfermann
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifndef _DNSPROXY_H_
#define _DNSPROXY_H_
/* LONGLONG */
# include <time.h>
#else
# if HAVE_SYS_TIME_H
# else
# include <time.h>
# endif
#endif
#ifndef VBOX
#ifdef HAVE_ARPA_INET_H
#endif
#include <stdarg.h>
#include <event.h>
#ifdef DEBUG
#else
#define DPRINTF(x)
#endif
#ifdef GLOBALS
#define GLOBAL(a) a
#define GLOBAL_INIT(a,b) a = b
#else
#define GLOBAL(a) extern a
#define GLOBAL_INIT(a,b) extern a
#endif
#endif
struct request {
unsigned short id;
struct sockaddr_in client;
unsigned short clientid;
unsigned char recursion;
#ifndef VBOX
#endif
#ifdef VBOX
/* this field used for saving last attempt
* to connect server, timeout function should change
* it's value on next server. And dnsproxy_query should
* initializate with first server in the list
*
* dnsgen is a generation number - a copy of pData->dnsgen at the
* time of request creation (poor man's weak reference).
* dns_server must not be used if pData->dnsgen changed.
*/
struct dns_entry *dns_server;
int nbyte; /* length of dns request */
#endif
};
#ifndef VBOX
GLOBAL(char *authoritative);
GLOBAL(unsigned long active_queries);
GLOBAL(unsigned long all_queries);
GLOBAL(unsigned long authoritative_queries);
GLOBAL(unsigned long recursive_queries);
GLOBAL(unsigned long removed_queries);
GLOBAL(unsigned long dropped_queries);
GLOBAL(unsigned long answered_queries);
GLOBAL(unsigned long dropped_answers);
GLOBAL(unsigned long late_answers);
GLOBAL(unsigned long hash_collisions);
/* dnsproxy.c */
RETSIGTYPE signal_handler(int);
int signal_event(void);
/* daemon.c */
int daemon(int, int);
#endif
/* hash.c */
/* internal.c */
int add_internal(PNATState, char *);
#ifndef VBOX
/* log.c */
void log_syslog(const char *);
void info(const char *, ...);
void error(const char *, ...);
void fatal(const char *, ...);
/* parse.c */
int parse(const char *);
/* statistics.c */
void statistics_start(void);
#else
#endif
#endif /* _DNSPROXY_H_ */