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

Module DNS.message

DNS Messages
Classes
Message A DNS message.

Exceptions
BadEDNS Raised if an OPT record occurs somewhere other than the start of the additional data section.
BadTSIG Raised if a TSIG record occurs somewhere other than the end of the additional data section.
ShortHeader Raised if the DNS packet passed to from_wire() is too short.
TrailingJunk Raised if the DNS packet passed to from_wire() has extra junk at the end of it.
UnknownHeaderField Raised if a header field name is not recognized when converting from text into a message.

Function Summary
DNS.message.Message object from_file(f)
Read the next text format message from the specified file.
DNS.message.Message object from_text(text)
Convert the text format message into a message object.
DNS.message.Message object from_wire(wire, keyring, request_mac, xfr, origin, tsig_ctx, multi)
Convert a DNS wire format message into a message object.
DNS.message.Message object make_query(qname, rdtype, rdclass)
Make a query message.
  _header_line(m, tok, section)
Process one line from the text format header section.
  _question_line(m, tok, section)
Process one line from the text format question section.
  _rr_line(m, tok, section)
Process one line from the text format answer, authority, or additional data sections.

Function Details

from_file(f)

Read the next text format message from the specified file.
Parameters:
f - file or string. If f is a string, it is treated as the name of a file to open.
Returns:
DNS.message.Message object
Raises:
UnknownHeaderField -
SyntaxError -

from_text(text)

Convert the text format message into a message object.
Parameters:
text - The text format message.
           (type=string)
Returns:
DNS.message.Message object
Raises:
UnknownHeaderField -
SyntaxError -

from_wire(wire, keyring=None, request_mac='', xfr=False, origin=None, tsig_ctx=None, multi=False)

Convert a DNS wire format message into a message object.
Parameters:
keyring - The keyring to use if the message is signed.
           (type=dict)
request_mac - If the message is a response to a TSIG-signed request, request_mac should be set to the MAC of that request.
           (type=string)
xfr - Is this message part of a zone transfer?
           (type=bool)
origin - If the message is part of a zone transfer, origin should be the origin name of the zone.
           (type=DNS.name.Name object)
tsig_ctx - The ongoing TSIG context, used when validating zone transfers.
           (type=hmac.HMAC object)
multi - Is this message part of a multiple message sequence?
           (type=bool)
Returns:
DNS.message.Message object
Raises:
ShortHeader - The message is less than 12 octets long.
TrailingJunk - There were octets in the message past the end of the proper DNS message.
BadEDNS - An OPT record was in the wrong section, or occurred more than once.
BadTSIG - A TSIG record was not the last record of the additional data section.

make_query(qname, rdtype, rdclass=1)

Make a query message.

The query name, type, and class may all be specified either as objects of the appropriate type, or as strings.

The query will have a randomly choosen query id, and its DNS flags will be set to DNS.flags.RD.
Parameters:
qname - The query name.
           (type=DNS.name.Name object or string)
rdtype - The desired rdata type.
           (type=int)
rdclass - The desired rdata class; the default is class IN.
           (type=int)
Returns:
DNS.message.Message object

_header_line(m, tok, section)

Process one line from the text format header section.

_question_line(m, tok, section)

Process one line from the text format question section.

_rr_line(m, tok, section)

Process one line from the text format answer, authority, or additional data sections.

Generated by Epydoc 1.1 on Tue Jun 17 03:55:13 2003 http://epydoc.sf.net