Net::DNS::Header - DNS packet header class
use Net::DNS::Header;
A Net::DNS::Header object represents the header portion of a DNS packet.
Net::DNS::Header
$header = new Net::DNS::Header; $header = new Net::DNS::Header(\$data);
Without an argument, new creates a header object appropriate for making a DNS query.
new
If new is passed a reference to a scalar containing DNS packet data, it creates a header object from that data.
$header->print;
Dumps the header data to the standard output.
print "query id = ", $header->id, "\n";
Returns the query identification number.
print "query response flag = ", $header->qr, "\n";
Returns the query response flag.
print "query opcode = ", $header->opcode, "\n";
Returns the query opcode (the purpose of the query).
print "answer is ", $header->aa ? "" : "non-", "authoritative\n";
Returns true if this is an authoritative answer.
print "packet is ", $header->tc ? "" : "not ", "truncated\n";
Returns true if this packet is truncated.
print "recursion was ", $header->rd ? "" : "not ", "desired\n";
Returns true if recursion was desired.
print "recursion is ", $header->ra ? "" : "not ", "available\n";
Returns true if recursion is available.
print "query response code = ", $header->rcode, "\n";
The query response code, i.e., the status of the query.
print "# of question records: ", $header->qdcount, "\n";
Returns the number of records in the question section of the packet.
print "# of answer records: ", $header->ancount, "\n";
Returns the number of records in the answer section of the packet.
print "# of authority records: ", $header->nscount, "\n";
Returns the number of records in the authority section of the packet.
print "# of additional records: ", $header->arcount, "\n";
Returns the number of records in the additional section of the packet.
$hdata = $header->data;
Returns the header data in binary format, appropriate for use in a DNS query 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::Packet, Net::DNS::Question, Net::DNS::RR, RFC 1035 Section 4.1.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.