.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Mail::SpamAssassin::DnsResolver 3pm" .TH Mail::SpamAssassin::DnsResolver 3pm "2017-05-06" "perl v5.20.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Mail::SpamAssassin::DnsResolver \- DNS resolution engine .SH "DESCRIPTION" .IX Header "DESCRIPTION" This is a \s-1DNS\s0 resolution engine for SpamAssassin, implemented in order to reduce file descriptor usage by Net::DNS and avoid a response collision bug in that module. .SH "METHODS" .IX Header "METHODS" .ie n .IP "$res\->\fIload_resolver()\fR" 4 .el .IP "\f(CW$res\fR\->\fIload_resolver()\fR" 4 .IX Item "$res->load_resolver()" Load the \f(CW\*(C`Net::DNS::Resolver\*(C'\fR object. Returns 0 if Net::DNS cannot be used, 1 if it is available. .ie n .IP "$resolver = $res\->\fIget_resolver()\fR" 4 .el .IP "\f(CW$resolver\fR = \f(CW$res\fR\->\fIget_resolver()\fR" 4 .IX Item "$resolver = $res->get_resolver()" Return the \f(CW\*(C`Net::DNS::Resolver\*(C'\fR object. .ie n .IP "$res\->\fIconfigured_nameservers()\fR" 4 .el .IP "\f(CW$res\fR\->\fIconfigured_nameservers()\fR" 4 .IX Item "$res->configured_nameservers()" Get a list of nameservers as configured by dns_server directives or as provided by Net::DNS, typically from /etc/resolv.conf .ie n .IP "$res\->\fIavailable_nameservers()\fR" 4 .el .IP "\f(CW$res\fR\->\fIavailable_nameservers()\fR" 4 .IX Item "$res->available_nameservers()" Get or set a list of currently available nameservers, which is typically a known-to-be-good subset of configured nameservers .ie n .IP "$res\->\fIconnect_sock()\fR" 4 .el .IP "\f(CW$res\fR\->\fIconnect_sock()\fR" 4 .IX Item "$res->connect_sock()" Re-connect to the first nameserver listed in \f(CW\*(C`/etc/resolv.conf\*(C'\fR or similar platform-dependent source, as provided by \f(CW\*(C`Net::DNS\*(C'\fR. .ie n .IP "$res\->\fIget_sock()\fR" 4 .el .IP "\f(CW$res\fR\->\fIget_sock()\fR" 4 .IX Item "$res->get_sock()" Return the \f(CW\*(C`IO::Socket::INET\*(C'\fR object used to communicate with the nameserver. .ie n .IP "$packet = new_dns_packet ($domain, $type, $class)" 4 .el .IP "\f(CW$packet\fR = new_dns_packet ($domain, \f(CW$type\fR, \f(CW$class\fR)" 4 .IX Item "$packet = new_dns_packet ($domain, $type, $class)" A wrapper for \f(CW\*(C`Net::DNS::Packet::new()\*(C'\fR which traps a die thrown by it. .Sp To use this, change calls to \f(CW\*(C`Net::DNS::Resolver::bgsend\*(C'\fR from: .Sp .Vb 1 \& $res\->bgsend($domain, $type); .Ve .Sp to: .Sp .Vb 1 \& $res\->bgsend(Mail::SpamAssassin::DnsResolver::new_dns_packet($domain, $type, $class)); .Ve .ie n .IP "$id = $res\->bgsend($domain, $type, $class, $cb)" 4 .el .IP "\f(CW$id\fR = \f(CW$res\fR\->bgsend($domain, \f(CW$type\fR, \f(CW$class\fR, \f(CW$cb\fR)" 4 .IX Item "$id = $res->bgsend($domain, $type, $class, $cb)" Quite similar to \f(CW\*(C`Net::DNS::Resolver::bgsend\*(C'\fR, except that when a reply packet eventually arrives, and \f(CW\*(C`poll_responses\*(C'\fR is called, the callback sub reference \f(CW$cb\fR will be called. .Sp Note that \f(CW$type\fR and \f(CW$class\fR may be \f(CW\*(C`undef\*(C'\fR, in which case they will default to \f(CW\*(C`A\*(C'\fR and \f(CW\*(C`IN\*(C'\fR, respectively. .Sp The callback sub will be called with three arguments \*(-- the packet that was delivered, and an id string that fingerprints the query packet and the expected reply. The third argument is a timestamp (Unix time, floating point), captured at the time the packet was collected. It is expected that a closure callback be used, like so: .Sp .Vb 4 \& my $id = $self\->{resolver}\->bgsend($domain, $type, undef, sub { \& my ($reply, $reply_id, $timestamp) = @_; \& $self\->got_a_reply ($reply, $reply_id); \& }); .Ve .Sp The callback can ignore the reply as an invalid packet sent to the listening port if the reply id does not match the return value from bgsend. .ie n .IP "$nfound = $res\->\fIpoll_responses()\fR" 4 .el .IP "\f(CW$nfound\fR = \f(CW$res\fR\->\fIpoll_responses()\fR" 4 .IX Item "$nfound = $res->poll_responses()" See if there are any \f(CW\*(C`bgsend\*(C'\fR reply packets ready, and return the number of such packets delivered to their callbacks. .ie n .IP "$res\->\fIbgabort()\fR" 4 .el .IP "\f(CW$res\fR\->\fIbgabort()\fR" 4 .IX Item "$res->bgabort()" Call this to release pending requests from memory, when aborting backgrounded requests, or when the scan is complete. \&\f(CW\*(C`Mail::SpamAssassin::PerMsgStatus::check\*(C'\fR calls this before returning. .ie n .IP "$packet = $res\->send($name, $type, $class)" 4 .el .IP "\f(CW$packet\fR = \f(CW$res\fR\->send($name, \f(CW$type\fR, \f(CW$class\fR)" 4 .IX Item "$packet = $res->send($name, $type, $class)" Emulates \f(CW\*(C`Net::DNS::Resolver::send()\*(C'\fR. .Sp This subroutine is a simple synchronous leftover from SpamAssassin version 3.3 and does not participate in packet query caching and callback grouping as implemented by \fIAsyncLoop::bgsend_and_start_lookup()\fR. As such it should be avoided for mainstream usage. .ie n .IP "$res\->\fIerrorstring()\fR" 4 .el .IP "\f(CW$res\fR\->\fIerrorstring()\fR" 4 .IX Item "$res->errorstring()" Little more than a stub for callers expecting this from \f(CW\*(C`Net::DNS::Resolver\*(C'\fR. .Sp If called immediately after a call to \f(CW$res\fR\->send this will return \&\f(CW\*(C`query timed out\*(C'\fR if the \f(CW$res\fR\->send \s-1DNS\s0 query timed out. Otherwise \&\f(CW\*(C`unknown error or no error\*(C'\fR will be returned. .Sp No other errors are reported. .ie n .IP "$res\->\fIfinish_socket()\fR" 4 .el .IP "\f(CW$res\fR\->\fIfinish_socket()\fR" 4 .IX Item "$res->finish_socket()" Reset socket when done with it. .ie n .IP "$res\->\fIfinish()\fR" 4 .el .IP "\f(CW$res\fR\->\fIfinish()\fR" 4 .IX Item "$res->finish()" Clean up for destruction.