1Net::DNS::Question(3) User Contributed Perl DocumentationNet::DNS::Question(3)
2
3
4
6 Net::DNS::Question - DNS question record
7
9 use Net::DNS::Question;
10
11 $question = new Net::DNS::Question('example.com', 'A', 'IN');
12
14 A Net::DNS::Question object represents a record in the question section
15 of a DNS packet.
16
18 new
19 $question = new Net::DNS::Question('example.com', 'A', 'IN');
20 $question = new Net::DNS::Question('example.com');
21
22 $question = new Net::DNS::Question('192.0.32.10', 'PTR', 'IN');
23 $question = new Net::DNS::Question('192.0.32.10');
24
25 Creates a question object from the domain, type, and class passed as
26 arguments. One or both type and class arguments may be omitted and will
27 assume the default values shown above.
28
29 RFC4291 and RFC4632 IP address/prefix notation is supported for queries
30 in both in-addr.arpa and ip6.arpa namespaces.
31
32 decode
33 $question = decode Net::DNS::Question(\$data, $offset);
34
35 ($question, $offset) = decode Net::DNS::Question(\$data, $offset);
36
37 Decodes the question record at the specified location within a DNS
38 wire-format packet. The first argument is a reference to the buffer
39 containing the packet data. The second argument is the offset of the
40 start of the question record.
41
42 Returns a Net::DNS::Question object and the offset of the next location
43 in the packet.
44
45 An exception is raised if the object cannot be created (e.g., corrupt
46 or insufficient data).
47
48 encode
49 $data = $question->encode( $offset, $hash );
50
51 Returns the Net::DNS::Question in binary format suitable for inclusion
52 in a DNS packet buffer.
53
54 The optional arguments are the offset within the packet data where the
55 Net::DNS::Question is to be stored and a reference to a hash table used
56 to index compressed names within the packet.
57
58 print
59 $object->print;
60
61 Prints the record to the standard output. Calls the string() method to
62 get the string representation.
63
64 string
65 print "string = ", $question->string, "\n";
66
67 Returns a string representation of the question record.
68
69 name
70 $name = $question->name;
71
72 Internationalised domain name corresponding to the qname attribute.
73
74 Decoding non-ASCII domain names is computationally expensive and
75 undesirable for names which are likely to be used to construct further
76 queries.
77
78 When required to communicate with humans, the 'proper' domain name
79 should be extracted from a query or reply packet.
80
81 $query = new Net::DNS::Packet( $example, 'ANY' );
82 $reply = $resolver->send($query) or die;
83 ($question) = $reply->question;
84 $name = $question->name;
85
86 qname, zname
87 $qname = $question->qname;
88 $zname = $question->zname;
89
90 Fully qualified domain name in the form required for a query
91 transmitted to a nameserver. In dynamic update packets, this attribute
92 is known as zname() and refers to the zone name.
93
94 qtype, ztype, type
95 $qtype = $question->type;
96 $qtype = $question->qtype;
97 $ztype = $question->ztype;
98
99 Returns the question type attribute. In dynamic update packets, this
100 attribute is known as ztype() and refers to the zone type.
101
102 qclass, zclass, class
103 $qclass = $question->class;
104 $qclass = $question->qclass;
105 $zclass = $question->zclass;
106
107 Returns the question class attribute. In dynamic update packets, this
108 attribute is known as zclass() and refers to the zone class.
109
111 Copyright (c)1997-2000 Michael Fuhr.
112
113 Portions Copyright (c)2002,2003 Chris Reinhardt.
114
115 Portions Copyright (c)2003,2006-2011 Dick Franks.
116
117 All rights reserved.
118
120 Permission to use, copy, modify, and distribute this software and its
121 documentation for any purpose and without fee is hereby granted,
122 provided that the above copyright notice appear in all copies and that
123 both that copyright notice and this permission notice appear in
124 supporting documentation, and that the name of the author not be used
125 in advertising or publicity pertaining to distribution of the software
126 without specific prior written permission.
127
128 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
129 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
130 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
131 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
132 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
133 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
134 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
135
137 perl, Net::DNS, Net::DNS::DomainName, Net::DNS::Packet, RFC 1035
138 Section 4.1.2
139
140
141
142perl v5.28.1 2018-11-14 Net::DNS::Question(3)