Module state, per query.
This class provides these data attributes:
(query_info) Informations about query being answered. Name, RR type, RR class.
(uint16) Flags for query. See QF_BIT_ predefined constants.
If this is a (stub or root) priming query (with hints).
comm_reply contains server replies.
The rcode, in case of error, instead of a reply message. Determines whether the return_msg contains reply.
Region for this query. Cleared when query process finishes.
Which module is executing.
Module states.
Environment for this query.
Mesh related information for this query.
This class provides these data attributes:
The original question in the wireformat format (e.g. \x03www\x03nic\x02cz\x00 for www.nic.cz)
Lenght of question name (number of bytes).
The question qname converted into list of labels (e.g. [‘www’,’nic’,’cz’,’‘] for www.nic.cz)
The question qname converted into string (e.g. www.nic.cz. for www.nic.cz)
The class type asked for. See RR_TYPE_ predefined constants.
The qtype in display presentation format (string) (e.g ‘A’ for RR_TYPE_A)
The question class. See RR_CLASS_ predefined constants.
The qclass in display presentation format (string).
This class provides these data attributes:
The flags for the answer, host byte order.
Number of RRs in the query section. If qdcount is not 0, then it is 1, and the data that appears in the reply is the same as the query_info. Host byte order.
TTL of the entire reply (for negative caching). only for use when there are 0 RRsets in this message. if there are RRsets, check those instead.
The security status from DNSSEC validation of this message. See sec_status_ predefined constants.
Number of RRsets in each section. The answer section. Add up the RRs in every RRset to calculate the number of RRs, and the count for the dns packet. The number of RRs in RRsets can change due to RRset updates.
Count of authority section RRsets
Count of additional section RRsets
Number of RRsets: an_numrrsets + ns_numrrsets + ar_numrrsets
(ub_packed_rrset_key) List of RR sets in the order in which they appear in the reply message. Number of elements is ancount + nscount + arcount RRsets.
(rrset_ref) Packed array of ids (see counts) and pointers to packed_rrset_key. The number equals ancount + nscount + arcount RRsets. These are sorted in ascending pointer, the locking order. So this list can be locked (and id, ttl checked), to see if all the data is available and recent enough.
Region allocated message reply
This class provides these data attributes:
(query_info) Informations about query.
(reply_info) This attribute points to the packed reply structure.
The identifying information for an RRset.
This class provides these data attributes:
The domain name. If not empty (for id = None) it is allocated, and contains the wireformat domain name. This dname is not canonicalized. E.g., the dname contains \x03www\x03nic\x02cz\x00 for www.nic.cz.
Length of the domain name, including last 0 root octet.
The domain name dname converted into list of labels (see query_info.qname_list).
The domain name dname converted into string (see query_info.qname_str).
Flags.
The rrset type in network format.
The rrset type in display presentation format.
The rrset class in network format.
The rrset class in display presentation format.
This structure contains an RRset. A set of resource records that share the same domain name, type and class. Due to memory management and threading, the key structure cannot be deleted, although the data can be. The id can be set to 0 to store and the structure can be recycled with a new id.
The ub_packed_rrset_key provides these data attributes:
(lruhash_entry) Entry into hashtable. Note the lock is never destroyed, even when this key is retired to the cache. the data pointer (if not None) points to a packed_rrset.
The ID of this rrset. unique, based on threadid + sequenceno. ids are not reused, except after flushing the cache. zero is an unused entry, and never a valid id. Check this value after getting entry.lock. The other values in this struct may only be altered after changing the id (which needs a writelock on entry.lock).
(packed_rrset_key) RR set data.
The ub_packed_rrset_key provides these data attributes:
rwlock for access to the contents of the entry. Note that you cannot change hash and key, if so, you have to delete it to change hash or key.
(packed_rrset_data) entry data stored in wireformat (RRs and RRsigs).
Rdata is stored in wireformat. The dname is stored in wireformat.
TTLs are stored as absolute values (and could be expired).
RRSIGs are stored in the arrays after the regular rrs.
You need the packed_rrset_key to know dname, type, class of the resource records in this RRset. (if signed the rrsig gives the type too).
The packed_rrset_data provides these data attributes:
TTL (in seconds like time()) of the RRset. Same for all RRs see rfc2181(5.2).
Number of RRs.
Number of rrsigs, if 0 no rrsigs.
The trustworthiness of the RRset data.
Security status of the RRset data. See sec_status_ predefined constants.
Length of every RR’s rdata, rr_len[i] is size of rr_data[i].
TTL of every rr. rr_ttl[i] ttl of rr i.
Array of RR’s rdata (list of strings). The rdata is stored in uncompressed wireformat. The first 16B of rr_data[i] is rdlength in network format.
Abstract representation of DNS message.
Usage
This example shows how to create an authoritative answer response
msg = DNSMessage(qstate.qinfo.qname_str, RR_TYPE_A, RR_CLASS_IN, PKT_AA) #append RR if (qstate.qinfo.qtype == RR_TYPE_A) or (qstate.qinfo.qtype == RR_TYPE_ANY): msg.answer.append("%s 10 IN A 127.0.0.1" % qstate.qinfo.qname_str) #set qstate.return_msg if not msg.set_return_msg(qstate): raise Exception("Can't create response")
The DNSMessage provides these methods and data attributes:
Prepares an answer (DNS packet) from qiven information. Query flags are combination of PKT_xx contants.
RR name of question.
RR type of question.
RR class of question.
Default time-to-live.
Query flags. See PKT_ predefined constants.
List of resource records that should appear (in the same order) in question section of answer.
List of resource records that should appear (in the same order) in answer section of answer.
List of resource records that should appear (in the same order) in authority section of answer.
List of resource records that should appear (in the same order) in additional section of answer.