/[svn]/hopm/trunk/src/firedns.h
ViewVC logotype

Annotation of /hopm/trunk/src/firedns.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5135 - (hide annotations)
Thu Dec 25 18:51:51 2014 UTC (5 years, 6 months ago) by michael
File MIME type: text/x-csrc
File size: 2698 byte(s)
- propset svn:eol-style native

1 michael 5052 /*
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     #include <sys/types.h>
27     #include <sys/socket.h>
28     #include <netinet/in.h>
29    
30     #ifndef AF_INET6
31     struct in6_addr {
32     unsigned char s6_addr[16];
33     };
34     #endif
35    
36     /* max number of nameservers used */
37     #define FDNS_MAX 8
38     /* preferred firedns config file */
39 michael 5069 #define FDNS_CONFIG_PREF HOPM_ETCDIR "/firedns.conf"
40 michael 5052 /* fallback config file */
41     #define FDNS_CONFIG_FBCK "/etc/resolv.conf"
42     /* Number of seconds to wait for a reply */
43     #define FDNS_TIMEOUT 5
44     /* DNS well known port */
45     #define FDNS_PORT 53
46     /* name to IPv4 address */
47     #define FDNS_QRY_A 1
48     /* name to IPv6 address */
49     #define FDNS_QRY_AAAA 28
50    
51     /* Success */
52     #define FDNS_ERR_NONE 0
53     /* Format error */
54     #define FDNS_ERR_FORMAT 1
55     /* Server failure */
56     #define FDNS_ERR_SERVFAIL 2
57     /* Name error */
58     #define FDNS_ERR_NXDOMAIN 3
59     /* Not implemented */
60     #define FDNS_ERR_NOIMPT 4
61     /* Refused */
62     #define FDNS_ERR_REFUSED 5
63    
64     /* Local error codes */
65    
66     /* Timeout */
67     #define FDNS_ERR_TIMEOUT 6
68     /* Network error */
69     #define FDNS_ERR_NETWORK 7
70     /* FD Limit reached */
71     #define FDNS_ERR_FDLIMIT 8
72     /* Other error */
73     #define FDNS_ERR_OTHER 9
74    
75     /* Used with the above error values */
76     extern int fdns_errno;
77     extern unsigned int fdns_fdinuse;
78    
79     void firedns_init(void);
80    
81     struct firedns_result {
82     char text[1024];
83     char lookup[256];
84     void *info;
85     };
86    
87     /* non-blocking functions */
88     int firedns_getip(int type, const char * const name, void *info);
89     struct firedns_result *firedns_getresult(const int fd);
90    
91     /* low-timeout blocking functions */
92     char *firedns_resolveip(int type, const char * const name);
93     struct in_addr *firedns_resolveip4(const char * const name);
94     struct in6_addr *firedns_resolveip6(const char * const name);
95    
96     void firedns_cycle(void);
97 michael 5072 extern const char *firedns_strerror(int);
98 michael 5052
99     #endif

Properties

Name Value
svn:eol-style native
svn:keywords Id

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28