]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - docs/man/man3/DNS.3
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@2578 e03df62e-2008...
[user/henk/code/inspircd.git] / docs / man / man3 / DNS.3
1 .TH "DNS" 3 "19 Dec 2005" "Version 1.0Betareleases" "InspIRCd" \" -*- nroff -*-
2 .ad l
3 .nh
4 .SH NAME
5 DNS \- The DNS class allows fast nonblocking resolution of hostnames and ip addresses.  
6
7 .PP
8 .SH SYNOPSIS
9 .br
10 .PP
11 \fC#include <dns.h>\fP
12 .PP
13 .SS "Public Member Functions"
14
15 .in +1c
16 .ti -1c
17 .RI "\fBDNS\fP ()"
18 .br
19 .RI "\fIThe default constructor uses dns addresses read from /etc/resolv.conf. \fP"
20 .ti -1c
21 .RI "\fBDNS\fP (\fBstd::string\fP dnsserver)"
22 .br
23 .RI "\fIThis constructor accepts a dns server address. \fP"
24 .ti -1c
25 .RI "\fB~DNS\fP ()"
26 .br
27 .RI "\fIThe destructor frees all used structures. \fP"
28 .ti -1c
29 .RI "bool \fBReverseLookup\fP (\fBstd::string\fP ip)"
30 .br
31 .RI "\fIThis method will start the reverse lookup of an ip given in dotted decimal format, e.g. \fP"
32 .ti -1c
33 .RI "bool \fBForwardLookup\fP (\fBstd::string\fP host)"
34 .br
35 .RI "\fIThis method will start the forward lookup of a hostname, e.g. \fP"
36 .ti -1c
37 .RI "bool \fBHasResult\fP ()"
38 .br
39 .RI "\fIThis method will return true when the lookup is completed. \fP"
40 .ti -1c
41 .RI "bool \fBHasResult\fP (int fd)"
42 .br
43 .RI "\fIThis method will return true if the lookup's fd matches the one provided. \fP"
44 .ti -1c
45 .RI "\fBstd::string\fP \fBGetResult\fP ()"
46 .br
47 .RI "\fIThis method returns the result of your query as a string, depending upon wether you called \fBDNS::ReverseLookup()\fP or \fBDNS::ForwardLookup\fP. \fP"
48 .ti -1c
49 .RI "\fBstd::string\fP \fBGetResultIP\fP ()"
50 .br
51 .ti -1c
52 .RI "int \fBGetFD\fP ()"
53 .br
54 .RI "\fIThis method returns the file handle used by the dns query socket or zero if the query is invalid for some reason, e.g. \fP"
55 .ti -1c
56 .RI "void \fBSetNS\fP (\fBstd::string\fP dnsserver)"
57 .br
58 .in -1c
59 .SS "Private Member Functions"
60
61 .in +1c
62 .ti -1c
63 .RI "void \fBdns_init\fP ()"
64 .br
65 .ti -1c
66 .RI "void \fBdns_init_2\fP (const char *dnsserver)"
67 .br
68 .ti -1c
69 .RI "in_addr * \fBdns_aton4\fP (const char *const ipstring)"
70 .br
71 .ti -1c
72 .RI "char * \fBdns_ntoa4\fP (const in_addr *const ip)"
73 .br
74 .ti -1c
75 .RI "int \fBdns_getip4\fP (const char *const name)"
76 .br
77 .ti -1c
78 .RI "int \fBdns_getip4list\fP (const char *const name)"
79 .br
80 .ti -1c
81 .RI "int \fBdns_getname4\fP (const in_addr *const ip)"
82 .br
83 .ti -1c
84 .RI "char * \fBdns_getresult\fP (const int fd)"
85 .br
86 .ti -1c
87 .RI "in_addr * \fBdns_aton4_s\fP (const char *const ipstring, in_addr *const ip)"
88 .br
89 .ti -1c
90 .RI "char * \fBdns_ntoa4_s\fP (const in_addr *const ip, char *const \fBresult\fP)"
91 .br
92 .ti -1c
93 .RI "char * \fBdns_getresult_s\fP (const int fd, char *const \fBresult\fP)"
94 .br
95 .ti -1c
96 .RI "in_addr * \fBdns_aton4_r\fP (const char *const ipstring)"
97 .br
98 .ti -1c
99 .RI "char * \fBdns_ntoa4_r\fP (const in_addr *const ip)"
100 .br
101 .ti -1c
102 .RI "char * \fBdns_getresult_r\fP (const int fd)"
103 .br
104 .in -1c
105 .SS "Private Attributes"
106
107 .in +1c
108 .ti -1c
109 .RI "in_addr * \fBbinip\fP"
110 .br
111 .ti -1c
112 .RI "char * \fBresult\fP"
113 .br
114 .ti -1c
115 .RI "char \fBlocalbuf\fP [1024]"
116 .br
117 .ti -1c
118 .RI "int \fBt\fP"
119 .br
120 .ti -1c
121 .RI "int \fBmyfd\fP"
122 .br
123 .in -1c
124 .SH "Detailed Description"
125 .PP 
126 The DNS class allows fast nonblocking resolution of hostnames and ip addresses. 
127
128 It is based heavily upon firedns by Ian Gulliver.
129 .PP
130 Definition at line 35 of file dns.h.
131 .SH "Constructor & Destructor Documentation"
132 .PP 
133 .SS "DNS::DNS ()"
134 .PP
135 The default constructor uses dns addresses read from /etc/resolv.conf. 
136 .PP
137 Please note that it will re-read /etc/resolv.conf for each copy of the class you instantiate, causing disk access and slow lookups if you create a lot of them. Consider passing the constructor a server address as a parameter instead.
138 .SS "DNS::DNS (\fBstd::string\fP dnsserver)"
139 .PP
140 This constructor accepts a dns server address. 
141 .PP
142 The address must be in dotted decimal form, e.g. 1.2.3.4.
143 .SS "DNS::~DNS ()"
144 .PP
145 The destructor frees all used structures. 
146 .PP
147 .SH "Member Function Documentation"
148 .PP 
149 .SS "in_addr* DNS::dns_aton4 (const char *const  ipstring)\fC [private]\fP"
150 .PP
151 .SS "in_addr* DNS::dns_aton4_r (const char *const  ipstring)\fC [private]\fP"
152 .PP
153 .SS "in_addr* DNS::dns_aton4_s (const char *const  ipstring, in_addr *const  ip)\fC [private]\fP"
154 .PP
155 .SS "int DNS::dns_getip4 (const char *const  name)\fC [private]\fP"
156 .PP
157 .SS "int DNS::dns_getip4list (const char *const  name)\fC [private]\fP"
158 .PP
159 .SS "int DNS::dns_getname4 (const in_addr *const  ip)\fC [private]\fP"
160 .PP
161 .SS "char* DNS::dns_getresult (const int fd)\fC [private]\fP"
162 .PP
163 .SS "char* DNS::dns_getresult_r (const int fd)\fC [private]\fP"
164 .PP
165 .SS "char* DNS::dns_getresult_s (const int fd, char *const  result)\fC [private]\fP"
166 .PP
167 .SS "void DNS::dns_init ()\fC [private]\fP"
168 .PP
169 .SS "void DNS::dns_init_2 (const char * dnsserver)\fC [private]\fP"
170 .PP
171 .SS "char* DNS::dns_ntoa4 (const in_addr *const  ip)\fC [private]\fP"
172 .PP
173 .SS "char* DNS::dns_ntoa4_r (const in_addr *const  ip)\fC [private]\fP"
174 .PP
175 .SS "char* DNS::dns_ntoa4_s (const in_addr *const  ip, char *const  result)\fC [private]\fP"
176 .PP
177 .SS "bool DNS::ForwardLookup (\fBstd::string\fP host)"
178 .PP
179 This method will start the forward lookup of a hostname, e.g. 
180 .PP
181 www.inspircd.org, and returns true if the lookup was successfully initiated.
182 .SS "int DNS::GetFD ()"
183 .PP
184 This method returns the file handle used by the dns query socket or zero if the query is invalid for some reason, e.g. 
185 .PP
186 the dns server not responding.
187 .SS "\fBstd::string\fP DNS::GetResult ()"
188 .PP
189 This method returns the result of your query as a string, depending upon wether you called \fBDNS::ReverseLookup()\fP or \fBDNS::ForwardLookup\fP. 
190 .PP
191 .SS "\fBstd::string\fP DNS::GetResultIP ()"
192 .PP
193 .SS "bool DNS::HasResult (int fd)"
194 .PP
195 This method will return true if the lookup's fd matches the one provided. 
196 .PP
197 .SS "bool DNS::HasResult ()"
198 .PP
199 This method will return true when the lookup is completed. 
200 .PP
201 It uses poll internally to determine the status of the socket.
202 .SS "bool DNS::ReverseLookup (\fBstd::string\fP ip)"
203 .PP
204 This method will start the reverse lookup of an ip given in dotted decimal format, e.g. 
205 .PP
206 1.2.3.4, and returns true if the lookup was successfully initiated.
207 .SS "void DNS::SetNS (\fBstd::string\fP dnsserver)"
208 .PP
209 .SH "Member Data Documentation"
210 .PP 
211 .SS "in_addr* \fBDNS::binip\fP\fC [private]\fP"
212 .PP
213 Definition at line 38 of file dns.h.
214 .SS "char \fBDNS::localbuf\fP[1024]\fC [private]\fP"
215 .PP
216 Definition at line 40 of file dns.h.
217 .SS "int \fBDNS::myfd\fP\fC [private]\fP"
218 .PP
219 Definition at line 43 of file dns.h.
220 .SS "char* \fBDNS::result\fP\fC [private]\fP"
221 .PP
222 Definition at line 39 of file dns.h.
223 .SS "int \fBDNS::t\fP\fC [private]\fP"
224 .PP
225 Definition at line 41 of file dns.h.
226
227 .SH "Author"
228 .PP 
229 Generated automatically by Doxygen for InspIRCd from the source code.