1Mail::SpamAssassin::DnsURseesrolCvoenrt(r3i)buted Perl DMoaciulm:e:nStpaatmiAosnsassin::DnsResolver(3)
2
3
4

NAME

6       Mail::SpamAssassin::DnsResolver - DNS resolution engine
7

DESCRIPTION

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 colli‐
11       sion bug in that module.
12

METHODS

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->nameservers()
22           Wrapper for Net::DNS::Resolver->nameservers to get or set list of
23           nameservers
24
25       $res->connect_sock()
26           Re-connect to the first nameserver listed in "/etc/resolv.conf" or
27           similar platform-dependent source, as provided by "Net::DNS".
28
29       $res->get_sock()
30           Return the "IO::Socket::INET" object used to communicate with the
31           nameserver.
32
33       $packet = new_dns_packet ($host, $type, $class)
34           A wrapper for "Net::DNS::Packet::new()" which traps a die thrown by
35           it.
36
37           To use this, change calls to "Net::DNS::Resolver::bgsend" from:
38
39               $res->bgsend($hostname, $type);
40
41           to:
42
43               $res->bgsend(Mail::SpamAssassin::DnsResolver::new_dns_packet($hostname, $type, $class));
44
45       $id = $res->bgsend($host, $type, $class, $cb)
46           Quite similar to "Net::DNS::Resolver::bgsend", except that when a
47           response packet eventually arrives, and "poll_responses" is called,
48           the callback sub reference $cb will be called.
49
50           Note that $type and $class may be "undef", in which case they will
51           default to "A" and "IN", respectively.
52
53           The callback sub will be called with three arguments -- the packet
54           that was delivered, and an id string that fingerprints the query
55           packet and the expected reply. The third argument is a timestamp
56           (Unix time, floating point), captured at the time the packet was
57           collected. It is expected that a closure callback be used, like so:
58
59             my $id = $self->{resolver}->bgsend($host, $type, undef, sub {
60                   my ($reply, $reply_id, $timestamp) = @_;
61                   $self->got_a_reply ($reply, $reply_id);
62                 });
63
64           The callback can ignore the reply as an invalid packet sent to the
65           listening port if the reply id does not match the return value from
66           bgsend.
67
68       $nfound = $res->poll_responses()
69           See if there are any "bgsend" response packets ready, and return
70           the number of such packets delivered to their callbacks.
71
72       $res->bgabort()
73           Call this to release pending requests from memory, when aborting
74           backgrounded requests, or when the scan is complete.  "Mail::Spa‐
75           mAssassin::PerMsgStatus::check" calls this before returning.
76
77       $packet = $res->send($name, $type, $class)
78           Emulates "Net::DNS::Resolver::send()".
79
80       $res->errorstring()
81           Little more than a stub for callers expecting this from
82           "Net::DNS::Resolver".
83
84           If called immediately after a call to $res->send this will return
85           "query timed out" if the $res->send DNS query timed out.  Otherwise
86           "unknown error or no error" will be returned.
87
88           No other errors are reported.
89
90       $res->finish_socket()
91           Reset socket when done with it.
92
93       $res->finish()
94           Clean up for destruction.
95
96
97
98perl v5.8.8                       2008-01-05Mail::SpamAssassin::DnsResolver(3)
Impressum