Package dns :: Module rcode
[hide private]
[frames] | no frames]

Module rcode

source code

DNS Result Codes.

Classes [hide private]
  UnknownRcode
A DNS rcode is unknown.
Functions [hide private]
 
from_text(text)
Convert text into an rcode.
source code
 
from_flags(flags, ednsflags)
Return the rcode value encoded by flags and ednsflags.
source code
 
to_flags(value)
Return a (flags, ednsflags) tuple which encodes the rcode.
source code
 
to_text(value)
Convert rcode into text.
source code
Variables [hide private]
  NOERROR = 0
  FORMERR = 1
  SERVFAIL = 2
  NXDOMAIN = 3
  NOTIMP = 4
  REFUSED = 5
  YXDOMAIN = 6
  YXRRSET = 7
  NXRRSET = 8
  NOTAUTH = 9
  NOTZONE = 10
  BADVERS = 16
  _by_text = {'BADVERS': 16, 'FORMERR': 1, 'NOERROR': 0, 'NOTAUT...
  _by_value = {0: 'NOERROR', 1: 'FORMERR', 2: 'SERVFAIL', 3: 'NX...
  __package__ = 'dns'
Function Details [hide private]

from_text(text)

source code 

Convert text into an rcode.

*text*, a ``text``, the textual rcode or an integer in textual form.

Raises ``dns.rcode.UnknownRcode`` if the rcode mnemonic is unknown.

Returns an ``int``.

from_flags(flags, ednsflags)

source code 

Return the rcode value encoded by flags and ednsflags.

*flags*, an ``int``, the DNS flags field.

*ednsflags*, an ``int``, the EDNS flags field.

Raises ``ValueError`` if rcode is < 0 or > 4095

Returns an ``int``.

to_flags(value)

source code 

Return a (flags, ednsflags) tuple which encodes the rcode.

*value*, an ``int``, the rcode.

Raises ``ValueError`` if rcode is < 0 or > 4095.

Returns an ``(int, int)`` tuple.

to_text(value)

source code 

Convert rcode into text.

*value*, and ``int``, the rcode.

Raises ``ValueError`` if rcode is < 0 or > 4095.

Returns a ``text``.


Variables Details [hide private]

_by_text

Value:
{'BADVERS': 16,
 'FORMERR': 1,
 'NOERROR': 0,
 'NOTAUTH': 9,
 'NOTIMP': 4,
 'NOTZONE': 10,
 'NXDOMAIN': 3,
 'NXRRSET': 8,
...

_by_value

Value:
{0: 'NOERROR',
 1: 'FORMERR',
 2: 'SERVFAIL',
 3: 'NXDOMAIN',
 4: 'NOTIMP',
 5: 'REFUSED',
 6: 'YXDOMAIN',
 7: 'YXRRSET',
...