constants Module¶
The constants module defines the various DNS constants, and also provides some utility functions for dealing with these.
-
class
constants.QR[source]¶ Enumerates the possible QR bit values.
-
QUERY= 0¶ QR flag for queries
-
RESPONSE= 1¶ QR flag for responses
-
-
class
constants.OpCode[source]¶ Enumerates the defined DNS operation codes.
-
QUERY= 0¶ OpCode for queries
-
IQUERY= 1¶ OpCode for inverse queries
-
STATUS= 2¶ OpCode for status queries
-
NOTIFY= 4¶ OpCode for NOTIFY messages
-
UPDATE= 5¶ OpCode for UPDATE messages
-
DSO= 6¶ OpCode for DNS Stateful Operation (DSO) messages
-
-
class
constants.RCODE[source]¶ Enumerates the defined DNS response codes.
-
NoError= 0¶ No Error RCODE
-
FormErr= 1¶ Format Error RCODE
-
ServFail= 2¶ Server Failure RCODE
-
NXDomain= 3¶ Non-Existent Domain RCODE
-
NotImp= 4¶ Not Implemented RCODE
-
Refused= 5¶ Query Refused RCODE
-
YXDomain= 6¶ Name Exists when it should not RCODE
-
YXRRSet= 7¶ RR Set Exists when it should not RCODE
-
NXRRSet= 8¶ RR Set that should exist does not RCODE
-
NotAuth= 9¶ Server Not Authoritative for zone / Not Authorized RCODE
-
NotZone= 10¶ Name not contained in zone RCODE
-
DSOTYPENI= 11¶ DSO-TYPE Not Implemented RCODE
-
-
class
constants.Type[source]¶ Enumerates the defined DNS types.
-
A= 1¶ a host address RTYPE
-
NS= 2¶ an authoritative name server RTYPE
-
MD= 3¶ a mail destination RTYPE
-
MF= 4¶ a mail forwarder RTYPE
-
CNAME= 5¶ the canonical name for an alias RTYPE
-
SOA= 6¶ marks the start of a zone of authority RTYPE
-
MB= 7¶ a mailbox domain name RTYPE
-
MG= 8¶ a mail group member RTYPE
-
MR= 9¶ a mail rename domain name RTYPE
-
NULL= 10¶ a null RR RTYPE
-
WKS= 11¶ a well known service description RTYPE
-
PTR= 12¶ a domain name pointer RTYPE
-
HINFO= 13¶ host information RTYPE
-
MINFO= 14¶ mailbox or mail list information RTYPE
-
MX= 15¶ mail exchange RTYPE
-
TXT= 16¶ text strings RTYPE
-
RP= 17¶ for Responsible Person RTYPE
-
AFSDB= 18¶ for AFS Data Base location RTYPE
-
X25= 19¶ for X.25 PSDN address RTYPE
-
ISDN= 20¶ for ISDN address RTYPE
-
RT= 21¶ for Route Through RTYPE
-
NSAP= 22¶ for NSAP address, NSAP style A record RTYPE
-
NSAP_PTR= 23¶ for domain name pointer, NSAP style RTYPE
-
SIG= 24¶ for security signature RTYPE
-
KEY= 25¶ for security key RTYPE
-
PX= 26¶ X.400 mail mapping information RTYPE
-
GPOS= 27¶ Geographical Position RTYPE
-
AAAA= 28¶ IP6 Address RTYPE
-
OPT= 41¶ OPT RTYPE
-
RRSIG= 46¶ RRSIG RTYPE
-
TSIG= 250¶ Transaction Signature
-
IXFR= 251¶ incremental transfer
-
AXFR= 252¶ transfer of an entire zone
-
-
constants.type_name(dns_type: int) → str[source]¶ Converts a numeric type value to a name. This is the symbolic name if we know it (like NS or AAAA), otherwise the RFC 3597 version (TYPE####). Numbers out of range raise a
ValueErrorexception.Parameters: dns_type (str) – Numeric value of a DNS type to convert to string. Returns: String version of the type identifier. Return type: str Raises: ValueErrorif dns_type is not an unsigned 16-bit value.
-
class
constants.Class[source]¶ Enumerates the defined DNS classes.
-
IN= 1¶ Internet class
-
CH= 3¶ Chaos class
-
HS= 4¶ Hesiod class
-
NONE= 254¶ “NONE” class
-
ANY= 255¶ “ANY” class
-
-
constants.class_name(dns_class: int) → str[source]¶ Converts a numeric class value to a name. This is the symbolic name if we know it (like IN or CH), otherwise the RFC 3597 version (CLASS####). Numbers out of range raise a
ValueErrorexception.Parameters: dns_class (str) – Numeric value of a DNS class to convert to string. Returns: String version of the class identifier. Return type: str Raises: ValueErrorif dns_class is not an unsigned 16-bit value.