summaryrefslogtreecommitdiff
path: root/docs/man/man3/DNS.3
blob: cb54283c918583b215a24a0eb96670e7a79b6b83 (plain)
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
.TH "DNS" 3 "7 May 2005" "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 (std::string 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 (std::string 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 (std::string 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 "std::string \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 "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 (std::string 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 \fBfd\fP)"
.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 \fBfd\fP, 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 \fBfd\fP)"
.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 "int \fBt\fP"
.br
.ti -1c
.RI "unsigned int \fBfd\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. 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 (std::string dnsserver)"
.PP
This constructor accepts a dns server address. The address must be in dotted decimal form, e.g. 1.2.3.4.
.SS "DNS::~\fBDNS\fP ()"
.PP
The destructor frees all used structures. 
.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 (std::string host)"
.PP
This method will start the forward lookup of a hostname, e.g. 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. the dns server not responding.
.SS "std::string 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. 
.SS "bool DNS::HasResult ()"
.PP
This method will return true when the lookup is completed. It uses poll internally to determine the status of the socket.
.SS "bool DNS::ReverseLookup (std::string ip)"
.PP
This method will start the reverse lookup of an ip given in dotted decimal format, e.g. 1.2.3.4, and returns true if the lookup was successfully initiated.
.SS "void DNS::SetNS (std::string 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 "unsigned int \fBDNS::fd\fP\fC [private]\fP"
.PP
Definition at line 42 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 40 of file dns.h.

.SH "Author"
.PP 
Generated automatically by Doxygen for InspIRCd from the source code.