1 |
/* |
2 |
firedns.h - firedns library declarations |
3 |
Copyright (C) 2002 Ian Gulliver |
4 |
|
5 |
This file has been edited for use in BOPM - see the real library at |
6 |
http://ares.penguinhosting.net/~ian/ before you judge firedns based |
7 |
on this.. |
8 |
|
9 |
This program is free software; you can redistribute it and/or modify |
10 |
it under the terms of version 2 of the GNU General Public License as |
11 |
published by the Free Software Foundation. |
12 |
|
13 |
This program is distributed in the hope that it will be useful, |
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 |
GNU General Public License for more details. |
17 |
|
18 |
You should have received a copy of the GNU General Public License |
19 |
along with this program; if not, write to the Free Software |
20 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
21 |
*/ |
22 |
|
23 |
#ifndef _FIREDNS_H |
24 |
#define _FIREDNS_H |
25 |
|
26 |
/* max number of nameservers used */ |
27 |
#define FDNS_MAX 8 |
28 |
/* preferred firedns config file */ |
29 |
#define FDNS_CONFIG_PREF HOPM_ETCDIR "/firedns.conf" |
30 |
/* fallback config file */ |
31 |
#define FDNS_CONFIG_FBCK "/etc/resolv.conf" |
32 |
/* Number of seconds to wait for a reply */ |
33 |
#define FDNS_TIMEOUT 5 |
34 |
/* DNS well known port */ |
35 |
#define FDNS_PORT 53 |
36 |
/* name to IPv4 address */ |
37 |
#define FDNS_QRY_A 1 |
38 |
/* name to IPv6 address */ |
39 |
#define FDNS_QRY_AAAA 28 |
40 |
|
41 |
/* Success */ |
42 |
#define FDNS_ERR_NONE 0 |
43 |
/* Format error */ |
44 |
#define FDNS_ERR_FORMAT 1 |
45 |
/* Server failure */ |
46 |
#define FDNS_ERR_SERVFAIL 2 |
47 |
/* Name error */ |
48 |
#define FDNS_ERR_NXDOMAIN 3 |
49 |
/* Not implemented */ |
50 |
#define FDNS_ERR_NOIMPT 4 |
51 |
/* Refused */ |
52 |
#define FDNS_ERR_REFUSED 5 |
53 |
|
54 |
/* Local error codes */ |
55 |
|
56 |
/* Timeout */ |
57 |
#define FDNS_ERR_TIMEOUT 6 |
58 |
/* Network error */ |
59 |
#define FDNS_ERR_NETWORK 7 |
60 |
/* FD Limit reached */ |
61 |
#define FDNS_ERR_FDLIMIT 8 |
62 |
/* Other error */ |
63 |
#define FDNS_ERR_OTHER 9 |
64 |
|
65 |
/* Used with the above error values */ |
66 |
extern int firedns_errno; |
67 |
|
68 |
struct firedns_result |
69 |
{ |
70 |
char text[1024]; |
71 |
char lookup[256]; |
72 |
void *info; |
73 |
}; |
74 |
|
75 |
/* non-blocking functions */ |
76 |
extern int firedns_getip(int type, const char * const name, void *info); |
77 |
extern struct firedns_result *firedns_getresult(const int fd); |
78 |
|
79 |
/* low-timeout blocking functions */ |
80 |
extern char *firedns_resolveip(int type, const char * const name); |
81 |
extern struct in_addr *firedns_resolveip4(const char * const name); |
82 |
extern struct in6_addr *firedns_resolveip6(const char * const name); |
83 |
|
84 |
extern void firedns_init(void); |
85 |
extern void firedns_cycle(void); |
86 |
extern const char *firedns_strerror(int); |
87 |
|
88 |
#endif |