Package DNS :: Module message :: Class Message
[show private | hide private]
[frames | no frames]

Class Message

object --+
         |
        Message

Known Subclasses:
Update

A DNS message.
Method Summary
  __init__(self)
bool __eq__(self, other)
Two messages are equal if they have the same content in the header, question, answer, and authority sections.
bool __ne__(self, other)
Are two messages not equal?
a new object with type S, a subtype of T __new__(S, ...)
  __repr__(self)
  __str__(self)
DNS.node.Node object find_node(self, section, name, create, force_unique)
Find the node named namein the specified section.
  get_question(self, qcount)
Read the next qcountrecords from the wire data and add them to the question section.
  get_section(self, section, count)
Read the next countrecords from the wire data and add them to the specified section.
bool is_response(self, other)
Is other a response to self?
  rcode(self)
string to_wire(self, origin)
Return a string containing the message in DNS compressed wire format.
  use_edns(self, edns, ednsflags, payload)
Configure EDNS behavior.
  use_tsig(self, keyring, keyname)
When sending, a TSIG signature using the specified keyring and keyname should be added.

Instance Variable Summary
list of DNS.node.Node objects additional - The additional data section.
list of DNS.node.Node objects answer - The answer section.
list of DNS.node.Node objects authority - The authority section.
int current - When building a message object from wire format, this variable contains the offset from the beginning of wire of the next octet to be read.
int edns - The EDNS level to use.
int ednsflags - The EDNS flags
int flags - The DNS flags of the message.
int fudge - TSIG time fudge; default is 300 seconds.
bool had_tsig - Did the message decoded from wire format have a TSIG signature?
int id - The query id; the default is a randomly chosen id.
DNS.name.Name object keyname - The TSIG keyname to use.
dict keyring - The TSIG keyring to use.
DNS.name.Name object last_name - The most recently read name when building a message object from text format.
string mac - The TSIG MAC for this message.
bool multi - Is this message part of a multi-message sequence? The default is false.
DNS.name.Name object origin - The origin of the zone in messages which are used for zone transfers or for DNS dynamic updates.
string other_data - TSIG other data.
int payload - The EDNS payload size.
list of DNS.node.Node objects question - The question section.
string request_mac - The TSIG MAC of the request message associated with this message; used when validating TSIG signatures.
hmac.HMAC object tsig_ctx - The TSIG signature context associated with this message.
int tsig_error - TSIG error code; default is 0.
string wire - When building a message object from wire format, this variable contains the wire-format message.
bool xfr - Is the message being used to contain the results of a DNS zone transfer? The default is False.
int zone_rdclass - The class of the zone in messages which are used for zone transfers or for DNS dynamic updates.

Method Details

__eq__(self, other)
(Equality operator)

Two messages are equal if they have the same content in the header, question, answer, and authority sections.
Returns:
bool

__ne__(self, other)

Are two messages not equal?
Returns:
bool

__new__(S, ...)

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

find_node(self, section, name, create=False, force_unique=False)

Find the node named name in the specified section.
Parameters:
section - the section of the message to look in, e.g. self.answer.
           (type=list of DNS.node.Node objects)
name - the name of the node to find
           (type=DNS.name.Name object)
create - If True, create the node if it is not found, unless force_unique is also True, in which case always create a new node. The created node is appended to section.
           (type=bool)
force_unique - If create is True, always create the node, even if it already exists.
           (type=bool)
Returns:
DNS.node.Node object

get_question(self, qcount)

Read the next qcount records from the wire data and add them to the question section.
Parameters:
qcount - the number of questions in the message
           (type=int)

get_section(self, section, count)

Read the next count records from the wire data and add them to the specified section.
Parameters:
section - the section of the message to which to add records
           (type=list of DNS.node.Node objects)
count - the number of records to read
           (type=int)

is_response(self, other)

Is other a response to self?
Returns:
bool

to_wire(self, origin=None)

Return a string containing the message in DNS compressed wire format.
Parameters:
origin - The origin to be appended to any relative names.
           (type=DNS.name.Name object)
Returns:
string

use_edns(self, edns, ednsflags, payload)

Configure EDNS behavior.
Parameters:
edns - The EDNS level to use. Specifying None or -1 means 'do not use EDNS'.
           (type=int or None)
ednsflags - EDNS flag values.
           (type=int)
payload - The EDNS sender's payload field, which is the maximum size of UDP datagram the sender can handle.
           (type=int)

See also: RFC 2671

use_tsig(self, keyring, keyname=None)

When sending, a TSIG signature using the specified keyring and keyname should be added.
Parameters:
keyring - The TSIG keyring to use; defaults to None.
           (type=dict)
keyname - The name of the TSIG key to use; defaults to None. The key must be defined in the keyring. If a keyring is specified but a keyname is not, then the key used will be the first key in the keyring. Note that the order of keys in a dictionary is not defined, so applications should supply a keyname when a keyring is used, unless they know the keyring contains only one key.
           (type=DNS.name.Name or string)

Instance Variable Details

additional

The additional data section.
Type:
list of DNS.node.Node objects

answer

The answer section.
Type:
list of DNS.node.Node objects

authority

The authority section.
Type:
list of DNS.node.Node objects

current

When building a message object from wire format, this variable contains the offset from the beginning of wire of the next octet to be read.
Type:
int

edns

The EDNS level to use. The default is -1, no EDNS.
Type:
int

ednsflags

The EDNS flags
Type:
int

flags

The DNS flags of the message. @see: RFC 1035 for an explanation of these flags.
Type:
int

fudge

TSIG time fudge; default is 300 seconds.
Type:
int

had_tsig

Did the message decoded from wire format have a TSIG signature?
Type:
bool

id

The query id; the default is a randomly chosen id.
Type:
int

keyname

The TSIG keyname to use. The default is None.
Type:
DNS.name.Name object

keyring

The TSIG keyring to use. The default is None.
Type:
dict

last_name

The most recently read name when building a message object from text format.
Type:
DNS.name.Name object

mac

The TSIG MAC for this message.
Type:
string

multi

Is this message part of a multi-message sequence? The default is false. This variable is used when validating TSIG signatures on messages which are part of a zone transfer.
Type:
bool

origin

The origin of the zone in messages which are used for zone transfers or for DNS dynamic updates. The default is None.
Type:
DNS.name.Name object

other_data

TSIG other data.
Type:
string

payload

The EDNS payload size. The default is 0.
Type:
int

question

The question section.
Type:
list of DNS.node.Node objects

request_mac

The TSIG MAC of the request message associated with this message; used when validating TSIG signatures. @see: RFC 2845 for more information on TSIG fields.
Type:
string

tsig_ctx

The TSIG signature context associated with this message. The default is None.
Type:
hmac.HMAC object

tsig_error

TSIG error code; default is 0.
Type:
int

wire

When building a message object from wire format, this variable contains the wire-format message.
Type:
string

xfr

Is the message being used to contain the results of a DNS zone transfer? The default is False.
Type:
bool

zone_rdclass

The class of the zone in messages which are used for zone transfers or for DNS dynamic updates.
Type:
int

Generated by Epydoc 1.1 on Sat Jun 21 20:52:30 2003 http://epydoc.sf.net