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

Module rdata

source code

DNS rdata.

Classes [hide private]
  Rdata
Base class for all DNS rdata types.
  GenericRdata
Generic Rdata Class
  RdatatypeExists
DNS rdatatype already exists.
Functions [hide private]
 
_hexify(data, chunksize=32)
Convert a binary string into its hex encoding, broken up into chunks of chunksize characters separated by a space.
source code
 
_base64ify(data, chunksize=32)
Convert a binary string into its base64 encoding, broken up into chunks of chunksize characters separated by a space.
source code
 
_escapify(qstring)
Escape the characters in a quoted string which need it.
source code
 
_truncate_bitmap(what)
Determine the index of greatest byte that isn't all zeros, and return the bitmap that contains all the bytes less than that index.
source code
 
get_rdata_class(rdclass, rdtype) source code
 
from_text(rdclass, rdtype, tok, origin=None, relativize=True)
Build an rdata object from text format.
source code
 
from_wire(rdclass, rdtype, wire, current, rdlen, origin=None)
Build an rdata object from wire format
source code
 
register_type(implementation, rdtype, rdtype_text, is_singleton=False, rdclass=1)
Dynamically register a module to handle an rdatatype.
source code
Variables [hide private]
  _hex_chunksize = 32
  _base64_chunksize = 32
  __escaped = bytearray(b'"\\')
  _rdata_modules = {}
  _module_prefix = 'dns.rdtypes'
  _import_lock = _threading.Lock()
  __package__ = 'dns'
Function Details [hide private]

from_text(rdclass, rdtype, tok, origin=None, relativize=True)

source code 

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.

from_wire(rdclass, rdtype, wire, current, rdlen, origin=None)

source code 

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.

register_type(implementation, rdtype, rdtype_text, is_singleton=False, rdclass=1)

source code 

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.