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.rdata Namespace Reference

Classes

class  GenericRdata
 
class  Rdata
 
class  RdatatypeExists
 

Functions

def _hexify (data, chunksize=_hex_chunksize)
 
def _base64ify (data, chunksize=_base64_chunksize)
 
def _escapify (qstring)
 
def _truncate_bitmap (what)
 
def get_rdata_class (rdclass, rdtype)
 
def from_text (rdclass, rdtype, tok, origin=None, relativize=True)
 
def from_wire (rdclass, rdtype, wire, current, rdlen, origin=None)
 
def register_type (implementation, rdtype, rdtype_text, is_singleton=False, rdclass=dns.rdataclass.IN)
 

Variables

int _hex_chunksize = 32
 
int _base64_chunksize = 32
 
 __escaped = bytearray(b'"\\')
 
dictionary _rdata_modules = {}
 
string _module_prefix = 'dns.rdtypes'
 
 _import_lock = _threading.Lock()
 

Function Documentation

◆ _base64ify()

def dns.rdata._base64ify (   data,
  chunksize = _base64_chunksize 
)
private
Convert a binary string into its base64 encoding, broken up into chunks
of chunksize characters separated by a space.

Definition at line 53 of file rdata.py.

Referenced by dns.rdtypes.ANY.OPENPGPKEY.OPENPGPKEY.to_text(), dns.rdtypes.IN.DHCID.DHCID.to_text(), dns.rdtypes.IN.IPSECKEY.IPSECKEY.to_text(), dns.rdtypes.ANY.CERT.CERT.to_text(), dns.rdtypes.ANY.RRSIG.RRSIG.to_text(), and dns.rdtypes.dnskeybase.DNSKEYBase.to_text().

◆ _escapify()

def dns.rdata._escapify (   qstring)
private

◆ _hexify()

def dns.rdata._hexify (   data,
  chunksize = _hex_chunksize 
)
private
Convert a binary string into its hex encoding, broken up into chunks
of chunksize characters separated by a space.

Definition at line 40 of file rdata.py.

Referenced by dns.rdtypes.euibase.EUIBase.to_text(), dns.rdtypes.ANY.SSHFP.SSHFP.to_text(), dns.rdtypes.dsbase.DSBase.to_text(), dns.rdtypes.ANY.TLSA.TLSA.to_text(), and dns.rdata.GenericRdata.to_text().

◆ _truncate_bitmap()

def dns.rdata._truncate_bitmap (   what)
private
Determine the index of greatest byte that isn't all zeros, and
return the bitmap that contains all the bytes less than that index.

Definition at line 84 of file rdata.py.

References dns._compat.xrange.

Referenced by dns.rdtypes.IN.WKS.WKS.from_text().

◆ from_text()

def dns.rdata.from_text (   rdclass,
  rdtype,
  tok,
  origin = None,
  relativize = True 
)
Build an rdata object from text format.

This function attempts to dynamically load a class which
implements the specified rdata class and type.  If there is no
class-and-type-specific implementation, the GenericRdata class
is used.

Once a class is chosen, its from_text() class method is called
with the parameters to this function.

If *tok* is a ``text``, then a tokenizer is created and the string
is used as its input.

*rdclass*, an ``int``, the rdataclass.

*rdtype*, an ``int``, the rdatatype.

*tok*, a ``dns.tokenizer.Tokenizer`` or a ``text``.

*origin*, a ``dns.name.Name`` (or ``None``), the
origin to use for relative names.

*relativize*, a ``bool``.  If true, name will be relativized to
the specified origin.

Returns an instance of the chosen Rdata subclass.

Definition at line 344 of file rdata.py.

References dns.rdata.from_wire(), and dns.rdata.get_rdata_class().

Referenced by dns.update.Update._add(), dns.zone._MasterReader._generate_line(), dns.zone._MasterReader._rr_line(), dns.message._TextReader._rr_line(), dns.update.Update.delete(), dns.rrset.from_text_list(), dns.rdataset.from_text_list(), and dns.rdata.Rdata.validate().

◆ from_wire()

def dns.rdata.from_wire (   rdclass,
  rdtype,
  wire,
  current,
  rdlen,
  origin = None 
)
Build an rdata object from wire format

This function attempts to dynamically load a class which
implements the specified rdata class and type.  If there is no
class-and-type-specific implementation, the GenericRdata class
is used.

Once a class is chosen, its from_wire() class method is called
with the parameters to this function.

*rdclass*, an ``int``, the rdataclass.

*rdtype*, an ``int``, the rdatatype.

*wire*, a ``binary``, the wire-format message.

*current*, an ``int``, the offset in wire of the beginning of
the rdata.

*rdlen*, an ``int``, the length of the wire-format rdata

*origin*, a ``dns.name.Name`` (or ``None``).  If not ``None``,
then names will be relativized to this origin.

Returns an instance of the chosen Rdata subclass.

Definition at line 394 of file rdata.py.

References dns.rdata.get_rdata_class(), and dns.wiredata.maybe_wrap().

Referenced by dns.message._WireReader._get_section(), dns.rdata.from_text(), and dns.dnssec.make_ds().

◆ get_rdata_class()

def dns.rdata.get_rdata_class (   rdclass,
  rdtype 
)

◆ register_type()

def dns.rdata.register_type (   implementation,
  rdtype,
  rdtype_text,
  is_singleton = False,
  rdclass = dns.rdataclass.IN 
)
Dynamically register a module to handle an rdatatype.

*implementation*, a module implementing the type in the usual dnspython
way.

*rdtype*, an ``int``, the rdatatype to register.

*rdtype_text*, a ``text``, the textual form of the rdatatype.

*is_singleton*, a ``bool``, indicating if the type is a singleton (i.e.
RRsets of the type can have only one member.)

*rdclass*, the rdataclass of the type, or ``dns.rdataclass.ANY`` if
it applies to all classes.

Definition at line 434 of file rdata.py.

References dns.rdata.get_rdata_class(), and dns.rdatatype.register_type().

Variable Documentation

◆ __escaped

dns.rdata.__escaped = bytearray(b'"\\')
private

Definition at line 63 of file rdata.py.

◆ _base64_chunksize

int dns.rdata._base64_chunksize = 32
private

Definition at line 50 of file rdata.py.

◆ _hex_chunksize

int dns.rdata._hex_chunksize = 32
private

Definition at line 37 of file rdata.py.

◆ _import_lock

dns.rdata._import_lock = _threading.Lock()
private

Definition at line 307 of file rdata.py.

◆ _module_prefix

string dns.rdata._module_prefix = 'dns.rdtypes'
private

Definition at line 306 of file rdata.py.

◆ _rdata_modules

dictionary dns.rdata._rdata_modules = {}
private

Definition at line 305 of file rdata.py.