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

SEE ALSO

166       perl(1), Net::DNS, Net::DNS::Resolver, Net::DNS::Packet,
167       Net::DNS::Update, Net::DNS::Question, Net::DNS::RR, RFC 1035 Section
168       4.1.1
169
170
171
172perl v5.8.8                       2007-08-01               Net::DNS::Header(3)
Impressum