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