Home | Trees | Index | Help |
|
---|
Package dns :: Module renderer :: Class Renderer |
|
object
--+
|
Renderer
Helper class for building DNS wire-format messages.
Most applications can use the higher-level dns.message.Message
class and its to_wire()
method to generate wire-format messages. This class is for those
applications which need finer control over the generation of
messages.
r = dns.renderer.Renderer(id=1, flags=0x80, max_size=512) r.add_question(qname, qtype, qclass) r.add_rrset(dns.renderer.ANSWER, rrset_1) r.add_rrset(dns.renderer.ANSWER, rrset_2) r.add_rrset(dns.renderer.AUTHORITY, ns_rrset) r.add_edns(0, 0, 4096) r.add_rrset(dns.renderer.ADDTIONAL, ad_rrset_1) r.add_rrset(dns.renderer.ADDTIONAL, ad_rrset_2) r.write_header() r.add_tsig(keyname, secret, 300, 1, 0, '', request_mac) wire = r.get_wire()
Method Summary | |
---|---|
Initialize a new renderer. | |
Add an EDNS OPT record to the message. | |
Add a question to the message. | |
Add the rdataset to the specified section, using the specified name as the owner name. | |
Add the rrset to the specified section. | |
Add a TSIG signature to the message. | |
string |
Return the wire format message. |
Write the DNS message header. | |
Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
x.__hash__() <==> hash(x) | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
helper for pickle | |
helper for pickle | |
x.__repr__() <==> repr(x) | |
x.__setattr__('name', value) <==> x.name = value | |
x.__str__() <==> str(x) |
Instance Variable Summary | |
---|---|
dict | compress : the compression table |
int list of length 4 | counts : list of the number of RRs in each section |
int | flags : the message flags |
int | id : the message id |
string | mac : the MAC of the rendered message (if TSIG was used) |
int | max_size : the maximum size of the message |
dns.name.Name object | origin : the origin to use when rendering relative names |
cStringIO.StringIO object | output : where rendering is written |
int (dns.renderer.QUESTION, dns.renderer.ANSWER, dns.renderer.AUTHORITY, or dns.renderer.ADDITIONAL) | section : the section currently being rendered |
Method Details |
---|
__init__(self,
id=None,
flags=0,
max_size=65535,
origin=None)
Initialize a new renderer.
|
add_edns(self, edns, ednsflags, payload)Add an EDNS OPT record to the message.
|
add_question(self, qname, rdtype, rdclass=1)Add a question to the message.
|
add_rdataset(self, section, name, rdataset, **kw)Add the rdataset to the specified section, using the specified name as the owner name. Any keyword arguments are passed on to the rdataset's to_wire() routine.
|
add_rrset(self, section, rrset, **kw)Add the rrset to the specified section. Any keyword arguments are passed on to the rdataset's to_wire() routine.
|
add_tsig(self, keyname, secret, fudge, id, tsig_error, other_data, request_mac)Add a TSIG signature to the message.
|
get_wire(self)Return the wire format message.
|
write_header(self)Write the DNS message header. Writing the DNS message header is done asfter all sections have been rendered, but before the optional TSIG signature is added. |
Instance Variable Details |
---|
compressthe compression table
|
countslist of the number of RRs in each section
|
flagsthe message flags
|
idthe message id
|
macthe MAC of the rendered message (if TSIG was used)
|
max_sizethe maximum size of the message
|
originthe origin to use when rendering relative names
|
outputwhere rendering is written
|
sectionthe section currently being rendered
|
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Thu Apr 1 12:10:12 2004 | http://epydoc.sf.net |