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

Class Name

object --+
         |
        Name


A DNS name.

The dns.name.Name class represents a DNS name as a tuple of labels. Instances of the class are immutable.
Method Summary
  __init__(self, labels)
Initialize a domain name from a list of labels.
  __add__(self, other)
  __eq__(self, other)
  __ge__(self, other)
  __getitem__(self, index)
  __getslice__(self, start, stop)
  __gt__(self, other)
int __hash__(self)
Return a case-insensitive hash of the name.
  __le__(self, other)
int __len__(self)
The length of the name (in labels).
  __lt__(self, other)
  __ne__(self, other)
a new object with type S, a subtype of T __new__(S, ...)
  __repr__(self)
  __setattr__(self, name, value)
  __str__(self)
  __sub__(self, other)
dns.name.Name object canonicalize(self)
Return a name which is equal to the current name, but is in DNSSEC canonical form.
dns.name.Name object choose_relativity(self, origin, relativize)
Return a name with the relativity desired by the caller.
dns.name.Name object concatenate(self, other)
Return a new name which is the concatenation of self and other.
dns.name.Name object derelativize(self, origin)
If self is a relative name, return a new name which is the concatenation of self and origin.
  fullcompare(self, other)
Compare two names, returning a 3-tuple (relation, order, nlabels).
bool is_absolute(self)
Is the most significant label of this name the root label?
bool is_subdomain(self, other)
Is self a subdomain of other?
bool is_superdomain(self, other)
Is self a superdomain of other?
bool is_wild(self)
Is this name wild? (I.e.
dns.name.Name object relativize(self, origin)
If self is a subdomain of origin, return a new name which is self relative to origin.
tuple split(self, depth)
Split a name into a prefix and suffix at depth.
string to_digestable(self)
Convert name to a format suitable for digesting in hashes.
string to_text(self, omit_final_dot)
Convert name to text format.
  to_wire(self, file, compress, origin)
Convert name to wire format, possibly compressing it.

Instance Variable Summary
  labels - The tuple of labels in the name.

Class Variable Summary
list __slots__
member_descriptor labels

Method Details

__init__(self, labels)
(Constructor)

Initialize a domain name from a list of labels.
Parameters:
labels - the labels
           (type=any iterable whose values are strings)

__hash__(self)
(Hashing function)

Return a case-insensitive hash of the name.
Returns:
int

__len__(self)
(Length operator)

The length of the name (in labels).
Returns:
int

__new__(S, ...)

Returns:
a new object with type S, a subtype of T

canonicalize(self)

Return a name which is equal to the current name, but is in DNSSEC canonical form.
Returns:
dns.name.Name object

choose_relativity(self, origin=None, relativize=True)

Return a name with the relativity desired by the caller. If origin is None, then self is returned. Otherwise, if relativize is true the name is relativized, and if relativize is false the name is derelativized.
Returns:
dns.name.Name object

concatenate(self, other)

Return a new name which is the concatenation of self and other.
Returns:
dns.name.Name object
Raises:
AbsoluteConcatenation - self is absolute and other is not the empty name

derelativize(self, origin)

If self is a relative name, return a new name which is the concatenation of self and origin. Otherwise return self.
Returns:
dns.name.Name object

fullcompare(self, other)

Compare two names, returning a 3-tuple (relation, order, nlabels).

relation describes the relation ship beween the names, and is one of: dns.name.NAMERELN_NONE, dns.name.NAMERELN_SUPERDOMAIN, dns.name.NAMERELN_SUBDOMAIN, dns.name.NAMERELN_EQUAL, or dns.name.NAMERELN_COMMONANCESTOR

order is < 0 if self < other, > 0 if self > other, and == 0 if self == other. A relative name is always less than an absolute name. If both names have the same relativity, then the DNSSEC order relation is used to order them.

nlabels is the number of significant labels that the two names have in common.

is_absolute(self)

Is the most significant label of this name the root label?
Returns:
bool

is_subdomain(self, other)

Is self a subdomain of other?

The notion of subdomain includes equality.
Returns:
bool

is_superdomain(self, other)

Is self a superdomain of other?

The notion of subdomain includes equality.
Returns:
bool

is_wild(self)

Is this name wild? (I.e. Is the least significant label '*'?)
Returns:
bool

relativize(self, origin)

If self is a subdomain of origin, return a new name which is self relative to origin. Otherwise return self.
Returns:
dns.name.Name object

split(self, depth)

Split a name into a prefix and suffix at depth.
Returns:
the tuple (prefix, suffix)
           (type=tuple)

to_digestable(self)

Convert name to a format suitable for digesting in hashes.

The name is canonicalized and converted to uncompressed wire format.
Returns:
string

to_text(self, omit_final_dot=False)

Convert name to text format.
Parameters:
omit_final_dot - If True, don't emit the final dot (denoting the root label) for absolute names. The default is False.
Returns:
string

to_wire(self, file, compress=None, origin=None)

Convert name to wire format, possibly compressing it.
Parameters:
file - the file where the compressed name is emitted (typically a cStringIO file)
           (type=file)
compress - The compression table. If None (the default) names will not be compressed.
           (type=dict)
origin - If the name is relative and origin is not None, then origin will be appended to it.
           (type=dns.name.Name object)
Raises:
NeedAbsoluteNameOrOrigin - All names in wire format are absolute. If self is a relative name, then an origin must be supplied; if it is missing, then this exception is raised

Instance Variable Details

labels

The tuple of labels in the name. Each label is a string of up to 63 octets.

Class Variable Details

__slots__

Type:
list
Value:
['labels']                                                             

labels

Type:
member_descriptor
Value:
<member 'labels' of 'Name' objects>                                    

Generated by Epydoc 1.1 on Mon Jun 30 15:54:10 2003 http://epydoc.sf.net