The dns.xfr.Inbound Class and make_query() function

The Inbound class provides support for inbound DNS zone transfers, both AXFR and IXFR. It is invoked by I/O code, i.e. dns.query.inbound_xfr() or dns.asyncquery.inbound_xfr(). When a message related to the transfer arrives, the I/O code calls the process_message() method which adds the content to the pending transaction.

The make_query() function is used to making the query message for the query methods to use in more complex situations, e.g. with TSIG or EDNS.

class dns.xfr.Inbound(txn_manager, rdtype=<RdataType.AXFR: 252>, serial=None, is_udp=False)[source]

State machine for zone transfers.

Initialize an inbound zone transfer.

txn_manager is a dns.transaction.TransactionManager.

rdtype can be dns.rdatatype.AXFR or dns.rdatatype.IXFR

serial is the base serial number for IXFRs, and is required in that case.

is_udp, a bool indidicates if UDP is being used for this XFR.

process_message(message)[source]

Process one message in the transfer.

The message should have the same relativization as was specified when the dns.xfr.Inbound was created. The message should also have been created with one_rr_per_rrset=True because order matters.

Returns True if the transfer is complete, and False otherwise.

dns.xfr.make_query(txn_manager, serial=0, use_edns=None, ednsflags=None, payload=None, request_payload=None, options=None, keyring=None, keyname=None, keyalgorithm=<DNS name hmac-sha256.>)[source]

Make an AXFR or IXFR query.

txn_manager is a dns.transaction.TransactionManager, typically a dns.zone.Zone.

serial is an int or None. If 0, then IXFR will be attempted using the most recent serial number from the txn_manager; it is the caller’s responsibility to ensure there are no write transactions active that could invalidate the retrieved serial. If a serial cannot be determined, AXFR will be forced. Other integer values are the starting serial to use. None forces an AXFR.

Please see the documentation for dns.message.make_query() and dns.message.Message.use_tsig() for details on the other parameters to this function.

Returns a (query, serial) tuple.