/usr/lib/python3.9/site-packages/dns/__pycache__
Edit: /usr/lib/python3.9/site-packages/dns/__pycache__/renderer.cpython-39.pyc (9841B)
a
àMÒeö+ ã @ sl d Z ddlZddlZddlZddlZddlZddlZddlZdZ dZ
dZdZej
dd„ ƒZG dd „ d ƒZdS )
z*Help for building DNS wire format messagesé Né é é c c s” | d| ¡ | ¡ }d V | ¡ }|| }|dkrzN| || ¡ z| | |d¡¡ W n tyt tjj‚Y n0 W | |¡ n| |¡ 0 d S )Nó r Zbig)ÚwriteÚtellÚseekÚto_bytesÚ
OverflowErrorÚdnsÚ exceptionÚ FormError)ÚoutputZ
length_lengthÚstartÚendÚlength© r ú0/usr/lib/python3.9/site-packages/dns/renderer.pyÚprefixed_length# s r c @ sÐ e Zd ZdZd)dd„Zdd„ Zd d
„ Zejdd„ ƒZ ejd
d„ ƒZ
ejj
fdd„Zdd„ Zdd„ Zd*dd„Zd+dd„Zejjfdd„Zejjfdd„Zdd„ Zdd „ Zd!d"„ Zedd#œd$d%„Zdd&œd'd(„ZdS ),ÚRendereraš Helper class for building DNS wire-format messages.
Most applications can use the higher-level L{dns.message.Message}
class and its to_wire() method to generate wire-format messages.
This class is for those applications which need finer control
over the generation of messages.
Typical use::
r = dns.renderer.Renderer(id=1, flags=0x80, max_size=512)
r.add_question(qname, qtype, qclass)
r.add_rrset(dns.renderer.ANSWER, rrset_1)
r.add_rrset(dns.renderer.ANSWER, rrset_2)
r.add_rrset(dns.renderer.AUTHORITY, ns_rrset)
r.add_rrset(dns.renderer.ADDITIONAL, ad_rrset_1)
r.add_rrset(dns.renderer.ADDITIONAL, ad_rrset_2)
r.add_edns(0, 0, 4096)
r.write_header()
r.add_tsig(keyname, secret, 300, 1, 0, '', request_mac)
wire = r.get_wire()
If padding is going to be used, then the OPT record MUST be
written after everything else in the additional section except for
the TSIG (if any).
output, an io.BytesIO, where rendering is written
id: the message id
flags: the message flags
max_size: the maximum size of the message
origin: the origin to use when rendering relative names
compress: the compression table
section: an int, the section currently being rendered
counts: list of the number of RRs in each section
mac: the MAC of the rendered message (if TSIG was used)
Nr éÿÿ c C sr t ¡ | _|du r"t dd¡| _n|| _|| _|| _|| _i | _ t
| _g d¢| _| j
d¡ d| _d| _d| _dS )zInitialize a new renderer.Nr r )r r r r s Ú F)ÚioÚBytesIOr ÚrandomZrandintÚidÚflagsÚmax_sizeÚoriginÚcompressÚQUESTIONÚsectionÚcountsr ZmacÚreservedÚ
was_padded)Úselfr r r r r r r Ú__init__b s
zRenderer.__init__c C sV | j |¡ | j ¡ g }| j ¡ D ]\}}||kr$| |¡ q$|D ]}| j|= qDdS )z™Truncate the output buffer at offset *where*, and remove any
compression table entries that pointed beyond the truncation
point.
N)r r Útruncater ÚitemsÚappend)r% ÚwhereZkeys_to_deleteÚkÚvr r r Ú _rollbacku s
zRenderer._rollbackc C s&