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->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.
75 "Mail::SpamAssassin::PerMsgStatus::check" calls this before
76 returning.
77
78 $packet = $res->send($name, $type, $class)
79 Emulates "Net::DNS::Resolver::send()".
80
81 $res->errorstring()
82 Little more than a stub for callers expecting this from
83 "Net::DNS::Resolver".
84
85 If called immediately after a call to $res->send this will return
86 "query timed out" if the $res->send DNS query timed out. Otherwise
87 "unknown error or no error" will be returned.
88
89 No other errors are reported.
90
91 $res->finish_socket()
92 Reset socket when done with it.
93
94 $res->finish()
95 Clean up for destruction.
96
97
98
99perl v5.10.1 2010-03-16Mail::SpamAssassin::DnsResolver(3)