ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/EV/EV/DNS.pm
Revision: 1.4
Committed: Mon Oct 29 09:00:43 2007 UTC (16 years, 7 months ago) by root
Branch: MAIN
CVS Tags: rel-0_03
Changes since 1.3: +46 -1 lines
Log Message:
*** empty log message ***

File Contents

# Content
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 TODO
36
37 =over 4
38
39 =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 =back
86
87 =head1 BUGS
88
89 * At least up to version 1.3e of libevent, resolve_reverse_ipv6 will
90 always crash the program with an assertion failure.
91 * use'ing this module will keep events registered so the event loop
92 will never return unless loopexit is called.
93
94 =cut
95
96 init;
97
98 1;
99
100 =head1 SEE ALSO
101
102 =head1 AUTHOR
103
104 Marc Lehmann <schmorp@schmorp.de>
105 http://home.schmorp.de/
106
107 =cut
108