1Net::DNS::DomainName(3)User Contributed Perl DocumentatioNnet::DNS::DomainName(3)
2
3
4

NAME

6       Net::DNS::DomainName - DNS name representation
7

SYNOPSIS

9           use Net::DNS::DomainName;
10
11           $object = new Net::DNS::DomainName('example.com');
12           $name = $object->name;
13           $data = $object->encode;
14
15           ( $object, $next ) = decode Net::DNS::DomainName( \$data, $offset );
16

DESCRIPTION

18       The Net::DNS::DomainName module implements the concrete representation
19       of DNS domain names used within DNS packets.
20
21       Net::DNS::DomainName defines methods for encoding and decoding wire
22       format octet strings as defined in RFC1035. All other behaviour,
23       including the new() constructor, is inherited from Net::DNS::Domain.
24
25       The Net::DNS::DomainName1035 and Net::DNS::DomainName2535 packages
26       implement disjoint domain name subtypes which provide the name
27       compression and canonicalisation specified by RFC1035 and RFC2535.
28       These are necessary to meet the backward compatibility requirements
29       introduced by RFC3597.
30

METHODS

32   new
33           $object = new Net::DNS::DomainName('example.com');
34
35       Creates a domain name object which identifies the domain specified by
36       the character string argument.
37
38   canonical
39           $data = $object->canonical;
40
41       Returns the canonical wire-format representation of the domain name as
42       defined in RFC2535(8.1).
43
44   decode
45           $object = decode Net::DNS::DomainName( \$buffer, $offset, $hash );
46
47           ( $object, $next ) = decode Net::DNS::DomainName( \$buffer, $offset, $hash );
48
49       Creates a domain name object which represents the DNS domain name
50       identified by the wire-format data at the indicated offset within the
51       data buffer.
52
53       The argument list consists of a reference to a scalar containing the
54       wire-format data and specified offset. The optional reference to a hash
55       table provides improved efficiency of decoding compressed names by
56       exploiting already cached compression pointers.
57
58       The returned offset value indicates the start of the next item in the
59       data buffer.
60
61   encode
62           $data = $object->encode;
63
64       Returns the wire-format representation of the domain name suitable for
65       inclusion in a DNS packet buffer.
66

Net::DNS::DomainName1035

68       Net::DNS::DomainName1035 implements a subclass of domain name objects
69       which are to be encoded using the compressed wire format defined in
70       RFC1035.
71
72           use Net::DNS::DomainName;
73
74           $object = new Net::DNS::DomainName1035('compressible.example.com');
75           $data   = $object->encode( $offset, $hash );
76
77           ( $object, $next ) = decode Net::DNS::DomainName1035( \$data, $offset );
78
79       Note that RFC3597 implies that the RR types defined in RFC1035 section
80       3.3 are the only types eligible for compression.
81
82   encode
83           $data = $object->encode( $offset, $hash );
84
85       Returns the wire-format representation of the domain name suitable for
86       inclusion in a DNS packet buffer.
87
88       The optional arguments are the offset within the packet data where the
89       domain name is to be stored and a reference to a hash table used to
90       index compressed names within the packet.
91
92       If the hash reference is undefined, encode() returns the lowercase
93       uncompressed canonical representation defined in RFC2535(8.1).
94

Net::DNS::DomainName2535

96       Net::DNS::DomainName2535 implements a subclass of domain name objects
97       which are to be encoded using uncompressed wire format.
98
99       Note that RFC3597, and latterly RFC4034, specifies that the lower case
100       canonical encoding defined in RFC2535 is to be used for RR types
101       defined prior to RFC3597.
102
103           use Net::DNS::DomainName;
104
105           $object = new Net::DNS::DomainName2535('incompressible.example.com');
106           $data   = $object->encode( $offset, $hash );
107
108           ( $object, $next ) = decode Net::DNS::DomainName2535( \$data, $offset );
109
110   encode
111           $data = $object->encode( $offset, $hash );
112
113       Returns the uncompressed wire-format representation of the domain name
114       suitable for inclusion in a DNS packet buffer.
115
116       If the hash reference is undefined, encode() returns the lowercase
117       canonical form defined in RFC2535(8.1).
118
120       Copyright (c)2009-2011 Dick Franks.
121
122       All rights reserved.
123

LICENSE

125       Permission to use, copy, modify, and distribute this software and its
126       documentation for any purpose and without fee is hereby granted,
127       provided that the above copyright notice appear in all copies and that
128       both that copyright notice and this permission notice appear in
129       supporting documentation, and that the name of the author not be used
130       in advertising or publicity pertaining to distribution of the software
131       without specific prior written permission.
132
133       THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
134       OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
135       MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
136       IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
137       CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
138       TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
139       SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
140

SEE ALSO

142       perl, Net::DNS, Net::DNS::Domain, RFC1035, RFC2535, RFC3597, RFC4034
143
144
145
146perl v5.28.0                      2018-11-14           Net::DNS::DomainName(3)
Impressum