1Net::DNS::DomainName(3)User Contributed Perl DocumentatioNnet::DNS::DomainName(3)
2
3
4
6 Net::DNS::DomainName - DNS domain name wire representation
7
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
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
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 decode
39 $object = decode Net::DNS::DomainName( \$buffer, $offset, $hash );
40
41 ( $object, $next ) = decode Net::DNS::DomainName( \$buffer, $offset, $hash );
42
43 Creates a domain name object which represents the DNS domain name
44 identified by the wire-format data at the indicated offset within the
45 data buffer.
46
47 The argument list consists of a reference to a scalar containing the
48 wire-format data and specified offset. The optional reference to a hash
49 table provides improved efficiency of decoding compressed names by
50 exploiting already cached compression pointers.
51
52 The returned offset value indicates the start of the next item in the
53 data buffer.
54
55 encode
56 $data = $object->encode;
57
58 Returns the wire-format representation of the domain name suitable for
59 inclusion in a DNS packet buffer.
60
62 Net::DNS::DomainName1035 implements a subclass of domain name objects
63 which are to be encoded using the compressed wire format defined in
64 RFC1035.
65
66 use Net::DNS::DomainName;
67
68 $object = new Net::DNS::DomainName1035('compressible.example.com');
69 $data = $object->encode( $offset, $hash );
70
71 ( $object, $next ) = decode Net::DNS::DomainName1035( \$data, $offset );
72
73 Note that RFC3597 implies that the RR types defined in RFC1035 section
74 3.3 are the only types eligible for compression.
75
76 encode
77 $data = $object->encode( $offset, $hash );
78
79 Returns the wire-format representation of the domain name suitable for
80 inclusion in a DNS packet buffer.
81
82 The optional arguments are the offset within the packet data where the
83 domain name is to be stored and a reference to a hash table used to
84 index compressed names within the packet.
85
86 If the hash reference is undefined, encode() returns the lowercase
87 uncompressed canonical representation defined in RFC2535(8.1).
88
90 Net::DNS::DomainName2535 implements a subclass of domain name objects
91 which are to be encoded using uncompressed wire format.
92
93 Note that RFC3597, and latterly RFC4034, specifies that the lower case
94 canonical encoding defined in RFC2535 is to be used for RR types
95 defined prior to RFC3597.
96
97 use Net::DNS::DomainName;
98
99 $object = new Net::DNS::DomainName2535('incompressible.example.com');
100 $data = $object->encode( $offset, $hash );
101
102 ( $object, $next ) = decode Net::DNS::DomainName2535( \$data, $offset );
103
104 encode
105 $data = $object->encode( $offset, $hash );
106
107 Returns the uncompressed wire-format representation of the domain name
108 suitable for inclusion in a DNS packet buffer.
109
110 If the hash reference is undefined, encode() returns the lowercase
111 canonical form defined in RFC2535(8.1).
112
114 Copyright (c)2009-2011 Dick Franks.
115
116 All rights reserved.
117
118 This program is free software; you may redistribute it and/or modify it
119 under the same terms as Perl itself.
120
122 perl, Net::DNS, Net::DNS::Domain, RFC1035, RFC2535, RFC3597, RFC4034
123
124
125
126perl v5.16.3 2012-12-28 Net::DNS::DomainName(3)