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
dns.opcode.IQUERY = Opcode.IQUERY
dns.opcode.STATUS = Opcode.STATUS
dns.opcode.NOTIFY = Opcode.NOTIFY
dns.opcode.UPDATE = Opcode.UPDATE
dns.opcode.from_text(text: str) 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: 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) Opcode[source]

Extract an opcode from DNS message flags.

flags, an int, the DNS flags.

Returns an int.

dns.opcode.to_flags(value: 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.