Net::DNS::Packet - DNS packet object class
use Net::DNS::Packet;
A Net::DNS::Packet object represents a DNS packet.
Net::DNS::Packet
$packet = new Net::DNS::Packet(\$data); $packet = new Net::DNS::Packet("foo.com", "MX", "IN");
If passed a reference to a scalar containing DNS packet data, new creates a packet object from that data.
new
If passed a domain, type, and class, new creates a packet object appropriate for making a DNS query for the requested information.
$data = $packet->data;
Returns the packet data in binary format, suitable for sending to a nameserver.
$header = $packet->header;
Returns a Net::DNS::Header object representing the header section of the packet.
Net::DNS::Header
@question = $packet->question;
Returns a list of Net::DNS::Question objects representing the question section of the packet.
Net::DNS::Question
In dynamic update packets, this section is known as zone and specifies the zone to be updated.
zone
@answer = $packet->answer;
Returns a list of Net::DNS::RR objects representing the answer section of the packet.
Net::DNS::RR
In dynamic update packets, this section is known as pre or prerequisite and specifies the RRs or RRsets which must (not) preexist.
pre
prerequisite
@authority = $packet->authority;
Returns a list of Net::DNS::RR objects representing the authority section of the packet.
In dynamic update packets, this section is known as update and specifies the RRs or RRsets to be added or delted.
update
@additional = $packet->additional;
Returns a list of Net::DNS::RR objects representing the additional section of the packet.
$packet->print;
Prints the packet data on the standard output in an ASCII format similar to that used in DNS zone files.
($name, $nextoffset) = dn_expand(\$data, $offset);
Expands the domain name stored at a particular location in a DNS packet. The first argument is a reference to a scalar containing the packet data. The second argument is the offset within the packet where the (possibly compressed) domain name is stored.
Returns the domain name and the offset of the next location in the packet.
Copyright (c) 1997 Michael Fuhr. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
perl(1), Net::DNS, Net::DNS::Resolver, Net::DNS::Header, Net::DNS::Question, Net::DNS::RR, RFC 1035 Section 4.1
To install Net::DNS, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::DNS
CPAN shell
perl -MCPAN -e shell install Net::DNS
For more information on module installation, please visit the detailed CPAN module installation guide.