{
    "mode": "perldoc",
    "parameter": "Net::DNS::RR::OPT",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Net%3A%3ADNS%3A%3ARR%3A%3AOPT/json",
    "generated": "2026-06-16T03:34:09Z",
    "synopsis": "use Net::DNS;\n$packet = Net::DNS::Packet->new( ... );\n$packet->header->do(1);                     # extended flag\n$packet->edns->size(1280);                  # UDP payload size\n$packet->edns->option( COOKIE => 'rawbytes' );\n$packet->edns->print;\n;; EDNS version 0\n;;      flags:  8000\n;;      rcode:  NOERROR\n;;      size:   1280\n;;      option: COOKIE => ( 7261776279746573 )\n;;              DAU    => ( 8, 10, 13, 14, 15, 16 )\n;;              DHU    => ( 1, 2, 4 )\n;;              EXTENDED-ERROR => ( INFO-CODE => 123, EXTRA-TEXT =>  )",
    "sections": {
        "NAME": {
            "content": "Net::DNS::RR::OPT - DNS OPT resource record\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use Net::DNS;\n$packet = Net::DNS::Packet->new( ... );\n\n$packet->header->do(1);                     # extended flag\n\n$packet->edns->size(1280);                  # UDP payload size\n\n$packet->edns->option( COOKIE => 'rawbytes' );\n\n$packet->edns->print;\n\n;; EDNS version 0\n;;      flags:  8000\n;;      rcode:  NOERROR\n;;      size:   1280\n;;      option: COOKIE => ( 7261776279746573 )\n;;              DAU    => ( 8, 10, 13, 14, 15, 16 )\n;;              DHU    => ( 1, 2, 4 )\n;;              EXTENDED-ERROR => ( INFO-CODE => 123, EXTRA-TEXT =>  )\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "EDNS OPT pseudo resource record.\n\nThe OPT record supports EDNS protocol extensions and is not intended to be created, accessed or\nmodified directly by user applications.\n\nAll EDNS features are performed indirectly by operations on the objects returned by the\n$packet->header and $packet->edns creator methods. The underlying mechanisms are entirely hidden\nfrom the user.\n",
            "subsections": []
        },
        "METHODS": {
            "content": "The available methods are those inherited from the base class augmented by the type-specific\nmethods defined in this package.\n\nUse of undocumented package features or direct access to internal data structures is discouraged\nand could result in program termination or other unpredictable behaviour.\n\nversion\n$version = $rr->version;\n$rr->version( $version );\n\nThe version of EDNS supported by this OPT record.\n\nsize\n$size = $packet->edns->size;\n$more = $packet->edns->size(1280);\n",
            "subsections": [
                {
                    "name": "size",
                    "content": "stack of the originating host.\n\nrcode\n$extendedrcode   = $packet->header->rcode;\n$incompletercode = $packet->edns->rcode;\n\nThe 12 bit extended RCODE. The most significant 8 bits reside in the OPT record. The least\nsignificant 4 bits can only be obtained from the packet header.\n\nflags\n$ednsflags = $packet->edns->flags;\n\n$do = $packet->header->do;\n$packet->header->do(1);\n\n16 bit field containing EDNS extended header flags.\n\noptions, option\n@option = $packet->edns->options;\n\n$octets = $packet->edns->option($optioncode);\n\n$packet->edns->option( COOKIE => $octets );\n$packet->edns->option( 10     => $octets );\n\nWhen called in a list context, options() returns a list of option codes found in the OPT record.\n\nWhen called in a scalar context with a single argument, option() returns the uninterpreted octet\nstring corresponding to the specified option. The method returns undef if the specified option\nis absent.\n\nOptions can be added or replaced by providing the (name => value) pair. The option is deleted if\nthe value is undefined.\n\nWhen option() is called in a list context with a single argument, the returned values provide a\nstructured interpretation appropriate to the specified option.\n\nFor example:\n\n@algorithms = $packet->edns->option('DAU');\n\nFor some options, a hash table is more convenient:\n\n%hashtable = $packet->edns->option(15);\n$infocode  = $hashtable{'INFO-CODE'};\n$extratext = $hashtable{'EXTRA-TEXT'};\n\nSimilar forms of array or hash syntax may be used to construct the option value:\n\n$packet->edns->option( DHU => [1, 2, 4] );\n\n$packet->edns->option( EXPIRE => {'EXPIRE-TIMER' => 604800} );\n"
                }
            ]
        },
        "COPYRIGHT": {
            "content": "Copyright (c)2001,2002 RIPE NCC. Author Olaf M. Kolkman.\n\nPortions Copyright (c)2012,2017-2020 Dick Franks.\n\nAll rights reserved.\n\nPackage template (c)2009,2012 O.M.Kolkman and R.W.Franks.\n",
            "subsections": []
        },
        "LICENSE": {
            "content": "Permission to use, copy, modify, and distribute this software and its documentation for any\npurpose and without fee is hereby granted, provided that the original copyright notices appear\nin all copies and that both copyright notice and this permission notice appear in supporting\ndocumentation, and that the name of the author not be used in advertising or publicity\npertaining to distribution of the software without specific prior written permission.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING\nBUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\nDAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "perl, Net::DNS, Net::DNS::RR, RFC6891, RFC3225\n",
            "subsections": []
        }
    },
    "summary": "Net::DNS::RR::OPT - DNS OPT resource record",
    "flags": [],
    "examples": [],
    "see_also": []
}