Go to the latest version of this document.

# ``twisted`.`names`.`dns`.`_EDNSMessage``

class documentation

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

Constructor: `_EDNSMessage(id, answer, opCode, auth, ...)`

View In Hierarchy

An EDNS message.

Designed for compatibility with `Message` but with a narrower public interface.

Most importantly, `_EDNSMessage.fromStr` will interpret and remove OPT records that are present in the additional records section.

The OPT records are used to populate certain EDNS specific attributes.

`_EDNSMessage.toStr` will add suitable OPT records to the additional section to represent the extended EDNS information.

See Also
https://tools.ietf.org/html/rfc6891

Method | `__init__` | Construct a new `_EDNSMessage`
Method | `__repr__` | Undocumented
Method | `fromStr` | Decode from wire format, saving flags, values and records to this `_EDNSMessage` instance in place.
Method | `toStr` | Encode to wire format by first converting to a standard `dns.Message`.
Class Variable | `compareAttributes` | Undocumented
Instance Variable | `additional` | See `__init__`
Instance Variable | `answer` | See `__init__`
Instance Variable | `answers` | See `__init__`
Instance Variable | `auth` | See `__init__`
Instance Variable | `authenticData` | See `__init__`
Instance Variable | `authority` | See `__init__`
Instance Variable | `checkingDisabled` | See `__init__`
Instance Variable | `dnssecOK` | See `__init__`
Instance Variable | `ednsVersion` | See `__init__`
Instance Variable | `id` | See `__init__`
Instance Variable | `maxSize` | See `__init__`
Instance Variable | `opCode` | See `__init__`
Instance Variable | `queries` | See `__init__`
Instance Variable | `rCode` | See `__init__`
Instance Variable | `recAv` | See `__init__`
Instance Variable | `recDes` | See `__init__`
Instance Variable | `trunc` | See `__init__`
Class Method | `_fromMessage` | Construct and return a new `_EDNSMessage` whose attributes and records are derived from the attributes and records of `message` (a `Message` instance).
Method | `_toMessage` | Convert to a standard `dns.Message`.
Instance Variable | `_messageFactory` | A constructor of `Message` instances. Called by `_toMessage` and `_fromMessage`.

Inherited from `FancyEqMixin`:

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

def __init__(self, id=0, answer=False, opCode=OP_QUERY, auth=False, trunc=False, recDes=False, recAv=False, rCode=0, ednsVersion=0, dnssecOK=False, authenticData=False, checkingDisabled=False, maxSize=512, queries=None, answers=None, authority=None, additional=None): (source)

Construct a new `_EDNSMessage`

Parameters
id:`int` | A 16 bit identifier assigned by the program that generates any kind of query. This identifier is copied the corresponding reply and can be used by the requester to match up replies to outstanding queries.
answer:`bool` | 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.
auth:`bool` | 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.
trunc:`bool` | Truncation - specifies that this message was truncated due to length greater than that permitted on the transmission channel.
recDes:`bool` | Recursion Desired - this bit may be set in a query and is copied into the response. If set, it directs the name server to pursue the query recursively. Recursive query support is optional.
recAv:`bool` | Recursion Available - this bit is set or cleared in a response, and denotes whether recursive query support is available in the name server.
rCode:`int` | Extended 12-bit RCODE. Derived from the 4 bits defined in RFC1035 4.1.1 and the upper 8bits defined in RFC6891 6.1.3.
ednsVersion:`int` or `None` | Indicates the EDNS implementation level. Set to `None` to prevent any EDNS attributes and options being added to the encoded byte string.
dnssecOK:`bool` | DNSSEC OK bit as defined by RFC3225 3.
authenticData:`bool` | 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.
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.
queries:`list` of `Query` | The `list` of `Query` associated with this message.
answers:`list` of `RRHeader` | The `list` of answers associated with this message.
authority:`list` of `RRHeader` | The `list` of authority records associated with this message.
additional:`list` of `RRHeader` | The `list` of additional records associated with this message.

See Also
RFC1035 section-4.1.1
RFC2535 section-6.1
RFC3225 section-3
RFC6891 section-6.1.3

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

Undocumented

def fromStr(self, bytes): (source)

Decode from wire format, saving flags, values and records to this `_EDNSMessage` instance in place.

Parameters
bytes:`bytes` | The full byte string to be decoded.

def toStr(self): (source)

Encode to wire format by first converting to a standard `dns.Message`.

Returns
A `bytes` string.

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

Undocumented

additional = (source)

See `__init__`

answer = (source)

See `__init__`

answers = (source)

See `__init__`

auth = (source)

See `__init__`

authenticData = (source)

See `__init__`

authority = (source)

See `__init__`

checkingDisabled = (source)

See `__init__`

dnssecOK = (source)

See `__init__`

ednsVersion = (source)

See `__init__`

id = (source)

See `__init__`

maxSize = (source)

See `__init__`

opCode = (source)

See `__init__`

queries = (source)

See `__init__`

rCode = (source)

See `__init__`

recAv = (source)

See `__init__`

recDes = (source)

See `__init__`

trunc = (source)

See `__init__`

@classmethod
def _fromMessage(cls, message): (source)

Construct and return a new `_EDNSMessage` whose attributes and records are derived from the attributes and records of `message` (a `Message` instance).

If present, an `OPT` record will be extracted from the `additional` section and its attributes and options will be used to set the EDNS specific attributes `extendedRCODE`, `ednsVersion`, `dnssecOK`, `ednsOptions`.

The `extendedRCODE` will be combined with `message.rCode` and assigned to `self.rCode`.

Parameters
message:`Message` | The source `Message`.

Returns
`_EDNSMessage` | A new `_EDNSMessage`

def _toMessage(self): (source)

Convert to a standard `dns.Message`.

If `ednsVersion` is not None, an `_OPTHeader` instance containing all the EDNS specific attributes and options will be appended to the list of `additional` records.

Returns
`dns.Message` | A `dns.Message`

_messageFactory = (source)

A constructor of `Message` instances. Called by `_toMessage` and `_fromMessage`.