Message Rcodes

A DNS Rcode describes the result of a DNS request. If EDNS is not in use, then the rcode is encoded solely in the DNS header. If EDNS is in use, then the rcode is encoded using bits form both the header and the EDNS OPT RR.

dns.rcode.NOERROR = Rcode.NOERROR

An enumeration.

dns.rcode.FORMERR = Rcode.FORMERR

An enumeration.

dns.rcode.SERVFAIL = Rcode.SERVFAIL

An enumeration.

dns.rcode.NXDOMAIN = Rcode.NXDOMAIN

An enumeration.

dns.rcode.NOTIMP = Rcode.NOTIMP

An enumeration.

dns.rcode.REFUSED = Rcode.REFUSED

An enumeration.

dns.rcode.YXDOMAIN = Rcode.YXDOMAIN

An enumeration.

dns.rcode.YXRRSET = Rcode.YXRRSET

An enumeration.

dns.rcode.NXRRSET = Rcode.NXRRSET

An enumeration.

dns.rcode.NOTAUTH = Rcode.NOTAUTH

An enumeration.

dns.rcode.NOTZONE = Rcode.NOTZONE

An enumeration.

dns.rcode.BADVERS = Rcode.BADVERS

An enumeration.

dns.rcode.from_text(text)[source]

Convert text into an rcode.

text, a str, the textual rcode or an integer in textual form.

Raises dns.rcode.UnknownRcode if the rcode mnemonic is unknown.

Returns an int.

dns.rcode.to_text(value, tsig=False)[source]

Convert rcode into text.

value, an int, the rcode.

Raises ValueError if rcode is < 0 or > 4095.

Returns a str.

dns.rcode.from_flags(flags, ednsflags)[source]

Return the rcode value encoded by flags and ednsflags.

flags, an int, the DNS flags field.

ednsflags, an int, the EDNS flags field.

Raises ValueError if rcode is < 0 or > 4095

Returns an int.

dns.rcode.to_flags(value)[source]

Return a (flags, ednsflags) tuple which encodes the rcode.

value, an int, the rcode.

Raises ValueError if rcode is < 0 or > 4095.

Returns an (int, int) tuple.