ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/AnyEvent/lib/AnyEvent/DNS.pm
(Generate patch)

Comparing AnyEvent/lib/AnyEvent/DNS.pm (file contents):
Revision 1.70 by root, Tue Jul 15 11:44:08 2008 UTC vs.
Revision 1.92 by root, Sun Jun 7 16:48:38 2009 UTC

35 35
36use AnyEvent (); 36use AnyEvent ();
37use AnyEvent::Handle (); 37use AnyEvent::Handle ();
38use AnyEvent::Util qw(AF_INET6); 38use AnyEvent::Util qw(AF_INET6);
39 39
40our $VERSION = 4.160; 40our $VERSION = 4.411;
41 41
42our @DNS_FALLBACK = (v208.67.220.220, v208.67.222.222); 42our @DNS_FALLBACK = (v208.67.220.220, v208.67.222.222);
43 43
44=item AnyEvent::DNS::a $domain, $cb->(@addrs) 44=item AnyEvent::DNS::a $domain, $cb->(@addrs)
45 45
352 mx => 15, 352 mx => 15,
353 txt => 16, 353 txt => 16,
354 aaaa => 28, 354 aaaa => 28,
355 srv => 33, 355 srv => 33,
356 naptr => 35, # rfc2915 356 naptr => 35, # rfc2915
357 dname => 39, # rfc2672
357 opt => 41, 358 opt => 41,
358 spf => 99, 359 spf => 99,
359 tkey => 249, 360 tkey => 249,
360 tsig => 250, 361 tsig => 250,
361 ixfr => 251, 362 ixfr => 251,
511 # requires perl 5.10, sorry 512 # requires perl 5.10, sorry
512 my ($order, $preference, $flags, $service, $regexp, $offset) = unpack "nn C/a* C/a* C/a* .", $_; 513 my ($order, $preference, $flags, $service, $regexp, $offset) = unpack "nn C/a* C/a* C/a* .", $_;
513 local $ofs = $ofs + $offset - length; 514 local $ofs = $ofs + $offset - length;
514 ($order, $preference, $flags, $service, $regexp, _dec_name) 515 ($order, $preference, $flags, $service, $regexp, _dec_name)
515 }, 516 },
517 39 => sub { local $ofs = $ofs - length; _dec_name }, # dname
516 99 => sub { unpack "(C/a*)*", $_ }, # spf 518 99 => sub { unpack "(C/a*)*", $_ }, # spf
517); 519);
518 520
519sub _dec_rr { 521sub _dec_rr {
520 my $name = _dec_name; 522 my $name = _dec_name;
1116 1118
1117 push @{ $self->{queue} }, [dns_pack $req, $cb]; 1119 push @{ $self->{queue} }, [dns_pack $req, $cb];
1118 $self->_scheduler; 1120 $self->_scheduler;
1119} 1121}
1120 1122
1121=item $resolver->resolve ($qname, $qtype, %options, $cb->($rcode, @rr)) 1123=item $resolver->resolve ($qname, $qtype, %options, $cb->(@rr))
1122 1124
1123Queries the DNS for the given domain name C<$qname> of type C<$qtype>. 1125Queries the DNS for the given domain name C<$qname> of type C<$qtype>.
1124 1126
1125A C<$qtype> is either a numerical query type (e.g. C<1> for A records) or 1127A C<$qtype> is either a numerical query type (e.g. C<1> for A records) or
1126a lowercase name (you have to look at the source to see which aliases are 1128a lowercase name (you have to look at the source to see which aliases are
1131The callback will be invoked with a list of matching result records or 1133The callback will be invoked with a list of matching result records or
1132none on any error or if the name could not be found. 1134none on any error or if the name could not be found.
1133 1135
1134CNAME chains (although illegal) are followed up to a length of 10. 1136CNAME chains (although illegal) are followed up to a length of 10.
1135 1137
1136The callback will be invoked with an result code in string form (noerror, 1138The callback will be invoked with arraryefs of the form C<[$name, $type,
1137formerr, servfail, nxdomain, notimp, refused and so on), or numerical 1139$class, @data>], where C<$name> is the domain name, C<$type> a type string
1138form if the result code is not supported. The remaining arguments are 1140or number, C<$class> a class name and @data is resource-record-dependent
1139arraryefs of the form C<[$name, $type, $class, @data>], where C<$name> is 1141data. For C<a> records, this will be the textual IPv4 addresses, for C<ns>
1140the domain name, C<$type> a type string or number, C<$class> a class name 1142or C<cname> records this will be a domain name, for C<txt> records these
1141and @data is resource-record-dependent data. For C<a> records, this will 1143are all the strings and so on.
1142be the textual IPv4 addresses, for C<ns> or C<cname> records this will be
1143a domain name, for C<txt> records these are all the strings and so on.
1144 1144
1145All types mentioned in RFC 1035, C<aaaa>, C<srv>, C<naptr> and C<spf> are 1145All types mentioned in RFC 1035, C<aaaa>, C<srv>, C<naptr> and C<spf> are
1146decoded. All resource records not known to this module will have 1146decoded. All resource records not known to this module will have
1147the raw C<rdata> field as fourth entry. 1147the raw C<rdata> field as fourth entry.
1148 1148

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines