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