/usr/lib/python3.9/site-packages/dns
NameSizeModeActions
dnssecalgs/-0755rm
quic/-0755rm
rdtypes/-0755rm
__pycache__/-0755rm
asyncbackend.py27960644editdlrm
asyncquery.py268500644editdlrm
asyncresolver.py178520644editdlrm
dnssec.py406930644editdlrm
dnssectypes.py17990644editdlrm
e164.py39780644editdlrm
edns.py152630644editdlrm
entropy.py42420644editdlrm
enum.py36910644editdlrm
exception.py59570644editdlrm
flags.py27500644editdlrm
grange.py21480644editdlrm
immutable.py20170644editdlrm
inet.py57720644editdlrm
ipv4.py25520644editdlrm
ipv6.py66000644editdlrm
message.py659930644editdlrm
name.py426720644editdlrm
namedict.py40000644editdlrm
nameserver.py99090644editdlrm
node.py126630644editdlrm
opcode.py27300644editdlrm
query.py548320644editdlrm
rcode.py41560644editdlrm
rdata.py294560644editdlrm
rdataclass.py29840644editdlrm
rdataset.py167560644editdlrm
rdatatype.py73390644editdlrm
renderer.py112540644editdlrm
resolver.py735520644editdlrm
reversename.py38280644editdlrm
rrset.py91700644editdlrm
serial.py36060644editdlrm
set.py90880644editdlrm
tokenizer.py235830644editdlrm
transaction.py226360644editdlrm
tsig.py114130644editdlrm
tsigkeyring.py26330644editdlrm
ttl.py29790644editdlrm
update.py122430644editdlrm
version.py19260644editdlrm
versioned.py117650644editdlrm
win32util.py91070644editdlrm
wire.py28300644editdlrm
xfr.py132730644editdlrm
zone.py520860644editdlrm
zonefile.py279290644editdlrm
zonetypes.py6900644editdlrm
_asyncbackend.py23600644editdlrm
_asyncio_backend.py89710644editdlrm
_ddr.py52470644editdlrm
_features.py23840644editdlrm
_immutable_ctx.py24590644editdlrm
__init__.py16630644editdlrm
Edit: /usr/lib/python3.9/site-packages/dns/opcode.py (2730B)
# Copyright (C) Dnspython Contributors, see LICENSE for text of ISC license # Copyright (C) 2001-2017 Nominum, Inc. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose with or without fee is hereby granted, # provided that the above copyright notice and this permission notice # appear in all copies. # # THE SOFTWARE IS PROVIDED "AS IS" AND NOMINUM DISCLAIMS ALL WARRANTIES # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL NOMINUM BE LIABLE FOR # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. """DNS Opcodes.""" import dns.enum import dns.exception class Opcode(dns.enum.IntEnum): #: Query QUERY = 0 #: Inverse Query (historical) IQUERY = 1 #: Server Status (unspecified and unimplemented anywhere) STATUS = 2 #: Notify NOTIFY = 4 #: Dynamic Update UPDATE = 5 @classmethod def _maximum(cls): return 15 @classmethod def _unknown_exception_class(cls): return UnknownOpcode class UnknownOpcode(dns.exception.DNSException): """An DNS opcode is unknown.""" def from_text(text: str) -> Opcode: """Convert text into an opcode. *text*, a ``str``, the textual opcode Raises ``dns.opcode.UnknownOpcode`` if the opcode is unknown. Returns an ``int``. """ return Opcode.from_text(text) def from_flags(flags: int) -> Opcode: """Extract an opcode from DNS message flags. *flags*, an ``int``, the DNS flags. Returns an ``int``. """ return Opcode((flags & 0x7800) >> 11) def to_flags(value: Opcode) -> int: """Convert an opcode to a value suitable for ORing into DNS message flags. *value*, an ``int``, the DNS opcode value. Returns an ``int``. """ return (value << 11) & 0x7800 def to_text(value: Opcode) -> str: """Convert an opcode to text. *value*, an ``int`` the opcode value, Raises ``dns.opcode.UnknownOpcode`` if the opcode is unknown. Returns a ``str``. """ return Opcode.to_text(value) def is_update(flags: int) -> bool: """Is the opcode in flags UPDATE? *flags*, an ``int``, the DNS message flags. Returns a ``bool``. """ return from_flags(flags) == Opcode.UPDATE ### BEGIN generated Opcode constants QUERY = Opcode.QUERY IQUERY = Opcode.IQUERY STATUS = Opcode.STATUS NOTIFY = Opcode.NOTIFY UPDATE = Opcode.UPDATE ### END generated Opcode constants