Message Opcodes

DNS Opcodes describe what kind of operation a DNS message is requesting or replying to. Opcodes are embedded in the flags field in the DNS header.

dns.opcode.QUERY = Opcode.QUERY

An enumeration.

dns.opcode.IQUERY = Opcode.IQUERY

An enumeration.

dns.opcode.STATUS = Opcode.STATUS

An enumeration.

dns.opcode.NOTIFY = Opcode.NOTIFY

An enumeration.

dns.opcode.UPDATE = Opcode.UPDATE

An enumeration.

dns.opcode.from_text(text: str) dns.opcode.Opcode[source]

Convert text into an opcode.

text, a str, the textual opcode

Raises dns.opcode.UnknownOpcode if the opcode is unknown.

Returns an int.

dns.opcode.to_text(value: dns.opcode.Opcode) str[source]

Convert an opcode to text.

value, an int the opcode value,

Raises dns.opcode.UnknownOpcode if the opcode is unknown.

Returns a str.

dns.opcode.from_flags(flags: int) dns.opcode.Opcode[source]

Extract an opcode from DNS message flags.

flags, an int, the DNS flags.

Returns an int.

dns.opcode.to_flags(value: dns.opcode.Opcode) int[source]

Convert an opcode to a value suitable for ORing into DNS message flags.

value, an int, the DNS opcode value.

Returns an int.

dns.opcode.is_update(flags: int) bool[source]

Is the opcode in flags UPDATE?

flags, an int, the DNS message flags.

Returns a bool.