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
Generate Rdata Class
Functions [hide private]
string
_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
string
_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
string
_escapify(qstring)
Escape the characters in a quoted string which need it.
source code
string
_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
dns.rdata.Rdata instance
from_text(rdclass, rdtype, tok, origin=None, relativize=True)
Build an rdata object from text format.
source code
dns.rdata.Rdata instance
from_wire(rdclass, rdtype, wire, current, rdlen, origin=None)
Build an rdata object from wire format
source code
Variables [hide private]
  _hex_chunksize = 32
  _base64_chunksize = 32
  __escaped = bytearray(b'"\\')
dict _rdata_modules = {}
A dictionary mapping a (rdclass, rdtype) tuple to the module which implements that type.
string _module_prefix = 'dns.rdtypes'
The prefix to use when forming modules names.
  __package__ = 'dns'
int _hex_chunk
At most this many octets that will be represented in each chunk of hexstring that _hexify() produces before whitespace occurs.
Function Details [hide private]

_hexify(data, chunksize=32)

source code 

Convert a binary string into its hex encoding, broken up into chunks of chunksize characters separated by a space.

Parameters:
Returns: string

_base64ify(data, chunksize=32)

source code 

Convert a binary string into its base64 encoding, broken up into chunks of chunksize characters separated by a space.

Parameters:
Returns: string

_escapify(qstring)

source code 

Escape the characters in a quoted string which need it.

Parameters:
  • qstring (string) - the string
Returns: string
the escaped string

_truncate_bitmap(what)

source code 

Determine the index of greatest byte that isn't all zeros, and return the bitmap that contains all the bytes less than that index.

Parameters:
  • what (string) - a string of octets representing a bitmap.
Returns: string

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 string, then a tokenizer is created and the string is used as its input.

Parameters:
  • rdclass (int) - The rdata class
  • rdtype (int) - The rdata type
  • tok (dns.tokenizer.Tokenizer or string) - The tokenizer or input text
  • origin (dns.name.Name) - The origin to use for relative names
  • relativize (bool) - Should names be relativized?
Returns: dns.rdata.Rdata instance

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.

Parameters:
  • rdclass (int) - The rdata class
  • rdtype (int) - The rdata type
  • wire (string) - The wire-format message
  • current (int) - The offset in wire of the beginning of the rdata.
  • rdlen (int) - The length of the wire-format rdata
  • origin (dns.name.Name) - The origin to use for relative names
Returns: dns.rdata.Rdata instance

Variables Details [hide private]

_module_prefix

The prefix to use when forming modules names. The default is 'dns.rdtypes'. Changing this value will break the library.
Type:
string
Value:
'dns.rdtypes'