VirtualBox

source: vbox/trunk/src/VBox/Devices/Network/slirp/dnsproxy/dnsproxy.h@ 26495

Last change on this file since 26495 was 26495, checked in by vboxsync, 15 years ago

Devices: whitespace cleanup

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.0 KB
Line 
1/* $Id: dnsproxy.h 26495 2010-02-14 07:59:48Z vboxsync $ */
2/*
3 * Copyright (c) 2003,2004,2005 Armin Wolfermann
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 */
23
24#ifndef _DNSPROXY_H_
25#define _DNSPROXY_H_
26
27/* LONGLONG */
28#include <sys/types.h>
29
30#if TIME_WITH_SYS_TIME
31# include <sys/time.h>
32# include <time.h>
33#else
34# if HAVE_SYS_TIME_H
35# include <sys/time.h>
36# else
37# include <time.h>
38# endif
39#endif
40
41#ifndef VBOX
42#include <sys/socket.h>
43#include <netinet/in.h>
44#ifdef HAVE_ARPA_INET_H
45# include <arpa/inet.h>
46#endif
47#include <stdarg.h>
48
49#include <event.h>
50
51#ifdef DEBUG
52#define DPRINTF(x) do { printf x ; } while (0)
53#else
54#define DPRINTF(x)
55#endif
56
57#ifdef GLOBALS
58#define GLOBAL(a) a
59#define GLOBAL_INIT(a,b) a = b
60#else
61#define GLOBAL(a) extern a
62#define GLOBAL_INIT(a,b) extern a
63#endif
64#endif
65
66struct request {
67 unsigned short id;
68
69 struct sockaddr_in client;
70 unsigned short clientid;
71 unsigned char recursion;
72
73#ifndef VBOX
74 struct event timeout;
75#endif
76
77 struct request **prev;
78 struct request *next;
79#ifdef VBOX
80 /* this field used for saving last attempt
81 * to connect server, timeout function should change
82 * it's value on next server. And dnsproxy_query should
83 * initializate with first server in the list
84 */
85 struct dns_entry *dns_server;
86 int nbyte; /* length of dns request */
87 char byte[1]; /* copy of original request */
88#endif
89};
90
91#ifndef VBOX
92GLOBAL_INIT(unsigned int authoritative_port, 53);
93GLOBAL_INIT(unsigned int authoritative_timeout, 10);
94GLOBAL_INIT(unsigned int recursive_port, 53);
95GLOBAL_INIT(unsigned int recursive_timeout, 90);
96GLOBAL_INIT(unsigned int stats_timeout, 3600);
97GLOBAL_INIT(unsigned int port, 53);
98
99GLOBAL(char *authoritative);
100GLOBAL(char *chrootdir);
101GLOBAL(char *listenat);
102GLOBAL(char *recursive);
103GLOBAL(char *user);
104
105GLOBAL(unsigned long active_queries);
106GLOBAL(unsigned long all_queries);
107GLOBAL(unsigned long authoritative_queries);
108GLOBAL(unsigned long recursive_queries);
109GLOBAL(unsigned long removed_queries);
110GLOBAL(unsigned long dropped_queries);
111GLOBAL(unsigned long answered_queries);
112GLOBAL(unsigned long dropped_answers);
113GLOBAL(unsigned long late_answers);
114GLOBAL(unsigned long hash_collisions);
115
116/* dnsproxy.c */
117RETSIGTYPE signal_handler(int);
118int signal_event(void);
119
120/* daemon.c */
121int daemon(int, int);
122#endif
123
124/* hash.c */
125void hash_add_request(PNATState, struct request *);
126void hash_remove_request(PNATState, struct request *);
127struct request *hash_find_request(PNATState, unsigned short);
128
129/* internal.c */
130int add_internal(PNATState, char *);
131int is_internal(PNATState, struct in_addr);
132
133#ifndef VBOX
134/* log.c */
135void log_syslog(const char *);
136void info(const char *, ...);
137void error(const char *, ...);
138void fatal(const char *, ...);
139
140/* parse.c */
141int parse(const char *);
142
143/* statistics.c */
144void statistics_start(void);
145#else
146# define DPRINTF Log2
147int dnsproxy_init(PNATState pData);
148void dnsproxy_query(PNATState pData, struct socket *so, struct mbuf *m, int iphlen);
149void dnsproxy_answer(PNATState pData, struct socket *so, struct mbuf *m);
150#endif
151
152#endif /* _DNSPROXY_H_ */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette