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

# Module name

source code

DNS Names.

Classes | [hide private]
| EmptyLabel Raised if a label is empty.
| BadEscape Raised if an escaped code in a text format name is invalid.
| BadPointer Raised if a compression pointer points forward instead of backward.
| BadLabelType Raised if the label type of a wire format name is unknown.
| NeedAbsoluteNameOrOrigin Raised if an attempt is made to convert a non-absolute name to wire when there is also a non-absolute (or missing) origin.
| NameTooLong Raised if a name is > 255 octets long.
| LabelTooLong Raised if a label is > 63 octets long.
| AbsoluteConcatenation Raised if an attempt is made to append anything other than the empty name to an absolute name.
| NoParent Raised if an attempt is made to get the parent of the root name or the empty name.
| Name A DNS name.

Functions | [hide private]
string |
_escapify(label, unicode_mode=False) Escape the characters in label which need it. | source code
_validate_labels(labels) Check for empty labels in the middle of a label sequence, labels that are too long, and for too many labels. | source code
dns.name.Name object |
from_unicode(text, origin=<DNS name .>) Convert unicode text into a Name object. | source code
dns.name.Name object |
from_text(text, origin=<DNS name .>) Convert text into a Name object. | source code
(dns.name.Name object, int) tuple |
from_wire(message, current) Convert possibly compressed wire format into a Name. | source code

Variables | [hide private]
| NAMERELN_NONE = `0`
| NAMERELN_SUPERDOMAIN = `1`
| NAMERELN_SUBDOMAIN = `2`
| NAMERELN_EQUAL = `3`
| NAMERELN_COMMONANCESTOR = `4`
| _escaped = ``{``'``"``'``:` True`,` `'``$``'``:` True`,` `'``(``'``:` True`,` `'``)``'``:` True`,` `'``.``'``:` T`...``
dns.name.Name object | root = `<DNS name .>` The DNS root name.
dns.name.Name object | empty = `<DNS name @>` The empty DNS name.
| __package__ = ``'``dns``'``

Function Details | [hide private]

### _escapify(label, unicode_mode=False) | source code
Escape the characters in label which need it. Parameters: `unicode_mode` - escapify only special and whitespace (<= 0x20) characters Returns: string the escaped string

### _validate_labels(labels) | source code
Check for empty labels in the middle of a label sequence, labels that are too long, and for too many labels. Raises: `NameTooLong` - the name as a whole is too long `LabelTooLong` - an individual label is too long `EmptyLabel` - a label is empty (i.e. the root label) and appears in a position other than the end of the label sequence

### from_unicode(text, origin=<DNS name .>) | source code
Convert unicode text into a Name object. Lables are encoded in IDN ACE form. Returns: dns.name.Name object

### from_wire(message, current) | source code
Convert possibly compressed wire format into a Name. Parameters: `message` (string) - the entire DNS message `current` (int) - the offset of the beginning of the name from the start of the message Returns: (dns.name.Name object, int) tuple a tuple consisting of the name that was read and the number of bytes of the wire format message which were consumed reading it Raises: `dns.name.BadPointer` - a compression pointer did not point backwards in the message `dns.name.BadLabelType` - an invalid label type was encountered.

Variables Details | [hide private]

  ### _escaped Value:
      {'"': True,
       '$': True,
       '(': True,
       ')': True,
       '.': True,
       ';': True,
       '@': True,
       '\\': True}