dnspython  1.16.0
About: dnspython is a DNS toolkit (for Python 2.x) that supports almost all record types.
  Fossies Dox: dnspython-1.16.0.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

dns.rdataclass Namespace Reference

Classes

class  UnknownRdataclass
 

Functions

def from_text (text)
 
def to_text (value)
 
def is_metaclass (rdclass)
 

Variables

int RESERVED0 = 0
 
int IN = 1
 
int CH = 3
 
int HS = 4
 
int NONE = 254
 
int ANY = 255
 
dictionary _by_text
 
dictionary _by_value = {y: x for x, y in _by_text.items()}
 
dictionary _metaclasses
 
 _unknown_class_pattern = re.compile('CLASS([0-9]+)$', re.I)
 

Function Documentation

◆ from_text()

def dns.rdataclass.from_text (   text)
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``.

Definition at line 67 of file rdataclass.py.

Referenced by dns.zone._MasterReader._generate_line(), dns.message._TextReader._question_line(), dns.zone._MasterReader._rr_line(), dns.message._TextReader._rr_line(), dns.rrset.from_text_list(), dns.rdataset.from_text_list(), dns.message.make_query(), and dns.resolver.Resolver.query().

◆ is_metaclass()

def dns.rdataclass.is_metaclass (   rdclass)
True if the specified class is a metaclass.

The currently defined metaclasses are ANY and NONE.

*rdclass* is an ``int``.

Definition at line 112 of file rdataclass.py.

Referenced by dns.resolver.Resolver.query().

◆ to_text()

def dns.rdataclass.to_text (   value)
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``.

Definition at line 93 of file rdataclass.py.

Referenced by dns.rdataset.Rdataset.__repr__(), dns.rdata.Rdata.__repr__(), dns.rdata.get_rdata_class(), and dns.rdataset.Rdataset.to_text().

Variable Documentation

◆ _by_text

dictionary dns.rdataclass._by_text
private
Initial value:
1 = {
2  'RESERVED0': RESERVED0,
3  'IN': IN,
4  'CH': CH,
5  'HS': HS,
6  'NONE': NONE,
7  'ANY': ANY
8 }

Definition at line 31 of file rdataclass.py.

◆ _by_value

dictionary dns.rdataclass._by_value = {y: x for x, y in _by_text.items()}
private

Definition at line 44 of file rdataclass.py.

◆ _metaclasses

dictionary dns.rdataclass._metaclasses
private
Initial value:
1 = {
2  NONE: True,
3  ANY: True
4 }

Definition at line 55 of file rdataclass.py.

◆ _unknown_class_pattern

dns.rdataclass._unknown_class_pattern = re.compile('CLASS([0-9]+)$', re.I)
private

Definition at line 60 of file rdataclass.py.

◆ ANY

int dns.rdataclass.ANY = 255

Definition at line 29 of file rdataclass.py.

◆ CH

int dns.rdataclass.CH = 3

Definition at line 26 of file rdataclass.py.

◆ HS

int dns.rdataclass.HS = 4

Definition at line 27 of file rdataclass.py.

◆ IN

int dns.rdataclass.IN = 1

Definition at line 25 of file rdataclass.py.

◆ NONE

int dns.rdataclass.NONE = 254

Definition at line 28 of file rdataclass.py.

◆ RESERVED0

int dns.rdataclass.RESERVED0 = 0

Definition at line 24 of file rdataclass.py.