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: 0>

An enumeration.

dns.opcode.IQUERY = <Opcode.IQUERY: 1>

An enumeration.

dns.opcode.STATUS = <Opcode.STATUS: 2>

An enumeration.

dns.opcode.NOTIFY = <Opcode.NOTIFY: 4>

An enumeration.

dns.opcode.UPDATE = <Opcode.UPDATE: 5>

An enumeration.

dns.opcode.from_text(text)[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)[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)[source]

Extract an opcode from DNS message flags.

flags, an int, the DNS flags.

Returns an int.

dns.opcode.to_flags(value)[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)[source]

Is the opcode in flags UPDATE?

flags, an int, the DNS message flags.

Returns a bool.