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]
int
from_text(text)
Convert text into an rcode.
source code
int
from_flags(flags, ednsflags)
Return the rcode value encoded by flags and ednsflags.
source code
(int, int) tuple
to_flags(value)
Return a (flags, ednsflags) tuple which encodes the rcode.
source code
string
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.

Parameters:
  • text (string) - the textual rcode
Returns: int
Raises:

from_flags(flags, ednsflags)

source code 

Return the rcode value encoded by flags and ednsflags.

Parameters:
  • flags (int) - the DNS flags
  • ednsflags (int) - the EDNS flags
Returns: int
Raises:
  • ValueError - rcode is < 0 or > 4095

to_flags(value)

source code 

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

Parameters:
  • value (int) - the rcode
Returns: (int, int) tuple
Raises:
  • ValueError - rcode is < 0 or > 4095

to_text(value)

source code 

Convert rcode into text.

Parameters:
  • value (int) - the rcode
Returns: string

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',
...