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

Module rdataclass

source code

DNS Rdata Classes.

Classes [hide private]
  UnknownRdataclass
A DNS class is unknown.
Functions [hide private]
 
from_text(text)
Convert text into a DNS rdata class value.
source code
 
to_text(value)
Convert a DNS rdata type value to text.
source code
 
is_metaclass(rdclass)
True if the specified class is a metaclass.
source code
Variables [hide private]
  RESERVED0 = 0
  IN = 1
  CH = 3
  HS = 4
  NONE = 254
  ANY = 255
  _by_text = {'ANY': 255, 'CH': 3, 'CHAOS': 3, 'HESIOD': 4, 'HS'...
  _by_value = {0: 'RESERVED0', 1: 'IN', 3: 'CH', 4: 'HS', 254: '...
  _metaclasses = {254: True, 255: True}
  _unknown_class_pattern = re.compile(r'(?i)CLASS([0-9]+)$')
  __package__ = 'dns'
Function Details [hide private]

from_text(text)

source code 

Convert text into a DNS rdata class value.

The input text can be a defined DNS RR class mnemonic or instance of the DNS generic class syntax.

For example, "IN" and "CLASS1" will both result in a value of 1.

Raises ``dns.rdatatype.UnknownRdataclass`` if the class is unknown.

Raises ``ValueError`` if the rdata class value is not >= 0 and <= 65535.

Returns an ``int``.

to_text(value)

source code 

Convert a DNS rdata type value to text.

If the value has a known mnemonic, it will be used, otherwise the DNS generic class syntax will be used.

Raises ``ValueError`` if the rdata class value is not >= 0 and <= 65535.

Returns a ``str``.

is_metaclass(rdclass)

source code 

True if the specified class is a metaclass.

The currently defined metaclasses are ANY and NONE.

*rdclass* is an ``int``.


Variables Details [hide private]

_by_text

Value:
{'ANY': 255,
 'CH': 3,
 'CHAOS': 3,
 'HESIOD': 4,
 'HS': 4,
 'IN': 1,
 'INTERNET': 1,
 'NONE': 254,
...

_by_value

Value:
{0: 'RESERVED0', 1: 'IN', 3: 'CH', 4: 'HS', 254: 'NONE', 255: 'ANY'}