%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/dns/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/dns/__pycache__/message.cpython-312.pyc

�

5��e���	�dZddlZddlZddlZddlmZmZmZmZm	Z	m
Z
ddlZddl
ZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZGd�dej<j>�Z Gd�dej<j>�Z!Gd�d	ej<jD�Z#Gd
�dej<j>�Z$Gd�d
ej<j>�Z%Gd�dej<jD�Z&Gd�dej<jD�Z'Gd�dej<jD�Z(Gd�dej<jD�Z)Gd�dej<jD�Z*Gd�dej<jV�Z,Gd�dejZj\�Z/Gd�d�Z0dZ1dZ2e	e3ejhjjejljnejpjreejpjreejljnfZ:ee:ejvjxfZ=e
e3e>eejvjxfZ?Gd �d!�Z@Gd"�d#�ZAGd$�d%e@�ZBd&�ZCd'�ZDGd(�d)�ZE											dUd+eFd,eed-eeFd.eGd/eejhjjd0ee
ej�j�ej�j�fd1eGd2eGd3eGd4eGd5eGd6eGd7e@fd8�ZKGd9�d:�ZL					dVd;e>d<eejhj�d3eGd/eejhjjd=eGd>eejhjjd7e@fd?�ZN		dWd@ed<eejhj�d3eGd7e@fdA�ZOejlj�dd*ddddddej�j�dfdBe
ejhjje>fdCe
ejpjre>fdDe
ejljne>fdEee
e3eGfdFeGdGee3dHee3dIee3dJeeej�j�d<eejhj�dKee3dLe3dMe3d7eBfdN�ZU					dXdOe@dPeGdQe3dRe3dSe3dMee3d7e@fdT�ZVe/j�ZWe/j�ZXe/j�ZYe/j�ZZy)YzDNS Messages�N)�Any�Dict�List�Optional�Tuple�Unionc��eZdZdZy)�ShortHeaderz2The DNS packet passed to from_wire() is too short.N��__name__�
__module__�__qualname__�__doc__���-/usr/lib/python3/dist-packages/dns/message.pyr
r
-s��<rr
c��eZdZdZy)�TrailingJunkzEThe DNS packet passed to from_wire() has extra junk at the end of it.Nrrrrrr1s��Orrc��eZdZdZy)�UnknownHeaderFieldzVThe header field name was not recognized when converting from text
    into a message.Nrrrrrr5s��rrc��eZdZdZy)�BadEDNSzLAn OPT record occurred somewhere other than
    the additional data section.Nrrrrrr:���$rrc��eZdZdZy)�BadTSIGzWA TSIG record occurred somewhere other than the end of
    the additional data section.Nrrrrrr?rrrc��eZdZdZy)�UnknownTSIGKeyz(A TSIG with an unknown key was received.NrrrrrrDs��2rrc�.��eZdZdZdhZ�fd�Zd�Z�xZS)�	TruncatedzThe truncated flag is set.�messagec�$��t�|�|i|��y�N)�super�__init__)�self�args�kwargs�	__class__s   �rr$zTruncated.__init__Os���
���$�)�&�)rc� �|jdS)zbAs much of the message as could be processed.

        Returns a ``dns.message.Message``.
        r )r'�r%s rr zTruncated.messageRs��
�{�{�9�%�%r)rr
rr�supp_kwargsr$r �
__classcell__)r(s@rrrHs���$��+�K�*�&rrc��eZdZdZy)�NotQueryResponsez%Message is not a response to a query.Nrrrrr.r.Zs��/rr.c��eZdZdZy)�ChainTooLongzThe CNAME chain is too long.Nrrrrr0r0^s��&rr0c��eZdZdZy)�AnswerForNXDOMAINz.The rcode is NXDOMAIN but an answer was found.Nrrrrr2r2bs��8rr2c��eZdZdZy)�NoPreviousNamezNo previous name was known.Nrrrrr4r4fs��%rr4c�0�eZdZdZdZdZdZdZed��Z	y)�MessageSectionzMessage sectionsr���c��y�Nr9r)�clss r�_maximumzMessageSection._maximumrs��rN)
rr
rr�QUESTION�ANSWER�	AUTHORITY�
ADDITIONAL�classmethodr=rrrr6r6js+����H�
�F��I��J����rr6c��eZdZdedefd�Zy)�MessageError�	exception�offsetc� �||_||_yr")rErF)r%rErFs   rr$zMessageError.__init__xs��"�����rN)rr
r�	Exception�intr$rrrrDrDws���)��S�rrDi��c�4
�eZdZdZeZdYdeefd�Ze	de
ejjfd��Zejd��Ze	de
ejjfd��Zejd	��Ze	de
ejjfd
��Zejd��Ze	de
ejjfd��Zejd
��Zd�Zd�Z		dZdeej*j,dedeeefdefd�Zd�Zd�Zdddefd�Zde
ejjdefd�Zdede
ejjfd�Z ejBjDddddfde#dej*j,dejHjJdejBjLd ejBjLd!eejHjJd"ed#ed$eej*jNdejjfd%�Z(ejBjDddddfde#dej*j,dejHjJdejBjLd ejBjLd!eejHjJd"ed#ed$eej*jNdeejjfd&�Z)de#defd'�Z*defd(�Z+defd)�Z,						d[deej*j,d+ed,ed-eed.ed/edeeefde-fd0�Z.e/d1��Z0dd2dd*d3ejbjdfd4ed5ee3ej*j,efd6ed7eed8ed9e-d:e3ej*j,efddfd;�Z4e	deej*j,fd<��Z5e	deej*j,fd=��Z6e	dee-fd>��Z7e	deefd?��Z8e	defd@��Z9e/d*e:dfdA��Z;d*d*e:ddd*fdBee3eefdCedDedEeedFee
ejxjzdGeddfdH�Z>e	defdI��Z<e	defdJ��Z?e?jdK��Z?e	defdL��Z@e	deAfdM��ZBd\dNeddfdO�ZCdej�j�fdP�ZDdQej�j�ddfdR�ZFdej�j�fdS�ZGdTej�j�ddfdU�ZIdV�ZJdW�ZKdX�ZLy)]�MessagezA DNS message.N�idc�*�|�$tjj�|_n||_d|_ggggg|_d|_d|_d|_d|_	d|_
d|_d|_d|_
d|_i|_g|_d|_y)NrrFg)�dns�entropy�	random_16rM�flags�sections�opt�request_payload�pad�keyring�tsig�request_mac�xfr�origin�tsig_ctx�index�errors�time)r%rMs  rr$zMessage.__init__�s���
�:��k�k�+�+�-�D�G��D�G���
�68�"�b�"�5E��
�.2��� ������ ���/3��	�������/3���'+��
� "��
�*,�����	r�returnc� �|jdS)zThe question section.r�rSr*s r�questionzMessage.question�����}�}�Q��rc�"�||jd<y�Nrrb�r%�vs  rrczMessage.question������
�
�a�rc� �|jdS)zThe answer section.r7rbr*s r�answerzMessage.answer�rdrc�"�||jd<y)Nr7rbrgs  rrkzMessage.answer�rirc� �|jdS)zThe authority section.r8rbr*s r�	authorityzMessage.authority�rdrc�"�||jd<y)Nr8rbrgs  rrnzMessage.authority�rirc� �|jdS)zThe additional data section.r9rbr*s r�
additionalzMessage.additional�rdrc�"�||jd<yr;rbrgs  rrqzMessage.additional�rirc�8�dt|j�zdzS)Nz<DNS message, ID �>)�reprrMr*s r�__repr__zMessage.__repr__�s��"�T�$�'�'�]�2�S�8�8rc�"�|j�Sr")�to_textr*s r�__str__zMessage.__str__�s���|�|�~�rr[�
relativize�kwc	��tj�}|jd|jz�|jdtj
j
|j��z�|jdtjj
|j��z�|jdtjj
|j�z�|jdk\r�|jd|jz�|jdk7r;|jdtjj|j�z�|jd|jz�|jD]$}|jd	|j
�z��&|jjj!�D]d\}}|jd
|�d��|j#|�D]6}|j|j||fi|���|jd��8�f|j%�dd
S)z�Convert the message to text.

        The *origin*, *relativize*, and any other keyword
        arguments are passed to the RRset ``to_wire()`` method.

        Returns a ``str``.
        zid %d
z
opcode %s
z	rcode %s
z	flags %s
rzedns %s
z
eflags %s
zpayload %d
z
option %s
�;�
N���)�io�StringIO�writerMrO�opcoderx�rcoderR�edns�	ednsflags�edns_to_text�payload�options�
_section_enum�__members__�items�section_from_number�getvalue)	r%r[rzr{�srT�name�which�rrsets	         rrxzMessage.to_text�s���
�K�K�M��	���	�D�G�G�#�$�	���
��
�
� 2� 2�4�;�;�=� A�A�B�	����s�y�y�0�0�����>�>�?�	����s�y�y�0�0����<�<�=��9�9��>�
�G�G�K�$�)�)�+�,��~�~��"����
��	�	�(>�(>�t�~�~�(N�N�O�
�G�G�N�T�\�\�1�2��<�<�	3�C�
�G�G�M�C�K�K�M�1�2�	3��-�-�9�9�?�?�A�	�K�D�%�
�G�G�a��v�R�L�!��1�1�%�8�
�����
��
�
�f�j�?�B�?�@�����
�
�	��z�z�|�C�R� � rc��t|t�sy|j|jk7ry|j|jk7ryt	|j
�D]0\}}|j
|}|D]	}||vs�y|D]	}||vs�y�2y)z�Two messages are equal if they have the same content in the
        header, question, answer, and authority sections.

        Returns a ``bool``.
        FT)�
isinstancerLrMrR�	enumeraterS)r%�other�i�section�
other_section�ns      r�__eq__zMessage.__eq__�s����%��)���7�7�e�h�h����:�:����$��#�D�M�M�2�	!�J�A�w�!�N�N�1�-�M��
!���M�)� �
!�#�
!���G�#� �
!�	!�rc�&�|j|�Sr")r�)r%r�s  r�__ne__zMessage.__ne__s���;�;�u�%�%�%rr�c�(�|jtjjzdk(sl|j|jk7sStjj|j�tjj|j�k7ry|j
�tjjtjjtjjtjjhvrt|j�dk(rytjj|j�ry|jD]}||jvs�y|jD]}||jvs�yy)zuIs *other*, also a ``dns.message.Message``, a response to this
        message?

        Returns a ``bool``.
        rFT)rRrO�QRrMr��
from_flagsr��FORMERR�SERVFAIL�NOTIMP�REFUSED�lenrc�	is_update)r%r�r�s   r�is_responsezMessage.is_responses!��
�K�K�#�)�)�,�,�&�!�+��w�w�%�(�(�"��z�z�$�$�T�Z�Z�0�C�J�J�4I�4I�%�+�+�4V�V���;�;�=��I�I����I�I����I�I����I�I���	
�
��5�>�>�"�a�'���:�:����
�
�+�
����	�A�����&��	����	�A���
�
�%��	�rr�c��t|j�D]\}}||us�|j|�cStd��)z�Return the "section number" of the specified section for use
        in indexing.

        *section* is one of the section attributes of this message.

        Raises ``ValueError`` if the section isn't known.

        Returns an ``int``.
        zunknown section)r�rSr��
ValueError)r%r�r��our_sections    r�section_numberzMessage.section_number5sG��(��
�
�6�	-�N�A�{��+�%��)�)�!�,�,�	-��*�+�+r�numberc�V�|jj|�}|j|S)aReturn the section list associated with the specified section
        number.

        *number* is a section number `int` or the text form of a section
        name.

        Raises ``ValueError`` if the section isn't known.

        Returns a ``list``.
        )r��makerS)r%r�r�s   rr�zMessage.section_from_numberEs)���$�$�)�)�&�1���}�}�W�%�%rFr��rdclass�rdtype�covers�deleting�create�force_unique�
idna_codecc
���t|t�r|}
|j|
�}nNt|t�r-|jj|�}
|j|
�}n|j
|�}
t|t�r!tjj||	��}tjjj|�}tjjj|�}tjjj|�}|�)tjjj|�}|
|||||f}|sK|j�|jj|�}|�"|S|D]}|j!|||||�s�|cS|st"�tj$j'|||||�}|j)|�|j�||j|<|S)a�Find the RRset with the given attributes in the specified section.

        *section*, an ``int`` section number, a ``str`` section name, or one of
        the section attributes of this message.  This specifies the
        the section of the message to search.  For example::

            my_message.find_rrset(my_message.answer, name, rdclass, rdtype)
            my_message.find_rrset(dns.message.ANSWER, name, rdclass, rdtype)
            my_message.find_rrset("ANSWER", name, rdclass, rdtype)

        *name*, a ``dns.name.Name`` or ``str``, the name of the RRset.

        *rdclass*, an ``int`` or ``str``, the class of the RRset.

        *rdtype*, an ``int`` or ``str``, the type of the RRset.

        *covers*, an ``int`` or ``str``, the covers value of the RRset.
        The default is ``dns.rdatatype.NONE``.

        *deleting*, an ``int``, ``str``, or ``None``, the deleting value of the
        RRset.  The default is ``None``.

        *create*, a ``bool``.  If ``True``, create the RRset if it is not found.
        The created RRset is appended to *section*.

        *force_unique*, a ``bool``.  If ``True`` and *create* is also ``True``,
        create a new RRset regardless of whether a matching RRset exists
        already.  The default is ``False``.  This is useful when creating
        DDNS Update messages, as order matters for them.

        *idna_codec*, a ``dns.name.IDNACodec``, specifies the IDNA
        encoder/decoder.  If ``None``, the default IDNA 2003 encoder/decoder
        is used.

        Raises ``KeyError`` if the RRset was not found and create was
        ``False``.

        Returns a ``dns.rrset.RRset object``.
        �r�)r�rIr��strr��	from_textr�rOr��	rdatatype�	RdataTyper��
rdataclass�
RdataClassr]�get�
full_match�KeyErrorr��RRset�append)
r%r�r�r�r�r�r�r�r�r�r��keyr�s
             r�
find_rrsetzMessage.find_rrsetTs���h�g�s�#�$�N��.�.�~�>�G�
���
%�!�/�/�9�9�'�B�N��.�.�~�>�G�!�0�0��9�N��d�C� ��8�8�%�%�d�z�%�B�D����(�(�-�-�f�5���.�.�+�+�0�0��9�����(�(�-�-�f�5�����~�~�0�0�5�5�h�?�H��t�W�f�f�h�G����z�z�%��
�
���s�+���$� �L�$�%�E��'�'��g�v�v�x�P�$��%���N��	�	����g�v�v�x�H�����u���:�:�!�#�D�J�J�s�O��rc
�^�	|j|||||||||	�	}
|
S#t$rd}
Y|
SwxYw)ajGet the RRset with the given attributes in the specified section.

        If the RRset is not found, None is returned.

        *section*, an ``int`` section number, a ``str`` section name, or one of
        the section attributes of this message.  This specifies the
        the section of the message to search.  For example::

            my_message.get_rrset(my_message.answer, name, rdclass, rdtype)
            my_message.get_rrset(dns.message.ANSWER, name, rdclass, rdtype)
            my_message.get_rrset("ANSWER", name, rdclass, rdtype)

        *name*, a ``dns.name.Name`` or ``str``, the name of the RRset.

        *rdclass*, an ``int`` or ``str``, the class of the RRset.

        *rdtype*, an ``int`` or ``str``, the type of the RRset.

        *covers*, an ``int`` or ``str``, the covers value of the RRset.
        The default is ``dns.rdatatype.NONE``.

        *deleting*, an ``int``, ``str``, or ``None``, the deleting value of the
        RRset.  The default is ``None``.

        *create*, a ``bool``.  If ``True``, create the RRset if it is not found.
        The created RRset is appended to *section*.

        *force_unique*, a ``bool``.  If ``True`` and *create* is also ``True``,
        create a new RRset regardless of whether a matching RRset exists
        already.  The default is ``False``.  This is useful when creating
        DDNS Update messages, as order matters for them.

        *idna_codec*, a ``dns.name.IDNACodec``, specifies the IDNA
        encoder/decoder.  If ``None``, the default IDNA 2003 encoder/decoder
        is used.

        Returns a ``dns.rrset.RRset object`` or ``None``.
        N)r�r�)r%r�r�r�r�r�r�r�r�r�r�s           r�	get_rrsetzMessage.get_rrset�sS��f
	��O�O����������
�E�����	��E���	�s��,�,c�x�t|t�r|}|j|�}nNt|t�r-|jj|�}|j|�}n|j
|�}td�|D��}|tjk(r"|j�|dz
}|j�|dz
}|S)a�Returns the number of records in the specified section.

        *section*, an ``int`` section number, a ``str`` section name, or one of
        the section attributes of this message.  This specifies the
        the section of the message to count.  For example::

            my_message.section_count(my_message.answer)
            my_message.section_count(dns.message.ANSWER)
            my_message.section_count("ANSWER")
        c3�FK�|]}tdt|�����y�w)r7N)�maxr�)�.0�rrss  r�	<genexpr>z(Message.section_count.<locals>.<genexpr>s����8��C��3�s�8�$�8�s�!r7)r�rIr�r�r�r�r��sumr6rArTrX)r%r�r��counts    r�
section_countzMessage.section_count�s����g�s�#�$�N��.�.�~�>�G�
���
%�!�/�/�9�9�'�B�N��.�.�~�>�G�!�0�0��9�N��8��8�8���^�6�6�6��x�x�#���
���y�y�$���
���rc���|jsyd}|jdjD]#}|j�}|t|�dzz
}�%|jr|dz
}|S)z:Compute the size required for the OPT RR, padding excludedr��)rTr��to_wirer�rV)r%�size�option�wires    r�_compute_opt_reservezMessage._compute_opt_reservese���x�x����
�h�h�q�k�)�)�	"�F��>�>�#�D��C��I��M�!�D�	"��8�8��A�I�D��rc��|jsytj�}|jj|�t	|j��S)z)Compute the size required for the TSIG RRr)rXr��BytesIOr�r�r�)r%�fs  r�_compute_tsig_reservezMessage._compute_tsig_reserves<���y�y���J�J�L���	�	���!���1�:�:�<� � rr�max_size�multir\�prepend_length�prefer_truncationc	��|�|j�|j}|dk(r|jdk7r
|j}nd}|dkrd}n|dkDrd}tjj	|j
|j||�}|j�}	|j|	�|j�}
|j|
�	|jD]3}|j|j|j|j��5|jD].}|j tjj"|fi|���0|j$D].}|j tjj&|fi|���0|j(D].}|j tjj*|fi|���0	|j5�|j6�(|j9|j6|j:|	|
�|j=�|j>��tj>jA|jC�|jD|j>dtGtIjH��|jJ||�\}}
|j>jM�|j>jO|�|j!tjj*|j>�|j=�|r|
|_(|jC�}|rtS|�jUdd�|z}|S#tj,j.$r\|rU|j0tjj*kr/|xjtjj2zc_n�Y���wxYw)a�Return a string containing the message in DNS compressed wire
        format.

        Additional keyword arguments are passed to the RRset ``to_wire()``
        method.

        *origin*, a ``dns.name.Name`` or ``None``, the origin to be appended
        to any relative names.  If ``None``, and the message has an origin
        attribute that is not ``None``, then it will be used.

        *max_size*, an ``int``, the maximum size of the wire format
        output; default is 0, which means "the message's request
        payload, if nonzero, or 65535".

        *multi*, a ``bool``, should be set to ``True`` if this message is
        part of a multiple message sequence.

        *tsig_ctx*, a ``dns.tsig.HMACTSig`` or ``dns.tsig.GSSTSig`` object, the
        ongoing TSIG context, used when signing zone transfers.

        *prepend_length*, a ``bool``, should be set to ``True`` if the caller
        wants the message length prepended to the message itself.  This is
        useful for messages sent over TCP, TLS (DoT), or QUIC (DoQ).

        *prefer_truncation*, a ``bool``, should be set to ``True`` if the caller
        wants the message to be truncated if it would otherwise exceed the
        maximum length.  If the truncation occurs before the additional section,
        the TC bit will be set.

        Raises ``dns.exception.TooBig`` if *max_size* was exceeded.

        Returns a ``bytes``.
        ri��ir8�big)+r[rUrO�renderer�RendererrMrRr��reserver�rc�add_questionr�r�r�rk�	add_rrsetr?rnr@rqrArE�TooBigr��TC�release_reservedrT�add_optrV�write_headerrX�sign�get_wirerWrIr_rY�clear�addr\r��to_bytes)r%r[r�r�r\r�r�r{�r�opt_reserve�tsig_reserver��new_tsig�ctxr�s               rr�zMessage.to_wire(s���X�>�d�k�k�5��[�[�F��q�=��#�#�q�(��/�/�� ���c�>��H�
��
��H��L�L�!�!�$�'�'�4�:�:�x��H���/�/�1��	�	�	�+���1�1�3��	�	�	�,��	����
H�����u�z�z�5�<�<����G�
H����
>������C�L�L�/�/��=�"�=�
>����
A������C�L�L�2�2�E�@�R�@�
A����
B������C�L�L�3�3�U�A�b�A�
B�	
�����8�8��
�I�I�d�h�h����+�|�D�	�����9�9� �!�h�h�m�m��
�
������	�	�!���D�I�I�K� �� � ����O�X�s�
�I�I�O�O���I�I�M�M�(�#�
�K�K����/�/����;�
�N�N��� #��
��z�z�|����t�9�%�%�a��/�$�6�D����;�}�}�#�#�	� ��9�9�s�|�|�6�6�6��G�G�s�y�y�|�|�+�G���	�s�C9M�A5N?�>N?c��tjjjjtjjtj
j|||||||�	}tjj|d|�Srf)rO�rdtypes�ANY�TSIGr�r�r��
from_rdata)	�keyname�	algorithm�time_signed�fudge�mac�original_id�errorr�rXs	         r�
_make_tsigzMessage._make_tsig�sl���{�{���#�#�(�(��N�N����M�M����������

���y�y�#�#�G�Q��5�5r�,rrWr�r�r�
tsig_error�
other_datar�c
�z�t|tjj�r|}|j}n�t|�r
|||�}n{t|t�rtjj|�}|�tt|��}||}t|t�r!tjj|||�}||_|�|j}|j||jjd|dtjj|jjz|||�|_y)a�When sending, a TSIG signature using the specified key
        should be added.

        *key*, a ``dns.tsig.Key`` is the key to use.  If a key is specified,
        the *keyring* and *algorithm* fields are not used.

        *keyring*, a ``dict``, ``callable`` or ``dns.tsig.Key``, is either
        the TSIG keyring or key to use.

        The format of a keyring dict is a mapping from TSIG key name, as
        ``dns.name.Name`` to ``dns.tsig.Key`` or a TSIG secret, a ``bytes``.
        If a ``dict`` *keyring* is specified but a *keyname* is not, the key
        used will be the first key in the *keyring*.  Note that the order of
        keys in a dictionary is not defined, so applications should supply a
        keyname when a ``dict`` keyring is used, unless they know the keyring
        contains only one key.  If a ``callable`` keyring is specified, the
        callable will be called with the message and the keyname, and is
        expected to return a key.

        *keyname*, a ``dns.name.Name``, ``str`` or ``None``, the name of
        this TSIG key to use; defaults to ``None``.  If *keyring* is a
        ``dict``, the key must be defined in it.  If *keyring* is a
        ``dns.tsig.Key``, this is ignored.

        *fudge*, an ``int``, the TSIG time fudge.

        *original_id*, an ``int``, the TSIG original id.  If ``None``,
        the message's id is used.

        *tsig_error*, an ``int``, the TSIG error code.

        *other_data*, a ``bytes``, the TSIG other data.

        *algorithm*, a ``dns.name.Name`` or ``str``, the TSIG algorithm to use.  This is
        only used if *keyring* is a ``dict``, and the key entry is a ``bytes``.
        Nr�)r�rOrX�Keyr��callabler�r��next�iter�bytesrWrMrr��	mac_sizes)	r%rWr�r�rrrr�r�s	         r�use_tsigzMessage.use_tsig�s���^�g�s�x�x�|�|�,��C��h�h�G�
�g�
��$��(�C��'�3�'��(�(�,�,�W�5�����t�G�}�-���'�"�C��#�u�%��h�h�l�l�7�C��;��������'�'�K��O�O���L�L�"�"�
���c�h�h�(�(����)?�)?�@�@����	
��	rc�H�|jr|jjSyr")rXr�r*s rr�zMessage.keyname�s���9�9��9�9�>�>�!�rc�N�|jr|jdjSyrf)rXr�r*s r�keyalgorithmzMessage.keyalgorithm�s ���9�9��9�9�Q�<�)�)�)�rc�N�|jr|jdjSyrf)rXr�r*s rr�zMessage.mac�s ���9�9��9�9�Q�<�#�#�#�rc�N�|jr|jdjSyrf)rXrr*s rrzMessage.tsig_error�s ���9�9��9�9�Q�<�%�%�%�rc�,�t|j�Sr")�boolrXr*s r�had_tsigzMessage.had_tsigs���D�I�I��rc�(�tjjjj|tjj|xsd�}tj
j
tjjt|�|�S)Nr)
rOr�r��OPTr�r�r�r��rootrI)rRr�r�rTs    r�	_make_optzMessage._make_optsW���k�k�o�o�!�!�%�%�g�s�}�}�/@�/@�'�-�R�P���y�y�#�#�C�H�H�M�M�3�u�:�s�C�Crr�r�r�rUr�rVc���|�|durd}n|durd}|dkrd|_d|_y|dz}||dzz}|�g}|j|||�|_|�|}||_|dkrtd��||_y)	a'Configure EDNS behavior.

        *edns*, an ``int``, is the EDNS level to use.  Specifying ``None``, ``False``,
        or ``-1`` means "do not use EDNS", and in this case the other parameters are
        ignored.  Specifying ``True`` is equivalent to specifying 0, i.e. "use EDNS0".

        *ednsflags*, an ``int``, the EDNS flag values.

        *payload*, an ``int``, is the EDNS sender's payload field, which is the maximum
        size of UDP datagram the sender can handle.  I.e. how big a response to this
        message can be.

        *request_payload*, an ``int``, is the EDNS payload size to use when sending this
        message.  If not specified, defaults to the value of *payload*.

        *options*, a list of ``dns.edns.Option`` objects or ``None``, the EDNS options.

        *pad*, a non-negative ``int``.  If 0, the default, do not pad; otherwise add
        padding bytes to make the message size a multiple of *pad*.  Note that if
        padding is non-zero, an EDNS PADDING option will always be added to the
        message.
        NFrTrl�~rJzpad must be non-negative)rTrUrr�rV)r%r�r�r�rUr�rVs       r�use_ednszMessage.use_ednss���@�<�4�5�=��D�
�T�\��D��!�8��D�H�#$�D� �
��#�I�����#�I������~�~�i��'�B�D�H��&�")��#2�D� ��Q�w� �!;�<�<��D�Hrc�@�|jr|jdzdz	Sy)Ni�rJr)rTr�r*s rr�zMessage.ednsAs ���8�8��N�N�X�-�"�4�4�rc�H�|jr|jjSyrf)rT�ttlr*s rr�zMessage.ednsflagsHs���8�8��8�8�<�<��rc�r�|jr||j_y|r|j|�|_yyr")rTrrrgs  rr�zMessage.ednsflagsOs,���8�8��D�H�H�L�
��~�~�a�(�D�H�rc�N�|jr|jdjSyrf)rTr�r*s rr�zMessage.payloadVs ���8�8��8�8�A�;�&�&�&�rc�N�|jr|jdjSy)Nrr)rTr�r*s rr�zMessage.options]s ���8�8��8�8�A�;�&�&�&�r�wantedc���|r.|xjtjjzc_y|jr8|xjttjj�zc_yy)a!Enable or disable 'DNSSEC desired' flag in requests.

        *wanted*, a ``bool``.  If ``True``, then DNSSEC data is
        desired in the response, EDNS is enabled if required, and then
        the DO bit is set.  If ``False``, the DO bit is cleared if
        EDNS is enabled.
        N)r�rOrR�DOrTrI)r%r#s  r�want_dnsseczMessage.want_dnssecdsG����N�N�c�i�i�l�l�*�N�
�X�X��N�N�s�3�9�9�<�<�0�0�0�N�rc��tjjt|j�t|j
��S)zBReturn the rcode.

        Returns a ``dns.rcode.Rcode``.
        )rOr�r�rIrRr�r*s rr�z
Message.rcoders,��
�y�y�#�#�C��
�
�O�S����5H�I�Irr�c���tjj|�\}}|xjdzc_|xj|zc_|xjdzc_|xj|zc_y)zUSet the rcode.

        *rcode*, a ``dns.rcode.Rcode``, is the rcode to set.
        i�i���N)rOr��to_flagsrRr�)r%r��value�evalues    r�	set_rcodezMessage.set_rcodeysT��
�)�)�,�,�U�3�����
�
�f��
��
�
�e��
����*�$�����&� �rc�f�tjjt|j��S)zEReturn the opcode.

        Returns a ``dns.opcode.Opcode``.
        )rOr�r�rIrRr*s rr�zMessage.opcode�s!��
�z�z�$�$�S����_�5�5rr�c��|xjdzc_|xjtjj|�zc_y)zZSet the opcode.

        *opcode*, a ``dns.opcode.Opcode``, is the opcode to set.
        i��N)rRrOr�r))r%r�s  r�
set_opcodezMessage.set_opcode�s/��
	
�
�
�f��
��
�
�c�j�j�)�)�&�1�1�
rc��|Sr"r)r%r*s  r�_get_one_rr_per_rrsetzMessage._get_one_rr_per_rrset�s���rc��||ddfS�NFr)r%r�r�r�r�s     r�_parse_rr_headerzMessage._parse_rr_header�s�����u�-�-rc��|tjjk(rB|tjk7s)|j
s|tjjk7rat�|tjjk(r>|tjk7s%|tjjk7s||dz
k7rt�||ddfS)Nr7F)rOr�rr6rArTr�rrr�r�r)r%r�r��positionr�r�r�s       r�_parse_special_rr_headerz Message._parse_special_rr_header�s����S�]�]�&�&�&��>�4�4�4��8�8��3�8�8�=�=�(��
�
�s�}�}�)�)�
)��>�4�4�4��c�m�m�/�/�/��u�q�y�(��
����u�-�-rr")NT)NrFNFF)T)Mrr
rrr6r�rrIr$�propertyrrOr�r�rc�setterrkrnrqrvryr��Namerrr�rrxr�r�r�r�r�r��NONE�SectionTyper�r�r��	IDNACodecr�r�r�r�r�rr��staticmethodrrX�default_algorithmrrr�rr�rr�DEFAULT_EDNS_PAYLOADrr��Optionrr�r�rr�r&r��Rcoder,r��Opcoder/r1r4r7rrrrLrL�sN���"�M��8�C�=��(� �$�s�y�y���/� �� ��_�_����� ��S�Y�Y�_�_�-� �� ��]�]����� �4��	�	���0� �� �������� �D������1� �� �������9��
+/��$!�������'�$!��$!��3��8�n�	$!�


�$!�L�.&�$��$�t�$�L,�d�3�9�9�?�?�&;�,��,� 
&�#�
&�$�s�y�y���2G�
&�*+.�-�-�*<�*<�8<��"�37�S��S��h�h�m�m�S����*�*�	S�
�
�
�'�'�S��
�
�'�'�
S��3�>�>�4�4�5�S��S��S��S�X�X�/�/�0�S�

�����S�v+.�-�-�*<�*<�8<��"�37�A��A��h�h�m�m�A����*�*�	A�
�
�
�'�'�A��
�
�'�'�
A��3�>�>�4�4�5�A��A��A��S�X�X�/�/�0�A�
�#�)�)�/�/�	"�A�F�[��S��8�c��&!�s�!�+/���"&�$�"'�b�������'�b��b��	b�
�3�-�b��
b� �b��3��8�n�b�
�b�H�6��6�&8<��%)���/2�x�x�/I�/I�H
��H
��%����
�
�s� 2�3�4�H
��	H
�
�c�]�H
��
H
��H
��������+�,�H
�
�H
�T���#�(�(�-�-�0������h�s�x�x�}�}�5������X�e�_������H�S�M������$������#7��D��D�,-��+�)-�37��3��u�S�$�Y�'�(�3��3��	3�
"�#��3��$�s�x�x���/�0�
3��3�
�3�j��c������3�������)��)�������������1�$�1�$�1�J�s�y�y���J�	!�s�y�y���	!�4�	!�6��
�
�)�)�6�2����!2�!2�2�t�2��.�
.rrLc	��eZdZdZdej
jdeejjde
deejjfd�Zy)�ChainingResulta�The result of a call to dns.message.QueryMessage.resolve_chaining().

    The ``answer`` attribute is the answer RRSet, or ``None`` if it doesn't
    exist.

    The ``canonical_name`` attribute is the canonical name after all
    chaining has been applied (this is the same name as ``rrset.name`` in cases
    where rrset is not ``None``).

    The ``minimum_ttl`` attribute is the minimum TTL, i.e. the TTL to
    use if caching the data.  It is the smallest of all the CNAME TTLs
    and either the answer TTL if it exists or the SOA TTL and SOA
    minimum values for negative answers.

    The ``cnames`` attribute is a list of all the CNAME RRSets followed to
    get to the canonical name.
    �canonical_namerk�minimum_ttl�cnamesc�<�||_||_||_||_yr")rFrkrGrH)r%rFrkrGrHs     rr$zChainingResult.__init__�s"��-������&�����rN)
rr
rrrOr�r:rr�r�rIrr$rrrrErE�sT���$
����
�
�
�������)�
��	
�
�S�Y�Y�_�_�%�
rrEc�L�eZdZdefd�Zdejjfd�Zy)�QueryMessager`c��|jtjjzdk(rt�t	|j
�dk7rtjj�|j
d}|j}tjj}d}d}g}|tkrJ	|j|j||j|j�}t!||j�}	|tk\rt,�|j/�tj.j0k(r|�t2�|�i|}			|j|j4|	|jtj$j6�}
t!||
j|
dj8�}	t?||||�S#t"$r�|jtj$j&k7r�	|j|j||jtj$j&�}|j)|�t!||j�}|D]}|j*}n|dz
}Y���#t"$rYY��|wxYwY���wxYw#t"$r:	|	j;�}	n%#tjj<$rYY��wxYwYnwxYw���)a�Follow the CNAME chain in the response to determine the answer
        RRset.

        Raises ``dns.message.NotQueryResponse`` if the message is not
        a response.

        Raises ``dns.message.ChainTooLong`` if the CNAME chain is too long.

        Raises ``dns.message.AnswerForNXDOMAIN`` if the rcode is NXDOMAIN
        but an answer was found.

        Raises ``dns.exception.FormError`` if the question count is not 1.

        Returns a ChainingResult object.
        rr7N) rRrOr�r.r�rcrE�	FormErrorr�r�MAX_TTL�	MAX_CHAINr�rkr�r��minr�r��CNAMEr��targetr0r��NXDOMAINr2rn�SOA�minimum�parent�NoParentrE)r%rc�qname�min_ttlrkr�rH�crrset�rd�auname�srrsets           r�resolve_chainingzQueryMessage.resolve_chaining�s_�� �:�:��	�	���$��)�"�"��t�}�}���"��-�-�)�)�)��=�=��#���
�
���'�'�/�/���������i��
�����K�K���(8�(8�(�/�/����g�v�z�z�2���(�I�����:�:�<�3�9�9�-�-�-�&�2D�#�#��>��F��
�!�_�_������0@�0@�#�-�-�BS�BS��F�"�'�6�:�:�v�a�y�7H�7H�I�G���e�V�W�f�=�=��Q�
��?�?�c�m�m�&9�&9�9�
�!%��� �K�K���0@�0@�#�-�-�BU�BU�"���
�
�f�-�"%�g�v�z�z�":��"(�"�B�$&�I�I�E�!�"���
�� ��#�����
�%
��F ���!'�������8�8�,�,��������si�(AF,�9A$I8�,0I5�BI � 	I.�)I5�-I.�.I5�4I5�8	J;�J�J;�J5�0J;�4J5�5J;�:J;c�6�|j�jS)a�Return the canonical name of the first name in the question
        section.

        Raises ``dns.message.NotQueryResponse`` if the message is not
        a response.

        Raises ``dns.message.ChainTooLong`` if the CNAME chain is too long.

        Raises ``dns.message.AnswerForNXDOMAIN`` if the rcode is NXDOMAIN
        but an answer was found.

        Raises ``dns.exception.FormError`` if the question count is not 1.
        )r^rFr*s rrFzQueryMessage.canonical_names���$�$�&�5�5�5rN)	rr
rrEr^rOr�r:rFrrrrKrK�s%��I>�.�I>�V6����
�
�6rrKc��ddl}yrf)�
dns.update)rOs r�_maybe_import_updaterb-s��rc���|tjjk(rtS|tjjk(r$t�tjjStSr")	rOr��QUERYrK�UPDATErb�update�
UpdateMessagerL)r�s r�_message_factory_from_opcoderh6sG��
����!�!�!���	�3�:�:�$�$�	$����z�z�'�'�'��rc�<�eZdZdZ						dd�Zd�Zd�Zd�Zd�Zy)	�_WireReaderaiWire format reader.

    parser: the binary parser
    message: The message object being built
    initialize_message: Callback to set message parsing options
    question_only: Are we only reading the question?
    one_rr_per_rrset: Put each RR into its own RRset?
    keyring: TSIG keyring
    ignore_trailing: Ignore trailing junk at end of request?
    multi: Is this message part of a multi-message sequence?
    DNS dynamic updates.
    continue_on_error: try to extract as much information as possible from
    the message, accumulating MessageErrors in the *errors* attribute instead of
    raising them.
    Nc	���tjj|�|_d|_||_||_||_||_||_	||_
||_g|_yr")
rOr��Parser�parserr �initialize_message�
question_only�one_rr_per_rrset�ignore_trailingrWr��continue_on_errorr^)	r%r�rnrorprqrWr�rrs	         rr$z_WireReader.__init__Qs\���h�h�o�o�d�+������"4���*��� 0���.��������
�!2�����rc	��|j�J�|jj|}t|�D]�}|jj	|jj
�}|jj
d�\}}|jj||||�\}}}}|jj||||dd����y)zhRead the next *qcount* records from the wire data and add them to
        the question section.
        Nz!HHT�r�r�)	r rS�rangerm�get_namer[�
get_structr4r�)r%r��qcountr��_rXr�r�s        r�
_get_questionz_WireReader._get_questiongs����|�|�'�'�'��,�,�'�'��7���v��	�A��K�K�(�(����)<�)<�=�E� $��� 6� 6�u� =��V�W�&*�l�l�&C�&C���w��'�#�W�f�a��
�L�L�#�#������4�
$�
�
	rc�v�|jjt||jj��yr")r^r�rDrm�current)r%�es  r�
_add_errorz_WireReader._add_errorws%�������<��4�;�;�+>�+>�?�@rc�
�|j�J�|jj|}|j}t|�D�]g}|jj
}|jj
�}|jj�&|j|jj�}n|}|jjd�\}	}
}}|	tjjtjjfvr&|jj|||||
|	�\}
}	}
}n#|jj|||
|	�\}
}	}
}|jj
}	|r<|dkDrtj j"�d}tjj$}nt|jj'|�5tj(j+|
|	|j|jj�}ddd�j-�}|jj.r|	tjj0k(rd}|	tjjk(r2tj2j5|||�|j_�n
|	tjjk(�r�|j8�t;d��t=|j8t>�rW|j8jA|�}t=|tB�rjtjDjG|||jH�}n>tK|j8�r|j9|j|�}n|j8}|�t;d|z��||j_tjDjM|jjN|||tQtSjR��|jjT||jjV|jX�	|j_+tj2j5|d|�|j_"n=|jj[|||
|	||
d|�}|�|dkDrd}|j]||���jy#1swY���xYw#t^$rH}|j`r0|jc|�|jje||z�n�Yd}~���d}~wwxYw)z�Read the next I{count} records from the wire data and add them to
        the specified section.

        section_number: the section of the message to which to add records
        count: the number of records to read
        Nz!HHIHrTz"got signed message without keyringzkey '%s' unknowni���)3r rSrprurmr|rvr[rzrwrOr�rr�r7r4rErMr;�restrict_to�rdata�from_wire_parserr�rZrTr�r�rTrWrr��dictr�rrXrr�r	�validater�rIr_rYr\r�r�r�rHrrr~�seek)r%r�r�r�r�r��rr_start�
absolute_namer�r�r�r�rdlenr��empty�rdata_startr[r�r�r�r}s                     r�_get_sectionz_WireReader._get_sectionzs����|�|�'�'�'��,�,�'�'��7���,�,���u��T	�A��{�{�*�*�H� �K�K�0�0�2�M��|�|�"�"�.�$�/�/����0C�0C�D��$��,0�K�K�,B�,B�7�,K�)�V�W�c�5��#�-�-�+�+�S�]�]�-?�-?�@�@��L�L�9�9�"�E�1�d�G�V�������
6:�\�\�5R�5R�"�D�'�6�6�2��&�(�E��+�+�-�-�K�>
���q�y�!�m�m�5�5�5��B� �]�]�/�/�F����0�0��7�� �Y�Y�7�7�#�V�T�[�[�$�,�,�:M�:M���� �Y�Y�[�F��<�<�#�#��#�-�-�2C�2C�(C�#'�L��S�]�]�.�.�.�'*�y�y�';�';�D�#�r�'J�D�L�L�$��s�}�}�1�1�1��|�|�+�,�-Q�R�R�!�$�,�,��5�"�l�l�.�.�}�=��%�c�5�1�"%�(�(�,�,�}�c�2�<�<�"P�C�!�$�,�,�/�"�l�l�4�<�<��G��"�l�l���{�,�-?�$�-F�G�G�+.�D�L�L�(�,/�H�H�,=�,=����(�(��%���D�I�I�K�(����0�0� ����-�-��
�
�
-�D�L�L�)�),�	�	�(<�(<�]�A�r�(R�D�L�L�%� �L�L�3�3������ ��$�	�E��~���+�"#�C��	�	�"�c�*��]T	�:���d�
��)�)��O�O�A�&��K�K�$�$�[�5�%8�9��:��
�s3�'AR8�AR+�J&R8�+R5	�0R8�8	T	�=T�T	c���|jj�dkrt�|jjd�\}}}}}}t	t
jj|��}||��|_t
jj|�|j_	|j|j�|jj|j�|_
	|jtj |�|j"r|jS|j%tj&|�|j%tj(|�|j%tj*|�|j,s#|jj�dk7rt.�|j0re|jj2rO|jj4s9|jj2j7|jj8�|jS#t:$r4}|j<r|j?|�n�Yd}~|jSd}~wwxYw)zNRead a wire format DNS message and build a dns.message.Message
        object.�z!HHHHHH�rMrN) rm�	remainingr
rwrhrOr�r�r rR�Flagrnr1rprzr6r>ror�r?r@rArqrr�r\rrfr�rHrrr~)	r%rMrRrx�ancount�aucount�adcount�factoryr}s	         r�readz_WireReader.read�s����;�;� � �"�R�'���9=���9O�9O��:
�6��U�F�G�W�g�/�s�z�z�/D�/D�U�/K�L���"�~��� �Y�Y�^�^�E�2�����������-� $��� B� B��!�!�!
���	����~�6�6��?��!�!��|�|�#����n�3�3�W�=����n�6�6��@����n�7�7��A��'�'�D�K�K�,A�,A�,C�q�,H�"�"��z�z�d�l�l�3�3�D�L�L�<Q�<Q����%�%�,�,�T�[�[�-=�-=�>��|�|����	��%�%�����"��#��|�|���	�s�07H4�(DH4�4	I1�=I,�,I1)FFFNFF)	rr
rrr$rzr~r�r�rrrrjrj@s7���(�������,� A�^�@ rrjFr�rWrYrZr[r\r�rorprq�raise_on_truncationrrr`c
���������d�����fd�}t|||||	|||�}
	|
j�}|jtjjzr|
rt|���|r|
j|_	|S#tjj$rW|
j
rI|
j
jtjjzr|
rt|
j
����wxYw)a�Convert a DNS wire format message into a message object.

    *keyring*, a ``dns.tsig.Key`` or ``dict``, the key or keyring to use if the message
    is signed.

    *request_mac*, a ``bytes`` or ``None``.  If the message is a response to a
    TSIG-signed request, *request_mac* should be set to the MAC of that request.

    *xfr*, a ``bool``, should be set to ``True`` if this message is part of a zone
    transfer.

    *origin*, a ``dns.name.Name`` or ``None``.  If the message is part of a zone
    transfer, *origin* should be the origin name of the zone.  If not ``None``, names
    will be relativized to the origin.

    *tsig_ctx*, a ``dns.tsig.HMACTSig`` or ``dns.tsig.GSSTSig`` object, the ongoing TSIG
    context, used when validating zone transfers.

    *multi*, a ``bool``, should be set to ``True`` if this message is part of a multiple
    message sequence.

    *question_only*, a ``bool``.  If ``True``, read only up to the end of the question
    section.

    *one_rr_per_rrset*, a ``bool``.  If ``True``, put each RR into its own RRset.

    *ignore_trailing*, a ``bool``.  If ``True``, ignore trailing junk at end of the
    message.

    *raise_on_truncation*, a ``bool``.  If ``True``, raise an exception if the TC bit is
    set.

    *continue_on_error*, a ``bool``.  If ``True``, try to continue parsing even if
    errors occur.  Erroneous rdata will be ignored.  Errors will be accumulated as a
    list of MessageError objects in the message's ``errors`` attribute.  This option is
    recommended only for DNS analysis tools, or for use in a server as part of an error
    handling path.  The default is ``False``.

    Raises ``dns.message.ShortHeader`` if the message is less than 12 octets long.

    Raises ``dns.message.TrailingJunk`` if there were octets in the message past the end
    of the proper DNS message, and *ignore_trailing* is ``False``.

    Raises ``dns.message.BadEDNS`` if an OPT record was in the wrong section, or
    occurred more than once.

    Raises ``dns.message.BadTSIG`` if a TSIG record was not the last record of the
    additional data section.

    Raises ``dns.message.Truncated`` if the TC flag is set and *raise_on_truncation* is
    ``True``.

    Returns a ``dns.message.Message``.
    rc�>���|_�|_�|_�|_yr")rYrZr[r\)r r[rYr\rZs ����rrnz%from_wire.<locals>.initialize_messageFs!���)���������#��r)r )
rjr�rOrErMr rRr�rr^)r�rWrYrZr[r\r�rorprqr�rrrn�reader�ms  ````         r�	from_wirer��s����L����$��������
��	�F�
��K�K�M��	�w�w�������"5���"�"���=�=����H��!�=�=�"�"���N�N����%�%��	�	���4�#��F�N�N�3�3���s�A>�>A4C2c�>�eZdZdZ				d	d�Zd�Zd�Zd�Zd�Zd�Z	y)
�_TextReaderatText format reader.

    tok: the tokenizer.
    message: The message object being built.
    DNS dynamic updates.
    last_name: The most recently read name when building a message object.
    one_rr_per_rrset: Put each RR into its own RRset?
    origin: The origin for relative names
    relativize: relativize names?
    relativize_to: the origin to relativize to.
    Nc�>�d|_tjj||��|_d|_||_||_||_||_	d|_
d|_d|_t|_d|_tj j"|_d|_y)Nr�rr)r rO�	tokenizer�	Tokenizer�tok�	last_namerpr[rz�
relativize_torMr�r�r@r�r�r�rdrR)r%�textr�rpr[rzr�s       rr$z_TextReader.__init__xs�������=�=�*�*�4�J�*�G������ 0������$���*��������	����+�����
��j�j�&�&�����
rc��|jj�}|j}|dk(r!|jj�|_�ns|dk(r�	|jj�}|j�s|jj
|��n&|jtjj|j�z|_��|dk(rB|jj�|_
|j|jdzz|_�n�|dk(r�|jdkrd|_
	|jj�}|j�s|jj
|��n@|jtjj|j�z|_��|dk(r6|jj�|_
|jdkr�d|_
n�|dk(rz|jj�}tjj|�|_|jtjj!|j�z|_nJ|d	k(r?|jj�}tj"j|�|_nt$�|jj'�y
)z5Process one line from the text format header section.rMrRr�rJ�eflagsrr�r�r�N)r�r�r*�get_intrM�
is_identifier�ungetrRrOr�r�r��edns_from_textr��
get_stringr�r)r�r�get_eol)r%ry�token�whatr�s     r�_header_linez_TextReader._header_line�s����������{�{���4�<��h�h�&�&�(�D�G�
�W�_����������*�*�,��H�H�N�N�5�)��!�Z�Z�#�)�)�*=�*=�e�k�k�*J�J��
���V�^����(�(�*�D�I�!�^�^�t�y�y�B��?�D�N�
�X�
��y�y�1�}���	����������*�*�,��H�H�N�N�5�)��!%���#�)�)�2J�2J�5�;�;�2W�!W�����Y�
��8�8�+�+�-�D�L��y�y�1�}���	�
�X�
��8�8�&�&�(�D��*�*�.�.�t�4�D�K����c�j�j�&9�&9�$�+�+�&F�F�D�J�
�W�_��8�8�&�&�(�D����,�,�T�2�D�J�$�$������rc�~�|jj|}|jjd��}|j	�sK|jj||jj|j|j�|_	|j}|�t�|jj�}|j�stjj�	tjj!|j"�}|jj�}|j�stjj�	tj(j!|j"�}|jj+||||�\}}}}|jj-||||dd��|jj/�y#tjj$rtjj�t$$rtjj&}Y��wxYw)z7Process one line from the text format question section.T��want_leadingNrt)r rSr�r��
is_whitespace�as_namer[rzr�r�r4r�rOrE�SyntaxErrorr�r�r*rH�INr�r4r�r�)r%r�r�r�r�r�r�rys        r�_question_linez_TextReader._question_line�s����,�,�'�'��7�������$��/���"�"�$�!�X�X�-�-��t�|�|�*�*�D�O�O�T�=O�=O��D�N��~�~���<� � ���������"�"�$��-�-�+�+�+�	(��n�n�.�.�u�{�{�;�G��H�H�L�L�N�E��&�&�(��m�m�/�/�/�)����(�(����5��"&�,�,�"?�"?��D�'�6�#
���&�!�Q�	
������T�7�F�4�d�	 �	
�	
��������}�}�(�(�	,��-�-�+�+�+��	(��n�n�'�'�G�	(�s�*A-G � AH<�;H<c
��|jj|}|jjd��}|j	�sK|jj||jj|j|j�|_	|j}|�t�|jj�}|j�stjj�	t|j d�}|jj�}|j�stjj�		tj$j'|j �}|jj�}|j�stjj�	tj*j'|j �}|jj-||||�\}}}}	|jj�}|	r*|j/�stjj�|	s*|j/�rtjj0�|j/�s�|jj3|�tj4j'|||j|jj|j|j�}
|
j7�}nd}
tj*j8}|jj;||||||d|j<�}|
�|j?|
|�yy#tjj$rtjj�t"$rd}Y��awxYw#tjj$rtjj�t"$rtj$j(}Y��RwxYw)zfProcess one line from the text format answer, authority, or
        additional data sections.
        Tr�Nr) r rSr�r�r�r�r[rzr�r�r4r�rOrEr�rIr*rHr�r�r�r�r4�
is_eol_or_eof�
UnexpectedEndr�r�r�r;r�rpr�)
r%r�r�r�r�rr�r�r�r�r[r�r�s
             r�_rr_linez_TextReader._rr_line�s��
�,�,�'�'��7�������$��/���"�"�$�!�X�X�-�-��t�|�|�*�*�D�O�O�T�=O�=O��D�N��~�~���<� � ���������"�"�$��-�-�+�+�+�	��e�k�k�1�%�C��H�H�L�L�N�E��&�&�(��m�m�/�/�/�)�	(��n�n�.�.�u�{�{�;�G��H�H�L�L�N�E��&�&�(��m�m�/�/�/�)����(�(����5��-1�\�\�-J�-J��D�'�6�.
�*��&�(�E����������,�,�.��-�-�+�+�+���,�,�.��-�-�-�-�-��"�"�$��H�H�N�N�5�!����$�$���������#�#�����"�"�
�B��Y�Y�[�F��B��]�]�'�'�F����'�'���������!�!�	
���>��I�I�b�#����a�}�}�(�(�	,��-�-�+�+�+��	��C�	���}�}�(�(�	,��-�-�+�+�+��	(��n�n�'�'�G�	(�s(�*AM"�A-N*�"AN'�&N'�*AP�Pc��t|j�}||j��}|j|_|jdk\r1|j|j|j|j�|jr|j|j�|jr|j|_
|S)Nr�r)rhr�rMrRr�rr�r�r�r,r[)r%r�r s   r�
_make_messagez_TextReader._make_message's���.�t�{�{�;���T�W�W�%���
�
��
��9�9��>����T�Y�Y�������E��:�:����d�j�j�)��;�;�!�[�[�G�N��rc�4�|j}d}	|jjdd�}|j�r�n |j	�r�|j
j
�}|dk(r|j}|jr
|j}n|j�}	|jj|�}|js'||_|j|j�|_|tjk(r
|j}n|j }|jj%���*|jj'|�||���N|js|j�|_|jS#t"$rY�ywxYw)zNRead a text format DNS message and build a dns.message.Message
        object.NT�HEADER)r�r�r�r��
is_commentr*�upperr r�r�r�r1rpr6r>r�r�rHr�r�)r%�line_methodr�r��ur s      rr�z_TextReader.read3s`���'�'������H�H�L�L��t�,�E��"�"�$�����!��K�K�%�%�'����=�"&�"3�"3�K��<�<�"�l�l�G�#�0�0�2�G��%,�%:�%:�%D�%D�Q�%G�N� �<�<�'.���07�0M�0M� �1�1�1��-�&��)@�)@�@�&*�&9�&9��&*�m�m����� � �"���H�H�N�N�5�!���'�E�F�|�|��-�-�/�D�L��|�|���!����s�#A:F�	F�F)FNTN)
rr
rrr$r�r�r�r�r�rrrr�r�ks7��
� �����0'�R!�FI�V
�+rr�r�r�rzr�c�B�t||||||�}|j�S)aConvert the text format message into a message object.

    The reader stops after reading the first blank line in the input to
    facilitate reading multiple messages from a single file with
    ``dns.message.from_file()``.

    *text*, a ``str``, the text format message.

    *idna_codec*, a ``dns.name.IDNACodec``, specifies the IDNA
    encoder/decoder.  If ``None``, the default IDNA 2003 encoder/decoder
    is used.

    *one_rr_per_rrset*, a ``bool``.  If ``True``, then each RR is put
    into its own rrset.  The default is ``False``.

    *origin*, a ``dns.name.Name`` (or ``None``), the
    origin to use for relative names.

    *relativize*, a ``bool``.  If true, name will be relativized.

    *relativize_to*, a ``dns.name.Name`` (or ``None``), the origin to use
    when relativizing names.  If not set, the *origin* value will be used.

    Raises ``dns.message.UnknownHeaderField`` if a header is unknown.

    Raises ``dns.exception.SyntaxError`` if the text is badly formed.

    Returns a ``dns.message.Message object``
    )r�r�)r�r�rpr[rzr�r�s       rr�r�as+��T��j�*�F�J�
��F��;�;�=�rr�c��t|t�rt|�}ntj|�}|5}t|||�cddd�S#1swYnxYwJ�)a�Read the next text format message from the specified file.

    Message blocks are separated by a single blank line.

    *f*, a ``file`` or ``str``.  If *f* is text, it is treated as the
    pathname of a file to open.

    *idna_codec*, a ``dns.name.IDNACodec``, specifies the IDNA
    encoder/decoder.  If ``None``, the default IDNA 2003 encoder/decoder
    is used.

    *one_rr_per_rrset*, a ``bool``.  If ``True``, then each RR is put
    into its own rrset.  The default is ``False``.

    Raises ``dns.message.UnknownHeaderField`` if a header is unknown.

    Raises ``dns.exception.SyntaxError`` if the text is badly formed.

    Returns a ``dns.message.Message object``
    N)r�r��open�
contextlib�nullcontextr�)r�r�rp�cms    r�	from_filer��sS��4�!�S��04�Q���
�
#�
#�A�
&��	�:�q���J�(8�9�:�:�:���5s�
A�ArXr�r�rr&r�r�rUr�rMrRrVc
�P�t|t�r!tjj	||	��}tj
jj|�}tjjj|�}t|
��}
tjj|�|
_|
j|
j|||dd��i}|�||d<|�||d<|�||d<|�||d<|r|�d	}||d
<||d<|
jdi|��|
j!|�|
S)
a�Make a query message.

    The query name, type, and class may all be specified either
    as objects of the appropriate type, or as strings.

    The query will have a randomly chosen query id, and its DNS flags
    will be set to dns.flags.RD.

    qname, a ``dns.name.Name`` or ``str``, the query name.

    *rdtype*, an ``int`` or ``str``, the desired rdata type.

    *rdclass*, an ``int`` or ``str``,  the desired rdata class; the default
    is class IN.

    *use_edns*, an ``int``, ``bool`` or ``None``.  The EDNS level to use; the
    default is ``None``.  If ``None``, EDNS will be enabled only if other
    parameters (*ednsflags*, *payload*, *request_payload*, or *options*) are
    set.
    See the description of dns.message.Message.use_edns() for the possible
    values for use_edns and their meanings.

    *want_dnssec*, a ``bool``.  If ``True``, DNSSEC data is desired.

    *ednsflags*, an ``int``, the EDNS flag values.

    *payload*, an ``int``, is the EDNS sender's payload field, which is the
    maximum size of UDP datagram the sender can handle.  I.e. how big
    a response to this message can be.

    *request_payload*, an ``int``, is the EDNS payload size to use when
    sending this message.  If not specified, defaults to the value of
    *payload*.

    *options*, a list of ``dns.edns.Option`` objects or ``None``, the EDNS
    options.

    *idna_codec*, a ``dns.name.IDNACodec``, specifies the IDNA
    encoder/decoder.  If ``None``, the default IDNA 2003 encoder/decoder
    is used.

    *id*, an ``int`` or ``None``, the desired query id.  The default is
    ``None``, which generates a random query id.

    *flags*, an ``int``, the desired query flags.  The default is
    ``dns.flags.RD``.

    *pad*, a non-negative ``int``.  If 0, the default, do not pad; otherwise add
    padding bytes to make the message size a multiple of *pad*.  Note that if
    padding is non-zero, an EDNS PADDING option will always be added to the
    message.

    Returns a ``dns.message.QueryMessage``
    r�r�Trtr�r�rUr�rr�rVr)r�r�rOr�r�r�r�r�r�r�rKrRr�r�rcrr&)rXr�r�rr&r�r�rUr�r�rMrRrVr�r's               r�
make_queryr��s��L�%������"�"�5�Z�"�@��
�]�]�
$�
$�
)�
)�&�
1�F��n�n�'�'�,�,�W�5�G����A��i�i�n�n�U�#�A�G��L�L����U�G�V�D�t�L�T� �F���'��{����#��y���"�$3�� �!���#��y��
�(�"����F�6�N��F�5�M��A�J�J�����M�M�+���Hr�query�recursion_available�our_payloadr�rc	���|jtjjzrtjj	d��t|j
��}||j��}tjj|jtjjzz|_|r-|xjtjjzc_|j|j
��t|j�|_|jdk\ri|�Gd}|jD]6}|jtjj j"k(s�5d}�8|j%dd||j&|��|j(rF|j+|j,|j.|d|d|j0�|j2|_|S)a�Make a message which is a response for the specified query.
    The message returned is really a response skeleton; it has all of the infrastructure
    required of a response, but none of the content.

    The response's question section is a shallow copy of the query's question section,
    so the query's question RRsets should not be changed.

    *query*, a ``dns.message.Message``, the query to respond to.

    *recursion_available*, a ``bool``, should RA be set in the response?

    *our_payload*, an ``int``, the payload size to advertise in EDNS responses.

    *fudge*, an ``int``, the TSIG time fudge.

    *tsig_error*, an ``int``, the TSIG error.

    *pad*, a non-negative ``int`` or ``None``.  If 0, the default, do not pad; otherwise
    if not ``None`` add padding bytes to make the message size a multiple of *pad*.
    Note that if padding is non-zero, an EDNS PADDING option will always be added to the
    message.  If ``None``, add padding following RFC 8467, namely if the request is
    padded, pad the response to 468 otherwise do not pad.

    Returns a ``dns.message.Message`` object whose specific class is appropriate for the
    query.  For example, if query is a ``dns.update.UpdateMessage``, response will be
    too.
    z&specified query message is not a queryr�rNi�)rVr)rRrOr�rErMrhr�rM�RD�RAr/�listrcr�r��otype�
OptionType�PADDINGrr�rrrWr�rr�rY)	r�r�r�r�rrVr��responser�s	         r�
make_responser�sc��H
�{�{�S�Y�Y�\�\�!��m�m�%�%�&N�O�O�*�5�<�<�>�:�G��%�(�(�#�H��Y�Y�\�\�U�[�[�3�9�9�<�<�%?�@�H�N�����#�)�)�,�,�&���������'��U�^�^�,�H���z�z�Q���;��C��-�-�
���<�<�3�8�8�#6�#6�#>�#>�>��C�
�	���!�Q��U�]�]���D��~�~�����M�M��M�M��������	
� %�y�y����Or)NrFNNFFFFFF)NFNTNr3)Fi rrN)[rr�r�r_�typingrrrrrr�dns.ednsrO�dns.entropy�dns.enum�
dns.exception�	dns.flags�dns.name�
dns.opcode�	dns.rcode�	dns.rdata�dns.rdataclass�
dns.rdatatype�dns.rdtypes.ANY.OPT�dns.rdtypes.ANY.TSIG�dns.renderer�	dns.rrset�dns.tsig�dns.ttl�dns.wirerErMr
r�DNSExceptionrrrrrr.r0r2r�r4�enum�IntEnumr6rDr@rOrIr�r:r�r�r�r��IndexKeyTyper�r��	IndexTyper�r<rLrErKrbrhrjrrrX�HMACTSig�GSSTSigr�r�r=r�r�r�rRr�r�rAr�r�r>r?r@rArrr�<module>r�s���$��	��:�:�������������������=�#�-�-�)�)�=�P�3�=�=�*�*�P�����3�3��
$�c�m�m�%�%�$�
$�c�m�m�%�%�$�
3�S�]�]�/�/�3�&��
�
�*�*�&�$0�s�}�}�1�1�0�'�3�=�=�-�-�'�9��
�
�2�2�9�&�S�]�]�.�.�&�
�S�X�X�%�%�
������	����H�H�M�M��N�N����M�M����S�]�]�
$�
$�%��S�^�^�
&�
&�'�)���
��s�y�y���.�/�	��C��d�3�9�9�?�?�3�3�4��a.�a.�H��@Z6�7�Z6�z��z�z�~"�#&��&*�EI���"�!� %�#�k
�
�k
�
�c�]�k
��%��k
�
�	k
�

�S�X�X�]�]�#�k
��u�S�X�X�.�.����0@�0@�@�A�B�
k
��k
��k
��k
��k
��k
��k
�
�k
�\s�s�p04�"�&*��-1�
-�

�-�����+�+�,�-��-�
�S�X�X�]�]�#�	-�
�-��C�H�H�M�M�*�
-�
�-�d04�"� �
� �����+�+�,� �� �
�	 �L69�^�^�5F�5F�+/��#�!�%)�/3�/3��������_
��������#�$�_
��#�-�-�)�)�3�.�/�_
��3�>�>�,�,�c�1�
2�_
��u�S�$�Y�'�(�	_
�
�_
���}�
_
��c�]�_
��c�]�_
��d�3�8�8�?�?�+�
,�_
�����+�+�,�_
�	��
�_
��_
�

�_
��_
�H!&�����
@��@��@��@��	@�
�@�
�#��
@�
�@�J�"�"��	�	�	���$�$�	�
�
&�
&�
r

Zerion Mini Shell 1.0