Skip to content

Commit ea52d9f

Browse files
committed
improved nroff mdoc for the man page
svn:r241
1 parent 152f570 commit ea52d9f

File tree

2 files changed

+124
-98
lines changed

2 files changed

+124
-98
lines changed

evdns.3

Lines changed: 124 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,19 @@ numbers should be unpredictable for spoofing reasons. There are
105105
three methods for generating them here and you must define exactly
106106
one of them. In increasing order of preference:
107107
.Pp
108-
DNS_USE_GETTIMEOFDAY_FOR_ID:
109-
Using the bottom 16 bits of the usec result from gettimeofday. This
110-
is a pretty poor solution but should work anywhere.
111-
DNS_USE_CPU_CLOCK_FOR_ID:
112-
Using the bottom 16 bits of the nsec result from the CPU's time
113-
counter. This is better, but may not work everywhere. Requires
114-
POSIX realtime support and you'll need to link against -lrt on
115-
glibc systems at least.
116-
DNS_USE_OPENSSL_FOR_ID:
117-
Uses the OpenSSL RAND_bytes call to generate the data. You must
118-
have seeded the pool before making any calls to this library.
108+
.Bl -tag -width "DNS_USE_GETTIMEOFDAY_FOR_ID" -compact -offset indent
109+
.It DNS_USE_GETTIMEOFDAY_FOR_ID
110+
Using the bottom 16 bits of the usec result from gettimeofday. This
111+
is a pretty poor solution but should work anywhere.
112+
.It DNS_USE_CPU_CLOCK_FOR_ID
113+
Using the bottom 16 bits of the nsec result from the CPU's time
114+
counter. This is better, but may not work everywhere. Requires
115+
POSIX realtime support and you'll need to link against -lrt on
116+
glibc systems at least.
117+
.It DNS_USE_OPENSSL_FOR_ID
118+
Uses the OpenSSL RAND_bytes call to generate the data. You must
119+
have seeded the pool before making any calls to this library.
120+
.El
119121
.Pp
120122
The library keeps track of the state of nameservers and will avoid
121123
them when they go down. Otherwise it will round robin between them.
@@ -148,13 +150,29 @@ evdns_resolve. Searching can also drastically slow down the resolution
148150
of names.
149151
.Pp
150152
To disable searching:
151-
1. Never set it up. If you never call evdns_resolv_conf_parse or
152-
evdns_search_add then no searching will occur.
153-
.Pp
154-
2. If you do call evdns_resolv_conf_parse then don't pass
155-
DNS_OPTION_SEARCH (or DNS_OPTIONS_ALL, which implies it).
156-
.Pp
157-
3. When calling evdns_resolve, pass the DNS_QUERY_NO_SEARCH flag.
153+
.Bl -enum -compact -offset indent
154+
.It
155+
Never set it up. If you never call
156+
.Fn evdns_resolv_conf_parse,
157+
.Fn evdns_init,
158+
or
159+
.Fn evdns_search_add
160+
then no searching will occur.
161+
.It
162+
If you do call
163+
.Fn evdns_resolv_conf_parse
164+
then don't pass
165+
.Va DNS_OPTION_SEARCH
166+
(or
167+
.Va DNS_OPTIONS_ALL,
168+
which implies it).
169+
.It
170+
When calling
171+
.Fn evdns_resolve,
172+
pass the
173+
.Va DNS_QUERY_NO_SEARCH
174+
flag.
175+
.El
158176
.Pp
159177
The order of searches depends on the number of dots in the name. If the
160178
number is greater than the ndots setting then the names is first tried
@@ -171,86 +189,95 @@ For example, with ndots set to 1 (the default) and a search domain list of
171189
Query: www.abc
172190
Order: www.abc., www.abc.myhome.net
173191
.Pp
174-
API reference:
175-
.Pp
176-
int evdns_nameserver_add(unsigned long int address)
177-
Add a nameserver. The address should be an IP address in
178-
network byte order. The type of address is chosen so that
179-
it matches in_addr.s_addr.
180-
Returns non-zero on error.
181-
.Pp
182-
int evdns_nameserver_ip_add(const char *ip_as_string)
183-
This wraps the above function by parsing a string as an IP
184-
address and adds it as a nameserver.
185-
Returns non-zero on error
186-
.Pp
187-
int evdns_resolve(const char *name, int flags,
188-
evdns_callback_type callback,
189-
void *ptr)
190-
Resolve a name. The name parameter should be a DNS name.
191-
The flags parameter should be 0, or DNS_QUERY_NO_SEARCH
192-
which disables searching for this query. (see defn of
193-
searching above).
194-
.Pp
195-
The callback argument is a function which is called when
196-
this query completes and ptr is an argument which is passed
197-
to that callback function.
198-
.Pp
199-
Returns non-zero on error
200-
.Pp
201-
void evdns_search_clear()
202-
Clears the list of search domains
203-
.Pp
204-
void evdns_search_add(const char *domain)
205-
Add a domain to the list of search domains
206-
.Pp
207-
void evdns_search_ndots_set(int ndots)
208-
Set the number of dots which, when found in a name, causes
209-
the first query to be without any search domain.
210-
.Pp
211-
int evdns_count_nameservers(void)
212-
Return the number of configured nameservers (not necessarily the
213-
number of running nameservers). This is useful for double-checking
214-
whether our calls to the various nameserver configuration functions
215-
have been successful.
216-
.Pp
217-
int evdns_clear_nameservers_and_suspend(void)
218-
Remove all currently configured nameservers, and suspend all pending
219-
resolves. Resolves will not necessarily be re-attempted until
220-
evdns_resume() is called.
221-
.Pp
222-
int evdns_resume(void)
223-
Re-attempt resolves left in limbo after an earlier call to
224-
evdns_clear_nameservers_and_suspend().
225-
.Pp
226-
int evdns_config_windows_nameservers(void)
227-
Attempt to configure a set of nameservers based on platform settings on
228-
a win32 host. Preferentially tries to use GetNetworkParams; if that fails,
229-
looks in the registry. Returns 0 on success, nonzero on failure.
230-
.Pp
231-
int evdns_resolv_conf_parse(int flags, const char *filename)
232-
Parse a resolv.conf like file from the given filename.
233-
.Pp
234-
See the man page for resolv.conf for the format of this file.
235-
The flags argument determines what information is parsed from
236-
this file:
237-
DNS_OPTION_SEARCH - domain, search and ndots options
238-
DNS_OPTION_NAMESERVERS - nameserver lines
239-
DNS_OPTION_MISC - timeout and attempts options
240-
DNS_OPTIONS_ALL - all of the above
241-
The following directives are not parsed from the file:
242-
sortlist, rotate, no-check-names, inet6, debug
243-
.Pp
244-
Returns non-zero on error:
245-
0 no errors
246-
1 failed to open file
247-
2 failed to stat file
248-
3 file too large
249-
4 out of memory
250-
5 short read from file
251-
.Pp
252-
Internals:
192+
.Sh API reference
253193
.Pp
194+
.Bl -tag -width 0123456
195+
.It Ft int Fn evdns_init
196+
Initializes support for non-blocking name resolution by calling
197+
.Fn evdns_resolv_conf_parse
198+
on UNIX and
199+
.Fn evdns_config_windows_nameservers
200+
on Windows.
201+
.It Ft int Fn evdns_nameserver_add "unsigned long int address"
202+
Add a nameserver. The address should be an IP address in
203+
network byte order. The type of address is chosen so that
204+
it matches in_addr.s_addr.
205+
Returns non-zero on error.
206+
.It Ft int Fn evdns_nameserver_ip_add "const char *ip_as_string"
207+
This wraps the above function by parsing a string as an IP
208+
address and adds it as a nameserver.
209+
Returns non-zero on error
210+
.It Ft int Fn evdns_resolve "const char *name" "int flags" "evdns_callback_type callback" "void *ptr"
211+
Resolve a name. The name parameter should be a DNS name.
212+
The flags parameter should be 0, or DNS_QUERY_NO_SEARCH
213+
which disables searching for this query. (see defn of
214+
searching above).
215+
.Pp
216+
The callback argument is a function which is called when
217+
this query completes and ptr is an argument which is passed
218+
to that callback function.
219+
.Pp
220+
Returns non-zero on error
221+
.It Ft void Fn evdns_search_clear
222+
Clears the list of search domains
223+
.It Ft void Fn evdns_search_add "const char *domain"
224+
Add a domain to the list of search domains
225+
.It Ft void Fn evdns_search_ndots_set "int ndots"
226+
Set the number of dots which, when found in a name, causes
227+
the first query to be without any search domain.
228+
.It Ft int Fn evdns_count_nameservers "void"
229+
Return the number of configured nameservers (not necessarily the
230+
number of running nameservers). This is useful for double-checking
231+
whether our calls to the various nameserver configuration functions
232+
have been successful.
233+
.It Ft int Fn evdns_clear_nameservers_and_suspend "void"
234+
Remove all currently configured nameservers, and suspend all pending
235+
resolves. Resolves will not necessarily be re-attempted until
236+
evdns_resume() is called.
237+
.It Ft int Fn evdns_resume "void"
238+
Re-attempt resolves left in limbo after an earlier call to
239+
evdns_clear_nameservers_and_suspend().
240+
.It Ft int Fn evdns_config_windows_nameservers "void"
241+
Attempt to configure a set of nameservers based on platform settings on
242+
a win32 host. Preferentially tries to use GetNetworkParams; if that fails,
243+
looks in the registry. Returns 0 on success, nonzero on failure.
244+
.It Ft int Fn evdns_resolv_conf_parse "int flags" "const char *filename"
245+
Parse a resolv.conf like file from the given filename.
246+
.Pp
247+
See the man page for resolv.conf for the format of this file.
248+
The flags argument determines what information is parsed from
249+
this file:
250+
.Bl -tag -width "DNS_OPTION_NAMESERVERS" -offset indent -compact -nested
251+
.It DNS_OPTION_SEARCH
252+
domain, search and ndots options
253+
.It DNS_OPTION_NAMESERVERS
254+
nameserver lines
255+
.It DNS_OPTION_MISC
256+
timeout and attempts options
257+
.It DNS_OPTIONS_ALL
258+
all of the above
259+
.El
260+
.Pp
261+
The following directives are not parsed from the file:
262+
sortlist, rotate, no-check-names, inet6, debug
263+
.Pp
264+
Returns non-zero on error:
265+
.Bl -tag -width "0" -offset indent -compact -nested
266+
.It 0
267+
no errors
268+
.It 1
269+
failed to open file
270+
.It 2
271+
failed to stat file
272+
.It 3
273+
file too large
274+
.It 4
275+
out of memory
276+
.It 5
277+
short read from file
278+
.El
279+
.El
280+
.Sh Internals:
254281
Requests are kept in two queues. The first is the inflight queue. In
255282
this queue requests have an allocated transaction id and nameserver.
256283
They will soon be transmitted if they haven't already been.

evdns.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
*/
4949

5050
/*
51-
*
5251
* Welcome, gentle reader
5352
*
5453
* Async DNS lookups are really a whole lot harder than they should be,

0 commit comments

Comments
 (0)