ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/EV-ADNS/ADNS.pm
(Generate patch)

Comparing EV-ADNS/ADNS.pm (file contents):
Revision 1.13 by root, Tue Jun 30 20:40:48 2015 UTC vs.
Revision 1.14 by root, Fri Oct 16 22:58:35 2015 UTC

5=head1 SYNOPSIS 5=head1 SYNOPSIS
6 6
7 use EV; 7 use EV;
8 use EV::ADNS; 8 use EV::ADNS;
9 9
10 EV::ADNS::submit "example.com", EV::ADNS::r_addr, 0, sub { 10 EV::ADNS::submit "example.com", EV::ADNS::r_addr, EV::ADNS::qf_cname_loose, sub {
11 my ($status, $expires, @a) = @_; 11 my ($status, $expires, @a) = @_;
12 warn $a[0]; # "127.13.166.3" etc. 12 warn $a[0]; # "127.13.166.3" etc.
13 }; 13 };
14 14
15 EV::loop; 15 EV::run;
16 16
17=head1 DESCRIPTION 17=head1 DESCRIPTION
18 18
19This is a simple interface to libadns (asynchronous dns) that 19This is a simple interface to libadns (asynchronous dns) that
20integrates well and automatically into the EV event loop. The 20integrates well and automatically into the EV event loop. The
26not do anything (except run an EV event loop). 26not do anything (except run an EV event loop).
27 27
28=head1 OVERVIEW 28=head1 OVERVIEW
29 29
30All the constants/enums from F<adns.h> are available in the EV::ADNS 30All the constants/enums from F<adns.h> are available in the EV::ADNS
31namespace, without the C<adns_> prefix, e.g. C<adns_r_a> becomes 31namespace, without the C<adns_> prefix, i.e. C<adns_r_a> becomes
32C<EV::ADNS::r_a>, C<adns__qtf_deref> becomes C<EV::ADNS::_qtf_deref> and 32C<EV::ADNS::r_a> and so on.
33so on.
34 33
35=head1 FUNCTIONS 34=head1 FUNCTIONS
36 35
37=over 4 36=over 4
38 37
39=item $query = EV::ADNS::submit "domain", $rrtype, $flags, $cb 38=item $query = EV::ADNS::submit "domain", $rrtype, $flags, $cb
40 39
41Submits a new request to be handled. See the C<adns_submit> C function 40Submits a new request to be handled. See the C<adns_submit> C function
42description for more details. The function optionally returns a query 41description for more details. The function optionally returns a query
43object which can be used to cancel an in-progress request. You do not need 42object which can be used to cancel an in-progress request. You do not need
44to store the query object, even if you ignore it the query will proceed. 43to store the query object, even if you ignore it, the query will proceed.
45 44
46The callback will be invoked with a result status, the time the resource 45The callback will be invoked with a result status, the time the resource
47record validity expires and zero or more resource records, one scalar per 46record validity expires and zero or more resource records, one scalar per
48result record. Example: 47result record. Example:
49 48
75 74
76=item EV::ADNS::r_ns 75=item EV::ADNS::r_ns
77 76
78A "host address", a hostname with any number of addresses (hint records). 77A "host address", a hostname with any number of addresses (hint records).
79 78
80Currently only the hostname will be stored, so this is alway an arrayref 79The record will be an arrayref with domainname, adns status and any number
81with a single element of the hostname. Future versions might add 80of associated addresses: C<< ["domain", adns_status, addr...] >>.
82additional address entries.
83 81
84=item EV::ADNS::r_hinfo 82=item EV::ADNS::r_hinfo
85 83
86An arrayref consisting of the two strings. 84An arrayref consisting of the two strings.
87 85
92=item EV::ADNS::r_mx 90=item EV::ADNS::r_mx
93 91
94An arrayref consisting of the priority and a "host address" (see 92An arrayref consisting of the priority and a "host address" (see
95C<EV::ADNS::r_ns>). Example: 93C<EV::ADNS::r_ns>). Example:
96 94
97 [10, "mail10.example.com"] 95 [10, [["alt3.aspmx.l.google.com", 0, "64.233.189.27", "2404:6800:4008:c07::1a"]]]
98 96
99=item EV::ADNS::r_mx_raw 97=item EV::ADNS::r_mx_raw
100 98
101An arrayref consisting of the priority and the hostname, e.g. C<[10, 99An arrayref consisting of the priority and the hostname, e.g. C<[10,
102"mail.example.com"]>. 100"mail.example.com"]>.
133 131
134=item $query->cancel 132=item $query->cancel
135 133
136Cancels a request that is in progress. 134Cancels a request that is in progress.
137 135
136=item EV::ADNS::reinit undef, $resolvdata_or_undef
137
138Cancels all outstanding queries, frees all adns state and reinitialises
139it. It is highly recommended to only call this when there are no
140outstanding requests.
141
142The first argument must currently be specified as C<undef>.
143
144The second argument can be missing or C<undef>; in which case the normal
145initialisation is done (such as reading the F<resolv.conf>), or it might
146be a stirng, in which case no config files or environment variables will
147be read and the given string will be interpreted as the F<resolv.conf>
148contents.
149
138=back 150=back
139 151
140=cut 152=cut
141 153
142package EV::ADNS; 154package EV::ADNS;
143 155
144use Carp (); 156use Carp ();
145use EV (); 157use EV ();
146 158
147BEGIN { 159BEGIN {
148 $VERSION = 2.3; 160 $VERSION = '3.0';
149 161
150 require XSLoader; 162 require XSLoader;
151 XSLoader::load (EV::ADNS, $VERSION); 163 XSLoader::load (EV::ADNS, $VERSION);
152} 164}
153 165

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines