.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Net::DNS::Header 3pm" .TH Net::DNS::Header 3pm 2024-05-08 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Net::DNS::Header \- DNS packet header .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use Net::DNS; \& \& $packet = Net::DNS::Packet\->new(); \& $header = $packet\->header; .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" \&\f(CW\*(C`Net::DNS::Header\*(C'\fR represents the header portion of a DNS packet. .SH METHODS .IX Header "METHODS" .ie n .SS $packet\->header .el .SS \f(CW$packet\fP\->header .IX Subsection "$packet->header" .Vb 2 \& $packet = Net::DNS::Packet\->new(); \& $header = $packet\->header; .Ve .PP Net::DNS::Header objects emanate from the Net::DNS::Packet \fBheader()\fR method, and contain an opaque reference to the parent Packet object. .PP Header objects may be assigned to suitably scoped lexical variables. They should never be stored in global variables or persistent data structures. .SS string .IX Subsection "string" .Vb 1 \& print $packet\->header\->string; .Ve .PP Returns a string representation of the packet header. .SS print .IX Subsection "print" .Vb 1 \& $packet\->header\->print; .Ve .PP Prints the string representation of the packet header. .SS id .IX Subsection "id" .Vb 2 \& print "query id = ", $packet\->header\->id, "\en"; \& $packet\->header\->id(1234); .Ve .PP Gets or sets the query identification number. .PP A random value is assigned if the argument value is undefined. .SS opcode .IX Subsection "opcode" .Vb 2 \& print "query opcode = ", $packet\->header\->opcode, "\en"; \& $packet\->header\->opcode("UPDATE"); .Ve .PP Gets or sets the query opcode (the purpose of the query). .SS rcode .IX Subsection "rcode" .Vb 2 \& print "query response code = ", $packet\->header\->rcode, "\en"; \& $packet\->header\->rcode("SERVFAIL"); .Ve .PP Gets or sets the query response code (the status of the query). .SS qr .IX Subsection "qr" .Vb 2 \& print "query response flag = ", $packet\->header\->qr, "\en"; \& $packet\->header\->qr(0); .Ve .PP Gets or sets the query response flag. .SS aa .IX Subsection "aa" .Vb 2 \& print "response is ", $packet\->header\->aa ? "" : "non\-", "authoritative\en"; \& $packet\->header\->aa(0); .Ve .PP Gets or sets the authoritative answer flag. .SS tc .IX Subsection "tc" .Vb 2 \& print "packet is ", $packet\->header\->tc ? "" : "not ", "truncated\en"; \& $packet\->header\->tc(0); .Ve .PP Gets or sets the truncated packet flag. .SS rd .IX Subsection "rd" .Vb 2 \& print "recursion was ", $packet\->header\->rd ? "" : "not ", "desired\en"; \& $packet\->header\->rd(0); .Ve .PP Gets or sets the recursion desired flag. .SS ra .IX Subsection "ra" .Vb 2 \& print "recursion is ", $packet\->header\->ra ? "" : "not ", "available\en"; \& $packet\->header\->ra(0); .Ve .PP Gets or sets the recursion available flag. .SS z .IX Subsection "z" Unassigned bit, should always be zero. .SS ad .IX Subsection "ad" .Vb 1 \& print "The response has ", $packet\->header\->ad ? "" : "not", "been verified\en"; .Ve .PP Relevant in DNSSEC context. .PP (The AD bit is only set on a response where signatures have been cryptographically verified or the server is authoritative for the data and is allowed to set the bit by policy.) .SS cd .IX Subsection "cd" .Vb 2 \& print "checking was ", $packet\->header\->cd ? "not" : "", "desired\en"; \& $packet\->header\->cd(0); .Ve .PP Gets or sets the checking disabled flag. .SS "qdcount, zocount" .IX Subsection "qdcount, zocount" .Vb 1 \& print "# of question records: ", $packet\->header\->qdcount, "\en"; .Ve .PP Returns the number of records in the question section of the packet. In dynamic update packets, this field is known as \f(CW\*(C`zocount\*(C'\fR and refers to the number of RRs in the zone section. .SS "ancount, prcount" .IX Subsection "ancount, prcount" .Vb 1 \& print "# of answer records: ", $packet\->header\->ancount, "\en"; .Ve .PP Returns the number of records in the answer section of the packet which may, in the case of corrupt packets, differ from the actual number of records. In dynamic update packets, this field is known as \f(CW\*(C`prcount\*(C'\fR and refers to the number of RRs in the prerequisite section. .SS "nscount, upcount" .IX Subsection "nscount, upcount" .Vb 1 \& print "# of authority records: ", $packet\->header\->nscount, "\en"; .Ve .PP Returns the number of records in the authority section of the packet which may, in the case of corrupt packets, differ from the actual number of records. In dynamic update packets, this field is known as \f(CW\*(C`upcount\*(C'\fR and refers to the number of RRs in the update section. .SS "arcount, adcount" .IX Subsection "arcount, adcount" .Vb 1 \& print "# of additional records: ", $packet\->header\->arcount, "\en"; .Ve .PP Returns the number of records in the additional section of the packet which may, in the case of corrupt packets, differ from the actual number of records. In dynamic update packets, this field is known as \f(CW\*(C`adcount\*(C'\fR. .SH "EDNS Protocol Extensions" .IX Header "EDNS Protocol Extensions" .SS "do, co" .IX Subsection "do, co" .Vb 2 \& print "DNSSEC_OK flag was ", $packet\->header\->do ? "not" : "", "set\en"; \& $packet\->header\->do(1); .Ve .PP Gets or sets the named EDNS flag. .SS "Extended rcode" .IX Subsection "Extended rcode" EDNS extended rcodes are handled transparently by \f(CW$packet\fR\->header\->\fBrcode()\fR. .SS "UDP packet size" .IX Subsection "UDP packet size" .Vb 1 \& $udp_max = $packet\->edns\->UDPsize; .Ve .PP EDNS offers a mechanism to advertise the maximum UDP packet size which can be assembled by the local network stack. .SS edns .IX Subsection "edns" .Vb 5 \& $header = $packet\->header; \& $version = $header\->edns\->version; \& @options = $header\->edns\->options; \& $option = $header\->edns\->option(n); \& $udp_max = $packet\->edns\->UDPsize; .Ve .PP Auxiliary function which provides access to the EDNS protocol extension OPT RR. .SH COPYRIGHT .IX Header "COPYRIGHT" Copyright (c)1997 Michael Fuhr. .PP Portions Copyright (c)2002,2003 Chris Reinhardt. .PP Portions Copyright (c)2012,2022 Dick Franks. .PP All rights reserved. .SH LICENSE .IX Header "LICENSE" Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the original copyright notices appear in all copies and that both copyright notice and this permission notice appear in supporting documentation, and that the name of the author not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. .PP THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. .SH "SEE ALSO" .IX Header "SEE ALSO" perl Net::DNS Net::DNS::Packet Net::DNS::RR::OPT RFC1035(4.1.1)