1Mail::SpamAssassin::DnsURseesrolCvoenrt(r3i)buted Perl DMoaciulm:e:nStpaatmiAosnsassin::DnsResolver(3)
2
3
4
6 Mail::SpamAssassin::DnsResolver - DNS resolution engine
7
9 This is a DNS resolution engine for SpamAssassin, implemented in order
10 to reduce file descriptor usage by Net::DNS and avoid a response
11 collision bug in that module.
12
14 $res->load_resolver()
15 Load the "Net::DNS::Resolver" object. Returns 0 if Net::DNS cannot
16 be used, 1 if it is available.
17
18 $resolver = $res->get_resolver()
19 Return the "Net::DNS::Resolver" object.
20
21 $res->configured_nameservers()
22 Get a list of nameservers as configured by dns_server directives or
23 as provided by Net::DNS, typically from /etc/resolv.conf
24
25 $res->available_nameservers()
26 Get or set a list of currently available nameservers, which is
27 typically a known-to-be-good subset of configured nameservers
28
29 $res->connect_sock()
30 Re-connect to the first nameserver listed in "/etc/resolv.conf" or
31 similar platform-dependent source, as provided by "Net::DNS".
32
33 $res->get_sock()
34 Return the "IO::Socket::INET" object used to communicate with the
35 nameserver.
36
37 $packet = new_dns_packet ($domain, $type, $class)
38 A wrapper for "Net::DNS::Packet::new()" which traps a die thrown by
39 it.
40
41 To use this, change calls to "Net::DNS::Resolver::bgsend" from:
42
43 $res->bgsend($domain, $type);
44
45 to:
46
47 $res->bgsend(Mail::SpamAssassin::DnsResolver::new_dns_packet($domain, $type, $class));
48
49 $id = $res->bgsend($domain, $type, $class, $cb)
50 Quite similar to "Net::DNS::Resolver::bgsend", except that when a
51 reply packet eventually arrives, and "poll_responses" is called,
52 the callback sub reference $cb will be called.
53
54 Note that $type and $class may be "undef", in which case they will
55 default to "A" and "IN", respectively.
56
57 The callback sub will be called with three arguments -- the packet
58 that was delivered, and an id string that fingerprints the query
59 packet and the expected reply. The third argument is a timestamp
60 (Unix time, floating point), captured at the time the packet was
61 collected. It is expected that a closure callback be used, like so:
62
63 my $id = $self->{resolver}->bgsend($domain, $type, undef, sub {
64 my ($reply, $reply_id, $timestamp) = @_;
65 $self->got_a_reply ($reply, $reply_id);
66 });
67
68 The callback can ignore the reply as an invalid packet sent to the
69 listening port if the reply id does not match the return value from
70 bgsend.
71
72 $nfound = $res->poll_responses()
73 See if there are any "bgsend" reply packets ready, and return the
74 number of such packets delivered to their callbacks.
75
76 $res->bgabort()
77 Call this to release pending requests from memory, when aborting
78 backgrounded requests, or when the scan is complete.
79 "Mail::SpamAssassin::PerMsgStatus::check" calls this before
80 returning.
81
82 $packet = $res->send($name, $type, $class)
83 Emulates "Net::DNS::Resolver::send()".
84
85 This subroutine is a simple synchronous leftover from SpamAssassin
86 version 3.3 and does not participate in packet query caching and
87 callback grouping as implemented by
88 AsyncLoop::bgsend_and_start_lookup(). As such it should be avoided
89 for mainstream usage.
90
91 $res->errorstring()
92 Little more than a stub for callers expecting this from
93 "Net::DNS::Resolver".
94
95 If called immediately after a call to $res->send this will return
96 "query timed out" if the $res->send DNS query timed out. Otherwise
97 "unknown error or no error" will be returned.
98
99 No other errors are reported.
100
101 $res->finish_socket()
102 Reset socket when done with it.
103
104 $res->finish()
105 Clean up for destruction.
106
107
108
109perl v5.16.3 2014-02-07Mail::SpamAssassin::DnsResolver(3)