Go to the latest version of this document.
search in docstrings

Search bar offers the following options:

- Term presence. The below example searches for documents that must contain “foo”, might contain “bar” and must not contain “baz”: `+foo bar -baz`
- Wildcards. The below example searches for documents with words beginning with “foo”: `foo*`
- Search in specific fields. The following search matches all objects in "twisted.mail" that matches “search”: `+qname:twisted.mail.* +search`

  Possible fields: 'name', 'qname' (fully qualified name), 'docstring', and 'kind'. Last two fields are only applicable if "search in docstrings" is enabled.

- Fuzzy matches. The following search matches all documents that have a word within 1 edit distance of “foo”: `foo~1`

Results provided by Lunr.js

# ``twisted`.`names`.`dns`.`Message``

class documentation

`class Message(tputil.FancyEqMixin): (source)`

Constructor: `Message(id, answer, opCode, recDes, ...)`

View In Hierarchy

`Message` contains all the information represented by a single DNS request or response.

Method | `__init__` | No summary
Method | `__repr__` | Generate a repr of this `Message`.
Method | `addQuery` | Add another query to this Message.
Method | `decode` | Undocumented
Method | `encode` | Undocumented
Method | `fromStr` | Decode a byte string in the format described by RFC 1035 into this `Message`.
Method | `lookupRecordType` | Retrieve the `IRecord` implementation for the given record type.
Method | `parseRecords` | Undocumented
Method | `toStr` | Encode this `Message` into a byte string in the format described by RFC
Class Variable | `add` | Undocumented
Class Variable | `compareAttributes` | Undocumented
Class Variable | `headerFmt` | Undocumented
Class Variable | `headerSize` | Undocumented
Class Variable | `ns` | Undocumented
Instance Variable | `additional` | Records containing IP addresses of host names in `answers` and `authority`.
Instance Variable | `answer` | See `__init__`
Instance Variable | `answers` | Records containing the answers to `queries` if this is a response message.
Instance Variable | `auth` | See `__init__`
Instance Variable | `authenticData` | See `__init__`
Instance Variable | `authority` | Records containing information about the authoritative DNS servers for the names in `queries`.
Instance Variable | `checkingDisabled` | See `__init__`
Instance Variable | `id` | See `__init__`
Instance Variable | `maxCompressionPointers` | Per-message cap on the total number of compression-pointer dereferences `decode` will follow across every name in the message before raising `DNSDecodeError`. Defaults to `1000`. Override it on a subclass or individual instance to tune the trade-off between tolerance for legitimately verbose messages and resistance to denial-of-service attacks.
Instance Variable | `maxSize` | See `__init__`
Instance Variable | `opCode` | See `__init__`
Instance Variable | `queries` | The queries which are being asked of or answered by DNS server.
Instance Variable | `rCode` | See `__init__`
Instance Variable | `recAv` | See `__init__`
Instance Variable | `recDes` | See `__init__`
Instance Variable | `trunc` | See `__init__`
Class Variable | `_recordTypes` | Undocumented
Instance Variable | `_fieldNames` | The names of attributes representing non-flag fixed header fields.
Instance Variable | `_flagNames` | The names of attributes representing the flag header fields.
Instance Variable | `_sectionNames` | The names of attributes representing the record sections of this message.

Inherited from `FancyEqMixin`:

Method | `__eq__` | Undocumented
Method | `__ne__` | Undocumented

def __init__(self, id=0, answer=0, opCode=0, recDes=0, recAv=0, auth=0, rCode=OK, trunc=0, maxSize=512, authenticData=0, checkingDisabled=0): (source)

Parameters
id:`int` | A 16 bit identifier assigned by the program that generates any kind of query. This identifier is copied to the corresponding reply and can be used by the requester to match up replies to outstanding queries.
answer:`int` | A one bit field that specifies whether this message is a query (0), or a response (1).
opCode:`int` | A four bit field that specifies kind of query in this message. This value is set by the originator of a query and copied into the response.
recDes:`int` | Recursion Desired - this bit may be set in a query and is copied into the response. If RD is set, it directs the name server to pursue the query recursively. Recursive query support is optional.
recAv:`int` | Recursion Available - this bit is set or cleared in a response and denotes whether recursive query support is available in the name server.
auth:`int` | Authoritative Answer - this bit is valid in responses and specifies that the responding name server is an authority for the domain name in question section.
rCode:`0 <= int < 16` | Undocumented
trunc:`int` | A flag indicating that this message was truncated due to length greater than that permitted on the transmission channel.
maxSize:`int` | The requestor's UDP payload size is the number of octets of the largest UDP payload that can be reassembled and delivered in the requestor's network stack.
authenticData:`int` | A flag indicating in a response that all the data included in the answer and authority portion of the response has been authenticated by the server according to the policies of that server. See RFC2535 section-6.1.
checkingDisabled | A flag indicating in a query that pending (non-authenticated) data is acceptable to the resolver sending the query. See RFC2535 section-6.1.

def __repr__(self) -> `str`: (source)

Generate a repr of this `Message`.

Only includes the non-default fields and sections and only includes flags which are set. The `id` is always shown.

Returns
`str` | The native string repr.

def addQuery(self, name, type=ALL_RECORDS, cls=IN): (source)

Add another query to this Message.

Parameters
name:`bytes` | The name to query.
type:`int` | Query type
cls:`int` | Query class

def decode(self, strio, length=None): (source)

Undocumented

def encode(self, strio): (source)

Undocumented

def fromStr(self, str): (source)

Decode a byte string in the format described by RFC 1035 into this `Message`.

Parameters
str | `bytes`

def lookupRecordType(self, type): (source)

Retrieve the `IRecord` implementation for the given record type.

Parameters
type:`int` | A record type, such as `A` or `NS`.
Returns
`Type[IRecord]` | An object which implements `IRecord` or `None` if none can be found for the given type.

def parseRecords(self, list, num, strio): (source)

Undocumented

def toStr(self): (source)

Encode this `Message` into a byte string in the format described by RFC

Returns
`bytes` | Undocumented

add = (source)

Undocumented

compareAttributes: `tuple[str, ...]` = (source)
overrides `twisted.python.util.FancyEqMixin.compareAttributes`

Undocumented

headerFmt: `str` = (source)

Undocumented

headerSize = (source)

Undocumented

ns = (source)

Undocumented

additional: `list` of `RRHeader` = (source)

Records containing IP addresses of host names in `answers` and `authority`.

answer = (source)

See `__init__`

answers: `list` of `RRHeader` = (source)

Records containing the answers to `queries` if this is a response message.

auth = (source)

See `__init__`

authenticData = (source)

See `__init__`

authority: `list` of `RRHeader` = (source)

Records containing information about the authoritative DNS servers for the names in `queries`.

checkingDisabled = (source)

See `__init__`

id = (source)

See `__init__`

maxCompressionPointers: `int` = (source)

Per-message cap on the total number of compression-pointer dereferences `decode` will follow across every name in the message before raising `DNSDecodeError`. Defaults to `1000`. Override it on a subclass or individual instance to tune the trade-off between tolerance for legitimately verbose messages and resistance to denial-of-service attacks.

maxSize: `int` = (source)

See `__init__`

opCode = (source)

See `__init__`

queries: `list` of `Query` = (source)

The queries which are being asked of or answered by DNS server.

rCode = (source)

See `__init__`

recAv = (source)

See `__init__`

recDes = (source)

See `__init__`

trunc = (source)

See `__init__`

_recordTypes: `dict` = (source)

Undocumented

_fieldNames = (source)

The names of attributes representing non-flag fixed header fields.

_flagNames = (source)

The names of attributes representing the flag header fields.

_sectionNames = (source)

The names of attributes representing the record sections of this message.