1Net::DNS::Header(3)   User Contributed Perl Documentation  Net::DNS::Header(3)
2
3
4

NAME

6       Net::DNS::Header - DNS packet header class
7

SYNOPSIS

9       "use Net::DNS::Header;"
10

DESCRIPTION

12       A "Net::DNS::Header" object represents the header portion of a DNS
13       packet.
14

METHODS

16   new
17           $header = Net::DNS::Header->new;
18
19       "new" creates a header object appropriate for making a DNS query.
20
21   parse
22           ($header, $offset) = Net::DNS::Header->parse(\$data);
23
24       Parses the header record at the start of a DNS packet.  The argument is
25       a reference to the packet data.
26
27       Returns a Net::DNS::Header object and the offset of the next location
28       in the packet.
29
30       Parsing is aborted if the header object cannot be created (e.g.,
31       corrupt or insufficient data).
32
33   print
34           $header->print;
35
36       Prints the header record on the standard output.
37
38   string
39           print $header->string;
40
41       Returns a string representation of the header object.
42
43   id
44           print "query id = ", $header->id, "\n";
45           $header->id(1234);
46
47       Gets or sets the query identification number.
48
49   qr
50           print "query response flag = ", $header->qr, "\n";
51           $header->qr(0);
52
53       Gets or sets the query response flag.
54
55   opcode
56           print "query opcode = ", $header->opcode, "\n";
57           $header->opcode("UPDATE");
58
59       Gets or sets the query opcode (the purpose of the query).
60
61   aa
62           print "answer is ", $header->aa ? "" : "non-", "authoritative\n";
63           $header->aa(0);
64
65       Gets or sets the authoritative answer flag.
66
67   tc
68           print "packet is ", $header->tc ? "" : "not ", "truncated\n";
69           $header->tc(0);
70
71       Gets or sets the truncated packet flag.
72
73   rd
74           print "recursion was ", $header->rd ? "" : "not ", "desired\n";
75           $header->rd(0);
76
77       Gets or sets the recursion desired flag.
78
79   cd
80           print "checking was ", $header->cd ? "not" : "", "desired\n";
81           $header->cd(0);
82
83       Gets or sets the checking disabled flag.
84
85   ra
86           print "recursion is ", $header->ra ? "" : "not ", "available\n";
87           $header->ra(0);
88
89       Gets or sets the recursion available flag.
90
91   ad
92           print "The result has ", $header->ad ? "" : "not", "been verified\n"
93
94       Relevant in DNSSEC context.
95
96       (The AD bit is only set on answers where signatures have been
97       cryptographically verified or the server is authoritative for the data
98       and is allowed to set the bit by policy.)
99
100   rcode
101           print "query response code = ", $header->rcode, "\n";
102           $header->rcode("SERVFAIL");
103
104       Gets or sets the query response code (the status of the query).
105
106   qdcount, zocount
107           print "# of question records: ", $header->qdcount, "\n";
108           $header->qdcount(2);
109
110       Gets or sets the number of records in the question section of the
111       packet.  In dynamic update packets, this field is known as "zocount"
112       and refers to the number of RRs in the zone section.
113
114   ancount, prcount
115           print "# of answer records: ", $header->ancount, "\n";
116           $header->ancount(5);
117
118       Gets or sets the number of records in the answer section of the packet.
119       In dynamic update packets, this field is known as "prcount" and refers
120       to the number of RRs in the prerequisite section.
121
122   nscount, upcount
123           print "# of authority records: ", $header->nscount, "\n";
124           $header->nscount(2);
125
126       Gets or sets the number of records in the authority section of the
127       packet.  In dynamic update packets, this field is known as "upcount"
128       and refers to the number of RRs in the update section.
129
130   arcount, adcount
131           print "# of additional records: ", $header->arcount, "\n";
132           $header->arcount(3);
133
134       Gets or sets the number of records in the additional section of the
135       packet.  In dynamic update packets, this field is known as "adcount".
136
137   data
138           $hdata = $header->data;
139
140       Returns the header data in binary format, appropriate for use in a DNS
141       query packet.
142
144       Copyright (c) 1997-2002 Michael Fuhr.
145
146       Portions Copyright (c) 2002-2004 Chris Reinhardt.
147
148       Portions Copyright (c) 2007 Dick Franks.
149
150       All rights reserved.  This program is free software; you may
151       redistribute it and/or modify it under the same terms as Perl itself.
152

SEE ALSO

154       perl(1), Net::DNS, Net::DNS::Resolver, Net::DNS::Packet,
155       Net::DNS::Update, Net::DNS::Question, Net::DNS::RR, RFC 1035 Section
156       4.1.1
157
158
159
160perl v5.12.0                      2009-01-26               Net::DNS::Header(3)
Impressum