Package dns :: Module node :: Class Node
[hide private]
[frames] | no frames]

Class Node

source code

object --+
         |
        Node

A DNS node.

A node is a set of rdatasets

Instance Methods [hide private]
 
__init__(self)
Initialize a DNS node.
source code
string
to_text(self, name, **kw)
Convert a node to text format.
source code
 
__repr__(self)
repr(x)
source code
bool
__eq__(self, other)
Two nodes are equal if they have the same rdatasets.
source code
 
__ne__(self, other) source code
 
__len__(self) source code
 
__iter__(self) source code
dns.rdataset.Rdataset object
find_rdataset(self, rdclass, rdtype, covers=0, create=False)
Find an rdataset matching the specified properties in the current node.
source code
dns.rdataset.Rdataset object or None
get_rdataset(self, rdclass, rdtype, covers=0, create=False)
Get an rdataset matching the specified properties in the current node.
source code
 
delete_rdataset(self, rdclass, rdtype, covers=0)
Delete the rdataset matching the specified properties in the current node.
source code
 
replace_rdataset(self, replacement)
Replace an rdataset.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Instance Variables [hide private]
list of dns.rdataset.Rdataset objects rdatasets
the node's rdatasets
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

Initialize a DNS node.

Overrides: object.__init__

to_text(self, name, **kw)

source code 

Convert a node to text format.

Each rdataset at the node is printed. Any keyword arguments to this method are passed on to the rdataset's to_text() method.

Parameters:
  • name (dns.name.Name object) - the owner name of the rdatasets
Returns: string

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: object.__repr__
(inherited documentation)

find_rdataset(self, rdclass, rdtype, covers=0, create=False)

source code 

Find an rdataset matching the specified properties in the current node.

Parameters:
  • rdclass (int) - The class of the rdataset
  • rdtype (int) - The type of the rdataset
  • covers (int) - The covered type. Usually this value is dns.rdatatype.NONE, but if the rdtype is dns.rdatatype.SIG or dns.rdatatype.RRSIG, then the covers value will be the rdata type the SIG/RRSIG covers. The library treats the SIG and RRSIG types as if they were a family of types, e.g. RRSIG(A), RRSIG(NS), RRSIG(SOA). This makes RRSIGs much easier to work with than if RRSIGs covering different rdata types were aggregated into a single RRSIG rdataset.
  • create (bool) - If True, create the rdataset if it is not found.
Returns: dns.rdataset.Rdataset object
Raises:
  • KeyError - An rdataset of the desired type and class does not exist and create is not True.

get_rdataset(self, rdclass, rdtype, covers=0, create=False)

source code 

Get an rdataset matching the specified properties in the current node.

None is returned if an rdataset of the specified type and class does not exist and create is not True.

Parameters:
  • rdclass (int) - The class of the rdataset
  • rdtype (int) - The type of the rdataset
  • covers (int) - The covered type.
  • create (bool) - If True, create the rdataset if it is not found.
Returns: dns.rdataset.Rdataset object or None

delete_rdataset(self, rdclass, rdtype, covers=0)

source code 

Delete the rdataset matching the specified properties in the current node.

If a matching rdataset does not exist, it is not an error.

Parameters:
  • rdclass (int) - The class of the rdataset
  • rdtype (int) - The type of the rdataset
  • covers (int) - The covered type.

replace_rdataset(self, replacement)

source code 

Replace an rdataset.

It is not an error if there is no rdataset matching replacement.

Ownership of the replacement object is transferred to the node; in other words, this method does not store a copy of replacement at the node, it stores replacement itself.