1 |
root |
1.1 |
=head1 NAME |
2 |
|
|
|
3 |
|
|
EV::DNS - perl interface to libevent's evdns module |
4 |
|
|
|
5 |
|
|
=head1 SYNOPSIS |
6 |
|
|
|
7 |
|
|
use EV::DNS; |
8 |
|
|
|
9 |
|
|
EV::DNS::resolve_reverse +(Socket::inet_aton "129.13.162.95"), 0, sub { |
10 |
|
|
my ($result, $type, $ttl, @ptrs) = @_; |
11 |
|
|
warn "resolves to @ptrs"; |
12 |
|
|
}; |
13 |
|
|
|
14 |
|
|
EV::DNS::resolve_ipv4 "www.goof.com", 0, sub { |
15 |
|
|
my ($result, $type, $ttl, @ptrs) = @_; |
16 |
|
|
warn "resolves to " . Socket::inet_ntoa $ptrs[0] |
17 |
|
|
if @ptrs; |
18 |
|
|
}; |
19 |
|
|
|
20 |
|
|
=head1 DESCRIPTION |
21 |
|
|
|
22 |
|
|
This module provides an interface to libevent's evdns module, see |
23 |
|
|
(L<http://monkey.org/~provos/libevent/>). |
24 |
|
|
|
25 |
|
|
=cut |
26 |
|
|
|
27 |
|
|
package EV::DNS; |
28 |
|
|
|
29 |
|
|
use strict; |
30 |
|
|
|
31 |
|
|
use EV; |
32 |
|
|
|
33 |
|
|
=head1 FUNCTIONAL INTERFACE |
34 |
|
|
|
35 |
root |
1.2 |
TODO |
36 |
|
|
|
37 |
root |
1.1 |
=over 4 |
38 |
|
|
|
39 |
root |
1.4 |
=item EV::DNS::init |
40 |
|
|
|
41 |
|
|
Called automatically when the module is firts used. Uses resolv.conf |
42 |
|
|
and/or some obscure win32 ibterface to initialise the nameservers and |
43 |
|
|
other parameters. |
44 |
|
|
|
45 |
|
|
=item EV::DNS::shutdown $fail_requests = 1 |
46 |
|
|
|
47 |
|
|
Shuts the DNS client down. |
48 |
|
|
|
49 |
|
|
=item $str = EV::DNS::err_to_string $errnum |
50 |
|
|
|
51 |
|
|
=item EV::DNS::nameserver_add $adress_as_unteger |
52 |
|
|
|
53 |
|
|
Use unpack "N", Socket::inet_aton "address". |
54 |
|
|
|
55 |
|
|
=item $count = EV::DNS::count_nameservers |
56 |
|
|
|
57 |
|
|
=item int EV::DNS::clear_nameservers_and_suspend |
58 |
|
|
|
59 |
|
|
=item int EV::DNS::resume |
60 |
|
|
|
61 |
|
|
=item int EV::DNS::nameserver_ip_add $address |
62 |
|
|
|
63 |
|
|
=item int EV::DNS::resolve_ipv4 $hostname, $flags, $cb->($result, $type, $ttl, @addrs); |
64 |
|
|
|
65 |
|
|
=item int EV::DNS::resolve_ipv6 $hostname, $flags, $cb->($result, $type, $ttl, @addrs); |
66 |
|
|
|
67 |
|
|
resolve ipv6 crashes your program in libevent versions up and including at leats 1.3e. |
68 |
|
|
|
69 |
|
|
=item int EV::DNS::resolve_reverse $4_or_6_bytes, $flagsm $cb->($result, $type, $ttl, @domains) |
70 |
|
|
|
71 |
|
|
=item int EV::DNS::set_option $optionname, $value, $flags |
72 |
|
|
|
73 |
|
|
EV::DNS::set_option "ndots:", "4" |
74 |
|
|
|
75 |
|
|
=item int EV::DNS::resolv_conf_parse $flags, $filename |
76 |
|
|
|
77 |
|
|
=item int EV::DNS::config_windows_nameservers |
78 |
|
|
|
79 |
|
|
=item EV::DNS::search_clear |
80 |
|
|
|
81 |
|
|
=item EV::DNS::search_add $domain |
82 |
|
|
|
83 |
|
|
=item EV::DNS::search_ndots_set $ndots |
84 |
|
|
|
85 |
root |
1.1 |
=back |
86 |
|
|
|
87 |
|
|
=cut |
88 |
|
|
|
89 |
|
|
init; |
90 |
|
|
|
91 |
|
|
1; |
92 |
|
|
|
93 |
root |
1.2 |
=head1 SEE ALSO |
94 |
|
|
|
95 |
root |
1.1 |
=head1 AUTHOR |
96 |
|
|
|
97 |
|
|
Marc Lehmann <schmorp@schmorp.de> |
98 |
|
|
http://home.schmorp.de/ |
99 |
|
|
|
100 |
|
|
=cut |
101 |
|
|
|