constants Module¶
The constants module defines the various DNS constants, and also provides some utility functions for dealing with these.
-
constants.QR_QUERY= 0¶ QR flag for queries
-
constants.QR_RESPONSE= 1¶ QR flag for responses
-
constants.OP_QUERY= 0¶ OpCode for queries
-
constants.OP_IQUERY= 1¶ OpCode for inverse queries
-
constants.OP_STATUS= 2¶ OpCode for status queries
-
constants.OP_NOTIFY= 4¶ OpCode for NOTIFY messages
-
constants.OP_UPDATE= 5¶ OpCode for UPDATE messages
-
constants.OP_DSO= 6¶ OpCode for DNS Stateful Operation (DSO) messages
-
constants.OPCODE_NAMES= {0: 'QUERY', 1: 'IQUERY', 2: 'STATUS', 4: 'NOTIFY', 5: 'UPDATE', 6: 'DSO'}¶ Handy dictionary for converting numeric OPCODE into a symbolic name.
-
constants.RCODE_NOERROR= 0¶ No Error RCODE
-
constants.RCODE_FORMERR= 1¶ Format Error RCODE
-
constants.RCODE_SERVFAIL= 2¶ Server Failure RCODE
-
constants.RCODE_NXDOMAIN= 3¶ Non-Existent Domain RCODE
-
constants.RCODE_NOTIMP= 4¶ Not Implemented RCODE
-
constants.RCODE_REFUSED= 5¶ Query Refused RCODE
-
constants.RCODE_YXDOMAIN= 6¶ Name Exists when it should not RCODE
-
constants.RCODE_YXRRSET= 7¶ RR Set Exists when it should not RCODE
-
constants.RCODE_NXRRSET= 8¶ RR Set that should exist does not RCODE
-
constants.RCODE_NOTAUTH= 9¶ Server Not Authoritative for zone / Not Authorized RCODE
-
constants.RCODE_NOTZONE= 10¶ Name not contained in zone RCODE
-
constants.RCODE_DSOTYPENI= 11¶ DSO-TYPE Not Implemented RCODE
-
constants.RCODE_NAMES= {0: 'NoError', 1: 'FormErr', 2: 'ServFail', 3: 'NXDomain', 4: 'NotImp', 5: 'Refused', 6: 'YXDomain', 7: 'YXRRSet', 8: 'NXRRSet', 9: 'NotAuth', 10: 'NotZone', 11: 'DSOTYPENI'}¶ Handy dictionary for converting numeric RCODE into a symbolic name.
-
constants.RTYPE_A= 1¶ a host address RTYPE
-
constants.RTYPE_NS= 2¶ an authoritative name server RTYPE
-
constants.RTYPE_MD= 3¶ a mail destination RTYPE
-
constants.RTYPE_MF= 4¶ a mail forwarder RTYPE
-
constants.RTYPE_CNAME= 5¶ the canonical name for an alias RTYPE
-
constants.RTYPE_SOA= 6¶ marks the start of a zone of authority RTYPE
-
constants.RTYPE_MB= 7¶ a mailbox domain name RTYPE
-
constants.RTYPE_MG= 8¶ a mail group member RTYPE
-
constants.RTYPE_MR= 9¶ a mail rename domain name RTYPE
-
constants.RTYPE_NULL= 10¶ a null RR RTYPE
-
constants.RTYPE_WKS= 11¶ a well known service description RTYPE
-
constants.RTYPE_PTR= 12¶ a domain name pointer RTYPE
-
constants.RTYPE_HINFO= 13¶ host information RTYPE
-
constants.RTYPE_MINFO= 14¶ mailbox or mail list information RTYPE
-
constants.RTYPE_MX= 15¶ mail exchange RTYPE
-
constants.RTYPE_TXT= 16¶ text strings RTYPE
-
constants.RTYPE_RP= 17¶ for Responsible Person RTYPE
-
constants.RTYPE_AFSDB= 18¶ for AFS Data Base location RTYPE
-
constants.RTYPE_X25= 19¶ for X.25 PSDN address RTYPE
-
constants.RTYPE_ISDN= 20¶ for ISDN address RTYPE
-
constants.RTYPE_RT= 21¶ for Route Through RTYPE
-
constants.RTYPE_NSAP= 22¶ for NSAP address, NSAP style A record RTYPE
-
constants.RTYPE_NSAP_PTR= 23¶ for domain name pointer, NSAP style RTYPE
-
constants.RTYPE_SIG= 24¶ for security signature RTYPE
-
constants.RTYPE_KEY= 25¶ for security key RTYPE
-
constants.RTYPE_PX= 26¶ X.400 mail mapping information RTYPE
-
constants.RTYPE_GPOS= 27¶ Geographical Position RTYPE
-
constants.RTYPE_AAAA= 28¶ IP6 Address RTYPE
-
constants.RTYPE_OPT= 41¶ OPT RTYPE
-
constants.RTYPE_RRSIG= 46¶ RRSIG RTYPE
-
constants.RTYPE_TSIG= 250¶ Transaction Signature
-
constants.RTYPE_IXFR= 251¶ incremental transfer
-
constants.RTYPE_AXFR= 252¶ transfer of an entire zone
-
constants.rtype_name(rtype: 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####).
Parameters: rtype (str) – Numeric value of an RTYPE to convert to string. Returns: String version of the RTYPE identifier. Return type: str
-
constants.CLASS_IN= 1¶ Internet class
-
constants.CLASS_CH= 3¶ Chaos class
-
constants.CLASS_HS= 4¶ Hesiod class
-
constants.CLASS_NONE= 254¶ “NONE” class
-
constants.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####).
Parameters: dns_class (str) – Numeric value of a class to convert to string. Returns: String version of the class identifier. Return type: str