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

An enumeration.

dns.rcode.FORMERR = <Rcode.FORMERR: 1>

An enumeration.

dns.rcode.SERVFAIL = <Rcode.SERVFAIL: 2>

An enumeration.

dns.rcode.NXDOMAIN = <Rcode.NXDOMAIN: 3>

An enumeration.

dns.rcode.NOTIMP = <Rcode.NOTIMP: 4>

An enumeration.

dns.rcode.REFUSED = <Rcode.REFUSED: 5>

An enumeration.

dns.rcode.YXDOMAIN = <Rcode.YXDOMAIN: 6>

An enumeration.

dns.rcode.YXRRSET = <Rcode.YXRRSET: 7>

An enumeration.

dns.rcode.NXRRSET = <Rcode.NXRRSET: 8>

An enumeration.

dns.rcode.NOTAUTH = <Rcode.NOTAUTH: 9>

An enumeration.

dns.rcode.NOTZONE = <Rcode.NOTZONE: 10>

An enumeration.

dns.rcode.BADVERS = <Rcode.BADVERS: 16>

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.