1Net::DNS::RR::OPT(3) User Contributed Perl Documentation Net::DNS::RR::OPT(3)
2
3
4
6 Net::DNS::RR::OPT - DNS OPT resource record
7
9 use Net::DNS;
10 $packet = new Net::DNS::Packet( ... );
11
12 $packet->header->do(1); # extended flag
13
14 $packet->edns->size(1280); # UDP payload size
15
16 $packet->edns->option( COOKIE => $cookie );
17
18 $packet->edns->print;
19
20 ;; EDNS version 0
21 ;; flags: 8000
22 ;; rcode: NOERROR
23 ;; size: 1280
24 ;; option: DAU => ( 8, 10, 13, 14, 15, 16 )
25 ;; DHU => ( 1, 2, 4 )
26 ;; COOKIE => ( CLIENT-COOKIE => 7261776279746573,
27 ;; SERVER-COOKIE => )
28
30 EDNS OPT pseudo resource record.
31
32 The OPT record supports EDNS protocol extensions and is not intended to
33 be created, accessed or modified directly by user applications.
34
35 All EDNS features are performed indirectly by operations on the objects
36 returned by the $packet->header and $packet->edns creator methods. The
37 underlying mechanisms are entirely hidden from the user.
38
40 The available methods are those inherited from the base class augmented
41 by the type-specific methods defined in this package.
42
43 Use of undocumented package features or direct access to internal data
44 structures is discouraged and could result in program termination or
45 other unpredictable behaviour.
46
47 version
48 $version = $rr->version;
49 $rr->version( $version );
50
51 The version of EDNS supported by this OPT record.
52
53 size
54 $size = $packet->edns->size;
55 $more = $packet->edns->size(1280);
56
57 size() advertises the maximum size (octets) of UDP packet that can be
58 reassembled in the network stack of the originating host.
59
60 rcode
61 $extended_rcode = $packet->header->rcode;
62 $incomplete_rcode = $packet->edns->rcode;
63
64 The 12 bit extended RCODE. The most significant 8 bits reside in the
65 OPT record. The least significant 4 bits can only be obtained from the
66 packet header.
67
68 flags
69 $edns_flags = $packet->edns->flags;
70
71 $do = $packet->header->do;
72 $packet->header->do(1);
73
74 16 bit field containing EDNS extended header flags.
75
76 options, option
77 @option = $packet->edns->options;
78
79 $octets = $packet->edns->option($option_code);
80
81 $packet->edns->option( COOKIE => $cookie );
82 $packet->edns->option( 10 => $cookie );
83
84 When called in a list context, options() returns a list of option codes
85 found in the OPT record.
86
87 When called in a scalar context with a single argument, option()
88 returns the uninterpreted octet string corresponding to the specified
89 option. The method returns undef if the specified option is absent.
90
91 Options can be added or replaced by providing the (name => string)
92 pair. The option is deleted if the value is undefined.
93
94 When option() is called in a list context with a single argument, the
95 returned array provides a structured interpretation appropriate to the
96 specified option.
97
98 For the example above:
99
100 %hash = $packet->edns->option(10);
101
102 %hash = (
103 'CLIENT-COOKIE' => 'rawbytes',
104 'SERVER-COOKIE' => ''
105 );
106
107 For some options, an array is more appropriate:
108
109 @algorithms = $packet->edns->option(6);
110
111 Similar forms of array or hash syntax may be used to construct the
112 option value:
113
114 $packet->edns->option( DHU => [1, 2, 4] );
115
116 $packet->edns->option( COOKIE => {'CLIENT-COOKIE' => $cookie} );
117
119 Copyright (c)2001,2002 RIPE NCC. Author Olaf M. Kolkman.
120
121 Portions Copyright (c)2012,2017-2019 Dick Franks.
122
123 All rights reserved.
124
125 Package template (c)2009,2012 O.M.Kolkman and R.W.Franks.
126
128 Permission to use, copy, modify, and distribute this software and its
129 documentation for any purpose and without fee is hereby granted,
130 provided that the above copyright notice appear in all copies and that
131 both that copyright notice and this permission notice appear in
132 supporting documentation, and that the name of the author not be used
133 in advertising or publicity pertaining to distribution of the software
134 without specific prior written permission.
135
136 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
137 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
138 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
139 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
140 CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
141 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
142 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
143
145 perl, Net::DNS, Net::DNS::RR, RFC6891, RFC3225
146
147
148
149perl v5.30.1 2020-01-30 Net::DNS::RR::OPT(3)