NAME
Net::DNS::Header - DNS packet header class
SYNOPSIS
use Net::DNS::Header;
DESCRIPTION
A Net::DNS::Header
object represents the header portion of a DNS packet.
METHODS
new
$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.
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.
id
print "query id = ", $header->id, "\n";
Returns the query identification number.
qr
print "query response flag = ", $header->qr, "\n";
Returns the query response flag.
opcode
print "query opcode = ", $header->opcode, "\n";
Returns the query opcode (the purpose of the query).
aa
print "answer is ", $header->aa ? "" : "non-", "authoritative\n";
Returns true if this is an authoritative answer.
tc
print "packet is ", $header->tc ? "" : "not ", "truncated\n";
Returns true if this packet is truncated.
rd
print "recursion was ", $header->rd ? "" : "not ", "desired\n";
Returns true if recursion was desired.
ra
print "recursion is ", $header->ra ? "" : "not ", "available\n";
Returns true if recursion is available.
rcode
print "query response code = ", $header->rcode, "\n";
The query response code, i.e., the status of the query.
qdcount
print "# of question records: ", $header->qdcount, "\n";
Returns the number of records in the question section of the packet.
ancount
print "# of answer records: ", $header->ancount, "\n";
Returns the number of records in the answer section of the packet.
nscount
print "# of authority records: ", $header->nscount, "\n";
Returns the number of records in the authority section of the packet.
arcount
print "# of additional records: ", $header->arcount, "\n";
Returns the number of records in the additional section of the packet.
data
$hdata = $header->data;
Returns the header data in binary format, appropriate for use in a DNS query packet.
COPYRIGHT
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.
SEE ALSO
perl(1), Net::DNS, Net::DNS::Resolver, Net::DNS::Packet, Net::DNS::Question, Net::DNS::RR, RFC 1035 Section 4.1.1