%PDF- %PDF-
Mini Shell

Mini Shell

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

�

Ϫ�f���z
�dZddlmZddlZddlZddlZddlZddlmZddl	m
Z
ddlmZm
Z
mZmZmZddlmZmZmZddlmZmZdd	lmZdd
lmZmZmZmZddl m!Z!m"Z"m#Z#gd�Z$ejJZ%d
�Z&d�Z'd�Z(d�Z)dZ*e+dd�\Z,Z-Z.Z/Z0Z1Z2Z3Z4Z5Z6Z7Z8Z9Z:Z;Z<Z=dZ>dZ?dZ@dZAdZBdZCdZDdZEdZFdZGie,d�e-d�e.d �e/d!�e0d"�e1d#�e2d$�e3d%�e4d&�e5d'�e6d(�e7d)�e8d*�e9d+�e:d,�e;d-�e<d.�e=d/e>d0e?d1e@d2eAd3eBd4eCd5eDd6eEd7eFd8eGd9i�ZHe+d:d;�\ZIZJZKZLZMeId<eJd=eKd>eLd?eMd@iZNe
eHj��eNj���D��cic]\}}||��
c}}ZPe+ddA�\ZQZRZSZTdBZUeQdCeRdDeSdEeTdFeUdGiZVeVj��D��cic]\}}||��
c}}ZWe+dH�\ZXZYZZdIZ[dAZ\e+dJ�\Z]Z^Z_Z`ZaZbdKZce+dKd�\ZdZeZfGdL�dMe�ZgddNlhmiZimjZjmkZkdO�Zld�dP�ZmdQ�Znd�dR�Zoed�dS��Zped�dT��Zpd�dU�ZpdV�ZqGdW�dXe�ZrGdY�dZereg�Zseer�Gd[�d\��Zteer�Gd]�d^��Zue"eer�Gd_�d`���Zveer�Gda�dbej�ej���Zyeer�Gdc�ddej�ej���Zzeer�Gde�dfej���Z{ees�Gdg�dhej�ej���Z|Gdi�dje|�Z}Gdk�dle|�Z~Gdm�dne|�ZGdo�dpe|�Z�Gdq�dre|�Z�Gds�dte|�Z�Gdu�dve|�Z�Gdw�dxe|�Z�Gdy�dze|�Z�ees�Gd{�d|ej���Z�ees�Gd}�d~ej�ej���Z�ees�Gd�d�ej�ej���Z�ees�Gd��d�ej�ej���Z�ees�Gd��d�ej�ej���Z�ees�Gd��d�ej�ej���Z�ees�Gd��d�ej�ej���Z�ees�Gd��d�ej�ej���Z�ees�Gd��d�ej�ej���Z�ees�Gd��d�ej�ej���Z�ees�Gd��d�ej�ej���Z�ees�Gd��d�ej�ej���Z�ees�Gd��d�ej�ej���Z�ees�Gd��d�ej�ej���Z�ees�Gd��d�ej�ej���Z�ees�Gd��d�ej�ej���Z�Gd��d�e��Z�ees�Gd��d�ej�ej���Z�d��Z�d��Z�				d�											d�d��Z�Gd��d�ej��Z�Gd��d�ej��Z�Gd��d��Z�Gd��d�e�e�j<�Z�Gd��d�e�e�j@�Z�ycc}}wcc}}w)�zU
DNS protocol implementation.

Future Plans:
    - Get rid of some toplevels, maybe.
�)�annotationsN)�BytesIO)�chain)�Optional�Sequence�SupportsInt�Union�overload)�	Attribute�	Interface�implementer)�defer�protocol)�CannotListenError)�failure�log�	randbytes�util)�cmp�
comparable�nativeString)d�
IEncodable�IRecord�IEncodableRecord�A�A6�AAAA�AFSDB�CNAME�DNAME�HINFO�MAILA�MAILB�MB�MD�MF�MG�MINFO�MR�MX�NAPTR�NS�NULL�OPT�PTR�RP�SOA�SPF�SRV�TXT�SSHFP�TSIG�WKS�ANY�CH�CS�HS�IN�ALL_RECORDS�AXFR�IXFR�EFORMAT�ENAME�ENOTIMP�EREFUSED�ESERVER�EBADVERSION�EBADSIG�EBADKEY�EBADTIME�Record_A�	Record_A6�Record_AAAA�Record_AFSDB�Record_CNAME�Record_DNAME�Record_HINFO�	Record_MB�	Record_MD�	Record_MF�	Record_MG�Record_MINFO�	Record_MR�	Record_MX�Record_NAPTR�	Record_NS�Record_NULL�
Record_PTR�	Record_RP�
Record_SOA�
Record_SPF�
Record_SRV�Record_SSHFP�Record_TSIG�
Record_TXT�
Record_WKS�
UnknownRecord�
QUERY_CLASSES�QUERY_TYPES�REV_CLASSES�	REV_TYPES�EXT_QUERIES�Charstr�Message�Name�Query�RRHeader�SimpleRecord�DNSDatagramProtocol�DNSMixin�DNSProtocol�OK�
OP_INVERSE�	OP_NOTIFY�OP_QUERY�	OP_STATUS�	OP_UPDATE�PORT�AuthoritativeDomainError�DNSQueryTimeoutError�DomainErrorc��t|g�S)z�
    Construct a bytes object representing a single byte with the given
    ordinal value.

    @type ordinal: L{int}
    @rtype: L{bytes}
    ��bytes)�ordinals �3/usr/lib/python3/dist-packages/twisted/names/dns.py�
_ord2bytesr��s���'����c��t|�ddS)z�
    Represent a mostly textful bytes object in a way suitable for
    presentation to an end user.

    @param bytes: The bytes to represent.
    @rtype: L{str}
    �N)�reprr}s r��
_nicebytesr��s����;�q�r�?�r�c
�z�djdj|D�cgc]
}t|���c}��Scc}w)z�
    Represent a list of mostly textful bytes objects in a way suitable for
    presentation to an end user.

    @param list: The list of bytes to represent.
    @rtype: L{str}
    z[{}]�, )�format�joinr�)�list�bs  r��_nicebyteslistr��s.���=�=����4�#@�a�J�q�M�#@�A�B�B��#@s�8c�^�tjdtjdd���dS)z�
    Wrapper around L{twisted.python.randbytes.RandomFactory.secureRandom} to
    return 2 random bytes.

    @rtype: L{bytes}
    �H�T)�fallbackr)�struct�unpackr�secureRandom�r�r��randomSourcer��s'���=�=��i�4�4�Q��F�G��J�Jr��5r����!�#�&�'�)�,�c��rr,r%r&rr1r$r'r)r-r7r/r!r(r*r4r0rrr3r+rr r.r5r2�TKEYr6��r?r>r#r"r=��r<r:r9r;r8����c� �eZdZdZed�Zy)rz0
    A single entry in a zone of authority.
    z,An indicator of what kind of record this is.N)�__name__�
__module__�__qualname__�__doc__r�TYPEr�r�r�rrs����C�D�Dr�r)ryrzr{c�h�|dvrdgS|jd�}|ddk7r|jd�|S)a2
    Split a domain name into its constituent labels.

    @type name: L{bytes}
    @param name: A fully qualified domain name (with or without a
        trailing dot).

    @return: A L{list} of labels ending with an empty label
        representing the DNS root zone.
    @rtype: L{list} of L{bytes}
    )r��.r�r����)�split�append)�name�labelss  r��
_nameToLabelsr�+s>���{���u��
�Z�Z��
�F�
�b�z�S���
�
�c���Mr�c
���t|t�r|jd�}t|t�sBt	djtjtj|t|����|S)a�
    Coerce a domain name string to bytes.

    L{twisted.names} represents domain names as L{bytes}, but many interfaces
    accept L{bytes} or a text string (L{unicode} on Python 2, L{str} on Python
    3). This function coerces text strings using IDNA encoding --- see
    L{encodings.idna}.

    Note that DNS is I{case insensitive} but I{case preserving}. This function
    doesn't normalize case, so you'll still need to do that whenever comparing
    the strings it returns.

    @param domain: A domain name.  If passed as a text string it will be
        C{idna} encoded.
    @type domain: L{bytes} or L{str}

    @returns: L{bytes} suitable for network transmission.
    @rtype: L{bytes}

    @since: Twisted 20.3.0
    �idnaz+Expected {} or {} but found {!r} of type {})�
isinstance�str�encoder~�	TypeErrorr�r��type)�domains r��domainStringr�?s]��,�&�#�����v�&���f�e�$��9�@�@�������f�d�6�l�
�
�	
�
�Mr�c��t|j��}t|j��}|t|�d|k(S)a)
    Test whether C{descendantName} is equal to or is a I{subdomain} of
    C{ancestorName}.

    The names are compared case-insensitively.

    The names are treated as byte strings containing one or more
    DNS labels separated by B{.}.

    C{descendantName} is considered equal if its sequence of labels
    exactly matches the labels of C{ancestorName}.

    C{descendantName} is considered a I{subdomain} if its sequence of
    labels ends with the labels of C{ancestorName}.

    @type descendantName: L{bytes}
    @param descendantName: The DNS subdomain name.

    @type ancestorName: L{bytes}
    @param ancestorName: The DNS parent or ancestor domain name.

    @return: C{True} if C{descendantName} is equal to or if it is a
        subdomain of C{ancestorName}. Otherwise returns C{False}.
    N)r��lower�len)�descendantName�ancestorName�descendantLabels�ancestorLabelss    r��_isSubdomainOfr�`sF��2%�^�%9�%9�%;�<��"�<�#5�#5�#7�8�N��S��0�0�2�3�~�E�Er�c��d}|j�j�}|D]2\}}|j|�s�tt	|dd�|z�cS	t|�S#t
$rtd|z��wxYw)zm
    mypy doesn't like type-punning str | bytes | int | None into a str so we have this helper function.
    ))�Sr�)�M�<)r�i)�Di�Q)�Wi�:	)�Yi�3�Nr�z!Invalid time interval specifier: )�upper�strip�endswith�int�float�
ValueError)�s�suffixes�suff�mults    r��	_str2timer�~s����H�	
���	����A��-�
��d��:�:�d���u�Q�s��V�}�t�+�,�,�-�B��1�v�
���B��<�q�@�A�A�B�s�
A$�$A<c��y�Nr��r�s r��str2timer�����r�c��yr�r�r�s r�r�r��r�r�c��t|t�rt|jd��St|t�rt|�S|S)aE
    Parse a string description of an interval into an integer number of seconds.

    @param s: An interval definition constructed as an interval duration
        followed by an interval unit.  An interval duration is a base ten
        representation of an integer.  An interval unit is one of the following
        letters: S (seconds), M (minutes), H (hours), D (days), W (weeks), or Y
        (years).  For example: C{"3S"} indicates an interval of three seconds;
        C{"5D"} indicates an interval of five days.  Alternatively, C{s} may be
        any non-string and it will be returned unmodified.
    @type s: text string (L{bytes} or L{str}) for parsing; anything else
        for passthrough.

    @return: an L{int} giving the interval represented by the string C{s}, or
        whatever C{s} is if it is not a string.
    �ascii)r�r~r��decoder�r�s r�r�r��s;��"�!�U������'�*�+�+��!�S����|���Hr�c�P�|j|�}t|�|krt�|Sr�)�readr��EOFError)�file�l�buffs   r��
readPreciselyr��s$���9�9�Q�<�D�
�4�y�1�}����Kr�c� �eZdZdZdd�Zdd�Zy)rz�
    Interface for something which can be encoded to and decoded
    to the DNS wire format.

    A binary-mode file object (such as L{io.BytesIO}) is used as a buffer when
    encoding or decoding.
    Nc��y)a�
        Write a representation of this object to the given
        file object.

        @type strio: File-like object
        @param strio: The buffer to write to. It must have a C{tell()} method.

        @type compDict: L{dict} of L{bytes} to L{int} r L{None}
        @param compDict: A mapping of names to byte offsets that have already
        been written to the buffer, which may be used for compression (see RFC
        1035 section 4.1.4). When L{None}, encode without compression.
        Nr�)�strio�compDicts  r�r�zIEncodable.encode���r�c��y)a�
        Reconstruct an object from data read from the given
        file object.

        @type strio: File-like object
        @param strio: A seekable buffer from which bytes may be read.

        @type length: L{int} or L{None}
        @param length: The number of bytes in this RDATA field.  Most
        implementations can ignore this value.  Only in the case of
        records similar to TXT where the total length is in no way
        encoded in the data is it necessary.
        Nr�)r��lengths  r�r�zIEncodable.decode�r�r�r�)r�r�r�r�r�r�r�r�r�rr�s����
r�rc��eZdZdZy)rz`
    Interface for DNS records that can be encoded and decoded.

    @since: Twisted 21.2.0
    N)r�r�r�r�r�r�r�rr�s��r�rc�<�eZdZdd	d�Zd
d�Zd
d�Zdd�Zd�Zdd�Zy)
ric�N�t|t�st|�d���||_y)Nz is not a byte string)r�r~r��string)�selfr�s  r��__init__zCharstr.__init__�s&���&�%�(���z�)>�?�@�@���r�Nc��|j}t|�}|jt|��|j|�y)z�
        Encode this Character string into the appropriate byte format.

        @type strio: file
        @param strio: The byte representation of this Charstr will be written
            to this file.
        N)r�r��writer�)r�r�r�r��inds     r�r�zCharstr.encode�s2�������&�k��
���J�s�O�$�
���F�r�c�^�d|_tt|d��}t||�|_y)a 
        Decode a byte string into this Charstr.

        @type strio: file
        @param strio: Bytes will be read from this file until the full string
            is decoded.

        @raise EOFError: Raised when there are not enough bytes available from
            C{strio}.
        r�r�N)r��ordr�)r�r�r�r�s    r�r�zCharstr.decodes*������
�e�Q�'�(��#�E�1�-��r�c�`�t|t�r|j|jk(StSr�)r�rir��NotImplemented�r��others  r��__eq__zCharstr.__eq__s%���e�W�%��;�;�%�,�,�.�.��r�c�,�t|j�Sr�)�hashr��r�s r��__hash__zCharstr.__hash__s���D�K�K� � r�c�,�t|j�S)zI
        Represent this L{Charstr} instance by its string value.
        )rr�rs r��__str__zCharstr.__str__s���D�K�K�(�(r��r�)r�r~r��r�object�return�bool�r
r�)	r�r�r�r�r�r�rrr	r�r�r�riri�s ���
�
.��
!�)r�ric�@�eZdZdZd	d
d�Zdd�Zdd�Zdd�Zd�Zd
d�Z	y)rkz�
    A name in the domain name system, made up of multiple labels.  For example,
    I{twistedmatrix.com}.

    @ivar name: A byte string giving the name.
    @type name: L{bytes}
    c�$�t|�|_y)zM
        @param name: A name.
        @type name: L{bytes} or L{str}
        N)r�r�)r�r�s  r�r�z
Name.__init__*s��
!��&��	r�Nc��|j}|r�|�T||vr,|jtjdd||z��y|j	�t
jz||<|jd�}|dkDr|d|||dzd}}n|}d}t|�}|jt|��|j|�|r��|jd�y)a�
        Encode this Name into the appropriate byte format.

        @type strio: file
        @param strio: The byte representation of this Name will be written to
        this file.

        @type compDict: dict
        @param compDict: dictionary of Names that have already been encoded
        and whose addresses may be backreferenced by this Name (for the purpose
        of reducing the message size).
        N�!Hi�r�rr��)
r�r�r��pack�tellrj�
headerSize�findr�r�)r�r�r�r�r��labels      r�r�zName.encode1s����y�y����#��8�#��K�K����D�&�8�D�>�2I� J�K��%*�Z�Z�\�G�4F�4F�%F�H�T�N��)�)�D�/�C��Q�w�"�4�C�j�$�s�Q�w�y�/�t�������%�j���K�K�
�3��(��K�K���!�"	���G�r�c���t�}d|_d}	tt|d��}|dk(r|dkDr|j	|�y|dz	dk(re|dzdztt|d��z}||vrtd	��|j
|�|dk(r|j�}|j	|���t||�}|jdk(r||_n|jd
z|z|_��)a�
        Decode a byte string into this Name.

        @type strio: file
        @param strio: Bytes will be read from this file until the full Name
        is decoded.

        @raise EOFError: Raised when there are not enough bytes available
        from C{strio}.

        @raise ValueError: Raised when the name cannot be decoded (for example,
            because it contains a loop).
        r�rr�Nr�r��?�z Compression loop in encoded namer�)�setr�r�r��seekr��addr)r�r�r��visited�offr��new_offrs        r�r�zName.decodeRs����%����	�����M�%��+�,�A��A�v���7��J�J�s�O���Q��1�}��r�6�a�-�#�m�E�1�.E�*F�F���g�%�$�%G�H�H����G�$��!�8��*�*�,�C��
�
�7�#��!�%��+�E��y�y�C��!��	� �I�I��,�u�4��	�'r�c��t|t�r5|jj�|jj�k(StSr�)r�rkr�r�rrs  r�rzName.__eq__xs5���e�T�"��9�9�?�?�$��
�
�(8�(8�(:�:�:��r�c�,�t|j�Sr��rr�rs r�rz
Name.__hash__}����D�I�I��r�c�,�t|j�S)zE
        Represent this L{Name} instance by its string name.
        �rr�rs r�r	zName.__str__�s���D�I�I�&�&r�r
)r��bytes | strr�rr)
r�r�r�r�r�r�r�rrr	r�r�r�rkrk s'���'��B$5�L�
�'r�rkc�L�eZdZdZdeefdd�Zdd�Zdd�Zd�Z	d�Z
d
d	�Zd
d
�Zy)rlz�
    Represent a single DNS query.

    @ivar name: The name about which this query is requesting information.
    @type name: L{Name}

    @ivar type: The query type.
    @type type: L{int}

    @ivar cls: The query class.
    @type cls: L{int}
    r�c�@�t|�|_||_||_y)z�
        @type name: L{bytes} or L{str}
        @param name: See L{Query.name}

        @type type: L{int}
        @param type: The query type.

        @type cls: L{int}
        @param cls: The query class.
        N)rkr�r��cls�r�r�r�r,s    r�r�zQuery.__init__�s����J��	���	���r�Nc��|jj||�|jtjd|j
|j��y�N�!HH)r�r�r�r�rr�r,�r�r�r�s   r�r�zQuery.encode�s7���	�	�����)�
���F�K�K��t�y�y�$�(�(�;�<r�c��|jj|�t|d�}tjd|�\|_|_y)Nr�r0)r�r�r�r�r�r�r,)r�r�r�r�s    r�r�zQuery.decode�s9���	�	������U�A�&��$�m�m�E�4�8���	�4�8r�c��t|jjj�|j|jf�Sr�)rr�r�r�r,rs r�rzQuery.__hash__�s-���T�Y�Y�^�^�)�)�+�T�Y�Y����A�B�Br�c�*�t|t�r~t|jjj	�|j
|jf|jjj	�|j
|jf�StSr�)r�rlrr�r�r�r,rrs  r��__cmp__z
Query.__cmp__�sg���e�U�#�������%�%�'����D�H�H�=������&�&�(�%�*�*�e�i�i�@��
��r�c��tj|jtj|jd|jz��}tj|j
d|j
z�}d|j�d|�d|�d�S)N�UNKNOWN (%d)z<Query � �>)re�getr�rhrdr,r��r��t�cs   r�r	z
Query.__str__�sq���O�O��I�I�{���t�y�y�.�4�9�9�2L�M�
��
���d�h�h�����(A�B�������1�Q�C�q���1�-�-r�c�j�d|jj�d|j�d|j�d�S)NzQuery(r��))r�r�r,rs r��__repr__zQuery.__repr__�s.����	�	���)��D�I�I�=��4�8�8�,�a�H�Hr�)r��Union[bytes, str]r�r�r,r�r�r)
r�r�r�r�rr<r�r�r�rr5r	r@r�r�r�rlrl�s6���25�!�PR�
�=�9�
C��.�Ir�rlc�~�eZdZdZdd�fdddddd	fZd
Z					dd�Zed
��Zed��Z	dd�Z
dd�Zed��Z
y)�
_OPTHeaderaZ
    An OPT record header.

    @ivar name: The DNS name associated with this record. Since this
        is a pseudo record, the name is always an L{Name} instance
        with value b'', which represents the DNS root zone. This
        attribute is a readonly property.

    @ivar type: The DNS record type. This is a fixed value of 41
        C{dns.OPT} for OPT Record. This attribute is a readonly
        property.

    @see: L{_OPTHeader.__init__} for documentation of other public
        instance attributes.

    @see: U{https://tools.ietf.org/html/rfc6891#section-6.1.2}

    @since: 13.2
    r�c�,�t|j�Sr�r()�ns r��<lambda>z_OPTHeader.<lambda>�s��<����/�r�r��udpPayloadSize�
extendedRCODE�version�dnssecOK�options)r�r�rGrHrIrJrKNc�R�||_||_||_||_|�g}||_y)a�
        @type udpPayloadSize: L{int}
        @param udpPayloadSize: The number of octets of the largest UDP
            payload that can be reassembled and delivered in the
            requestor's network stack.

        @type extendedRCODE: L{int}
        @param extendedRCODE: Forms the upper 8 bits of extended
            12-bit RCODE (together with the 4 bits defined in
            [RFC1035].  Note that EXTENDED-RCODE value 0 indicates
            that an unextended RCODE is in use (values 0 through 15).

        @type version: L{int}
        @param version: Indicates the implementation level of the
            setter.  Full conformance with this specification is
            indicated by version C{0}.

        @type dnssecOK: L{bool}
        @param dnssecOK: DNSSEC OK bit as defined by [RFC3225].

        @type options: L{list}
        @param options: A L{list} of 0 or more L{_OPTVariableOption}
            instances.
        N�rGrHrIrJrK)r�rGrHrIrJrKs      r�r�z_OPTHeader.__init__�s4��@-���*������ ��
��?��G���r�c��td�S)a/
        A readonly property for accessing the C{name} attribute of
        this record.

        @return: The DNS name associated with this record. Since this
            is a pseudo record, the name is always an L{Name} instance
            with value b'', which represents the DNS root zone.
        r�)rkrs r�r�z_OPTHeader.names���C�y�r�c��tS)z�
        A readonly property for accessing the C{type} attribute of
        this record.

        @return: The DNS record type. This is a fixed value of 41
            (C{dns.OPT} for OPT Record.
        )r.rs r�r�z_OPTHeader.type$s	���
r�c	�x�t�}|jD]}|j|��|j�}t	|j
j
|j|j|jdz|jdzz|jdzzt|���j||�y)a�
        Encode this L{_OPTHeader} instance to bytes.

        @type strio: file
        @param strio: the byte representation of this L{_OPTHeader}
            will be written to this file.

        @type compDict: L{dict} or L{None}
        @param compDict: A dictionary of backreference addresses that
            have already been written to this stream and that may
            be used for DNS name compression.
        �r��)r�r�r,�ttl�payloadN)rrKr��getvaluermr�r�rGrHrIrJrc)r�r�r�r��o�optionBytess      r�r�z_OPTHeader.encode/s���
�I�����	�A�
�H�H�Q�K�	��j�j�l������������#�#��#�#�r�)�D�L�L�B�,>�>����RT�AT�T�!�+�.�	
��&���
!r�c	��t�}|j||�tt||j��|_|j
|�}|jD]}|dvs�t||t||��� y)a
        Decode bytes into an L{_OPTHeader} instance.

        @type strio: file
        @param strio: Bytes will be read from this file until the full
            L{_OPTHeader} is decoded.

        @type length: L{int} or L{None}
        @param length: Not used.
        )r�r�N)
rmr�rcr��rdlengthrT�fromRRHeader�compareAttributes�setattr�getattr)r�r�r��h�newOptHeader�attrNames      r�r�z_OPTHeader.decodeIss��
�J��	������!�-��q�z�z�"B�C��	��(�(��+���.�.�	I�H��/�/���h���h�(G�H�	Ir�c���d}|j��g}t|jj�}t|jj�}|j	�|kr@t�}|j
|�|j|�|j	�|kr�@||j|jdz	|jdz	dz|jdzdz	|��S)ai
        A classmethod for constructing a new L{_OPTHeader} from the
        attributes and payload of an existing L{RRHeader} instance.

        @type rrHeader: L{RRHeader}
        @param rrHeader: An L{RRHeader} instance containing an
            L{UnknownRecord} payload.

        @return: An instance of L{_OPTHeader}.
        @rtype: L{_OPTHeader}
        NrQr�r�i��rRrM)
rTr�datar�r�_OPTVariableOptionr�r�r,rS)r,�rrHeaderrK�optionsBytes�optionsBytesLengthrVs      r�rZz_OPTHeader.fromRRHeader_s��������'��G�"�8�#3�#3�#8�#8�9�L�!$�X�%5�%5�%:�%:�!;���#�#�%�(:�:�&�(������&����q�!��#�#�%�(:�:��#�<�<�"�,�,�"�,��L�L�B�&��-��l�l�V�+��2��
�	
r�)irrFNr�)r�r�r�r��showAttributesr[r��propertyr�r�r�r��classmethodrZr�r�r�rCrC�s����*
�/�0��������N��������
'�R�	��	�����"�4I�,�
��
r�rCc�<�eZdZdZddeffZdZdZd
d�Zdd�Z	dd	�Z
y)rcz�
    A class to represent OPT record variable options.

    @see: L{_OPTVariableOption.__init__} for documentation of public
        instance attributes.

    @see: U{https://tools.ietf.org/html/rfc6891#section-6.1.2}

    @since: 13.2
    �coderb�rkrbr0c� �||_||_y)z�
        @type code: L{int}
        @param code: The option code

        @type data: L{bytes}
        @param data: The option data
        Nrl)r�rkrbs   r�r�z_OPTVariableOption.__init__�s����	���	r�Nc	��|jtj|j|jt|j��|jz�y)a�
        Encode this L{_OPTVariableOption} to bytes.

        @type strio: file
        @param strio: the byte representation of this
            L{_OPTVariableOption} will be written to this file.

        @type compDict: L{dict} or L{None}
        @param compDict: A dictionary of backreference addresses that
            have already been written to this stream and that may
            be used for DNS name compression.
        N)r�r�r�_fmtrkr�rbr1s   r�r�z_OPTVariableOption.encode�s6��	���F�K�K��	�	�4�9�9�c�$�)�)�n�E��	�	�Q�Rr�c���tj|j�}t||�}tj|j|�\|_}t||�|_y)a 
        Decode bytes into an L{_OPTVariableOption} instance.

        @type strio: file
        @param strio: Bytes will be read from this file until the full
            L{_OPTVariableOption} is decoded.

        @type length: L{int} or L{None}
        @param length: Not used.
        N)r��calcsizeror�r�rkrb)r�r�r�r�r�s     r�r�z_OPTVariableOption.decode�sK��
�O�O�D�I�I�&���U�A�&��"�M�M�$�)�)�T�:���	�6�!�%��0��	r�)rr�r�)r�r�r�r�rrgr[ror�r�r�r�r�r�rcrc�s3��	��v�|�4�5�N�(���D�	�
S�1r�rcc�n�eZdZdZdZdZdZdZdee	dddf											d
d�Z
dd	�Zdd
�Zd�Z
dd�ZeZy)rmak
    A resource record header.

    @cvar fmt: L{str} specifying the byte format of an RR.

    @ivar name: The name about which this reply contains information.
    @type name: L{Name}

    @ivar type: The query type of the original request.
    @type type: L{int}

    @ivar cls: The query class of the original request.

    @ivar ttl: The time-to-live for this record.
    @type ttl: L{int}

    @ivar payload: The record described by this header.
    @type payload: L{IEncodableRecord} or L{None}

    @ivar auth: A L{bool} indicating whether this C{RRHeader} was parsed from
        an authoritative message.
    )r�r�r,rSrT�authz!HHIHNr�rFc	�B�|�dn|j}|�?||k7r:tdtj||��dtj||��d���t	|�}|dkrtd��t|�|_||_||_||_	||_
||_y)a�
        @type name: L{bytes} or L{str}
        @param name: See L{RRHeader.name}

        @type type: L{int}
        @param type: The query type.

        @type cls: L{int}
        @param cls: The query class.

        @type ttl: L{int}
        @param ttl: Time to live for this record.  This will be
            converted to an L{int}.

        @type payload: L{IEncodableRecord} or L{None}
        @param payload: An optional Query Type specific data object.

        @raises TypeError: if the ttl cannot be converted to an L{int}.
        @raises ValueError: if the ttl is negative.
        @raises ValueError: if the payload type is not equal to the C{type}
                            argument.
        NzPayload type (z) does not match given type (r?rzTTL cannot be negative)r�r�rer:r�rkr�r�r,rSrTrs)	r�r�r�r,rSrTrs�payloadType�integralTTLs	         r�r�zRRHeader.__init__�s���>&�o�d�7�<�<���"�{�d�':�� �O�O�K��=��O�O�D�$�/���
��#�h����?��5�6�6���J��	���	������������	r�c	��|jj||�|jtj|j
|j|j|jd��|jr�|j�}|jj||�|j�}|j|dz
d�|jtjd||z
��|j|d�yy)Nrr�r)r�r�r�r�r�fmtr�r,rSrTrr)r�r�r��prefix�afts     r�r�zRRHeader.encodes����	�	�����)�
���F�K�K����$�)�)�T�X�X�t�x�x��K�L��<�<��Z�Z�\�F��L�L����x�0��*�*�,�C��J�J�v��z�1�%��K�K����D�#��,�7�8��J�J�s�A��
r�c��|jj|�tj|j�}t||�}tj|j|�}|\|_|_|_	|_
yr�)r�r�r�rqrxr�r�r�r,rSrY)r�r�r�r�r��rs      r�r�zRRHeader.decodes\���	�	������O�O�D�H�H�%���U�A�&���M�M�$�(�(�D�)��78�4��	�4�8�T�X�t�}r�c��|jSr��rsrs r��isAuthoritativezRRHeader.isAuthoritative%s���y�y�r�c�R�tj|jtj|jd|jz��}tj|j
d|j
z�}d|j|||j|jxrdxsdfzS)Nr7z-<RR name=%s type=%s class=%s ttl=%ds auth=%s>�True�False)	rer:r�rhrdr,r�rSrsr;s   r�r	zRRHeader.__str__(s����O�O��I�I�{���t�y�y�.�4�9�9�2L�M�
��
���d�h�h�����(A�B��>��I�I�
�
��H�H��I�I� �&�+�G�B
�
�	
r�)r�rAr�r�r,r�rSrrTzOptional[IEncodableRecord]rsrr�r)r�r�r�r�r[rxrY�cachedResponserr<r�r�r�rr	r@r�r�r�rmrm�s����.J��
�C��H��N�#&����.2��3��3��3��	3�
�3�,�
3��3�j	�9��
��Hr�rmc�J�eZdZUdZdZdZdZded<dZdd�Z	dd�Z
dd	�Zd
�Zy)
rna
    A Resource Record which consists of a single RFC 1035 domain-name.

    @type name: L{Name}
    @ivar name: The name associated with this record.

    @type ttl: L{int}
    @ivar ttl: The maximum number of seconds which this record should be
        cached.
    )�r�r��%srS)r�rSNz
Optional[int]r�c�D�t|�|_t|�|_y)z^
        @param name: See L{SimpleRecord.name}
        @type name: L{bytes} or L{str}
        N)rkr�r�rS)r�r�rSs   r�r�zSimpleRecord.__init__Ks��
��J��	��C�=��r�c�<�|jj||�yr�)r�r�r1s   r�r�zSimpleRecord.encodeSs���	�	�����)r�c�X�t�|_|jj|�yr�)rkr�r��r�r�r�s   r�r�zSimpleRecord.decodeVs���F��	��	�	����r�c�,�t|j�Sr�r%rs r�rzSimpleRecord.__hash__Zr&r��r�Nr�)
r�r�r�r�rgr[r��__annotations__r�r�r�r�rr�r�r�rnrn8s7��	�5�N�'���D�-���D�!�*� �r�rnc��eZdZdZeZdZy)rXz&
    An authoritative nameserver.
    r,N)r�r�r�r�r,r��
fancybasenamer�r�r�rXrX_s����D��Mr�rXc��eZdZdZeZdZy)rQzX
    A mail destination.

    This record type is obsolete.

    @see: L{Record_MX}
    r%N)r�r�r�r�r%r�r�r�r�r�rQrQh�����D��Mr�rQc��eZdZdZeZdZy)rRzV
    A mail forwarder.

    This record type is obsolete.

    @see: L{Record_MX}
    r&N)r�r�r�r�r&r�r�r�r�r�rRrRur�r�rRc��eZdZdZeZdZy)rMz*
    The canonical name for an alias.
    rN)r�r�r�r�rr�r�r�r�r�rMrM�s����D��Mr�rMc��eZdZdZeZdZy)rPzJ
    A mailbox domain name.

    This is an experimental record type.
    r$N)r�r�r�r�r$r�r�r�r�r�rPrP������D��Mr�rPc��eZdZdZeZdZy)rSzH
    A mail group member.

    This is an experimental record type.
    r'N)r�r�r�r�r'r�r�r�r�r�rSrS�r�r�rSc��eZdZdZeZdZy)rUzN
    A mail rename domain name.

    This is an experimental record type.
    r)N)r�r�r�r�r)r�r�r�r�r�rUrU�r�r�rUc��eZdZdZeZdZy)rZz 
    A domain name pointer.
    r/N)r�r�r�r�r/r�r�r�r�r�rZrZ�s����D��Mr�rZc��eZdZdZeZdZy)rNa[
    A non-terminal DNS name redirection.

    This record type provides the capability to map an entire subtree of the
    DNS name space to another domain.  It differs from the CNAME record which
    maps a single node of the name space.

    @see: U{http://www.faqs.org/rfcs/rfc2672.html}
    @see: U{http://www.faqs.org/rfcs/rfc3363.html}
    r N)r�r�r�r�r r�r�r�r�r�rNrN�s��	��D��Mr�rNc�L�eZdZdZdZeZdZd
d�Zdd�Z	dd�Z
d�Zdd�ZeZ
d	�Zy)
rIa 
    An IPv4 host address.

    @type address: L{bytes}
    @ivar address: The packed network-order representation of the IPv4 address
        associated with this record.

    @type ttl: L{int}
    @ivar ttl: The maximum number of seconds which this record should be
        cached.
    ��addressrSNc��t|t�r|jd�}tj|�}||_t
|�|_y)��
        @type address: L{bytes} or L{str}
        @param address: The IPv4 address associated with this record, in
            quad-dotted notation.
        r�N)r�r~r��socket�	inet_atonr�r�rS�r�r�rSs   r�r�zRecord_A.__init__�s>���g�u�%��n�n�W�-�G��"�"�7�+������C�=��r�c�:�|j|j�yr��r�r�r1s   r�r�zRecord_A.encode����
���D�L�L�!r�c�&�t|d�|_y)Nr��r�r�r�s   r�r�zRecord_A.decode�s��$�U�A�.��r�c�,�t|j�Sr��rr�rs r�rzRecord_A.__hash__�����D�L�L�!�!r�c�D�d|j��d|j�d�S)Nz<A address=z ttl=r9)�
dottedQuadrSrs r�r	zRecord_A.__str__�s#���T�_�_�.�/�u�T�X�X�J�a�@�@r�c�@�tj|j�Sr��r��	inet_ntoar�rs r�r�zRecord_A.dottedQuad�s��������-�-r�)�0.0.0.0Nr�r)r�r�r�r�r[rr�r�r�r�r�rr	r@r�r�r�r�rIrI�s?��
�+���D��G�!�"�/�"�A��H�.r�rIc�N�eZdZdZdZdZdZeZ								d
d�Z	dd�Z
dd�Zd	�Zy)r\aA
    Marks the start of a zone of authority.

    This record describes parameters which are shared by all records within a
    particular zone.

    @type mname: L{Name}
    @ivar mname: The domain-name of the name server that was the original or
        primary source of data for this zone.

    @type rname: L{Name}
    @ivar rname: A domain-name which specifies the mailbox of the person
        responsible for this zone.

    @type serial: L{int}
    @ivar serial: The unsigned 32 bit version number of the original copy of
        the zone.  Zone transfers preserve this value.  This value wraps and
        should be compared using sequence space arithmetic.

    @type refresh: L{int}
    @ivar refresh: A 32 bit time interval before the zone should be refreshed.

    @type minimum: L{int}
    @ivar minimum: The unsigned 32 bit minimum TTL field that should be
        exported with any RR from this zone.

    @type expire: L{int}
    @ivar expire: A 32 bit time value that specifies the upper limit on the
        time interval that can elapse before the zone is no longer
        authoritative.

    @type retry: L{int}
    @ivar retry: A 32 bit time interval that should elapse before a failed
        refresh should be retried.

    @type ttl: L{int}
    @ivar ttl: The default TTL to use for records served from this zone.
    r1)�serial�mname�rname�refresh�expire�retry�minimumrS))r�r�r�)r�r�r�r�r�r�r�r�rSNc	�
�t|�t|�c|_|_t|�t|�c|_|_t|�t|�c|_|_t|�|_t|�|_	y)z�
        @param mname: See L{Record_SOA.mname}
        @type mname: L{bytes} or L{str}

        @param rname: See L{Record_SOA.rname}
        @type rname: L{bytes} or L{str}
        N)
rkr�r�r�r�r�r�r�r�rS)	r�r�r�r�r�r�r�r�rSs	         r�r�zRecord_SOA.__init__8sf��$"&�e��d�5�k���
�D�J�$,�V�$4�h�w�6G�!���T�\�$,�W�$5�x��7G�!���d�k��e�_��
��C�=��r�c
�*�|jj||�|jj||�|jt	j
d|j|j|j|j|j��y)N�!LlllL)r�r�r�r�r�rr�r�r�r�r�r1s   r�r�zRecord_SOA.encodePsh���
�
���%��*��
�
���%��*�
����K�K���������
�
�������

�		
r�c�0�t�t�c|_|_|jj|�|jj|�t	j
dt
|d��}|\|_|_|_	|_
|_y)Nr��)rkr�r�r�r�r�r�r�r�r�r�r��r�r�r�r|s    r�r�zRecord_SOA.decode^sk��!%������
�D�J��
�
���%� ��
�
���%� ��M�M�(�M�%��$<�=��KL�H���T�\�4�:�t�{�D�Lr�c��t|j|j|j|j|j
|jf�Sr�)rr�r�r�r�r�r�rs r�rzRecord_SOA.__hash__es7���
�[�[�$�*�*�d�j�j�$�,�,����T�Z�Z�X�
�	
r�)r�r�rrrrrNr�)
r�r�r�r�r�r[rgr1r�r�r�r�rr�r�r�r\r\�sT��%�N�M�	��	�N��D���������!�0
�M�
r�r\c�F�eZdZdZdZdefdfZdZeZ	dd�Z
dd�Zdd	�Zd
�Z
y)
rYz�
    A null record.

    This is an experimental record type.

    @type ttl: L{int}
    @ivar ttl: The maximum number of seconds which this record should be
        cached.
    r-rTrS)rTrSNc�2�||_t|�|_yr�)rTr�rS)r�rTrSs   r�r�zRecord_NULL.__init__}s������C�=��r�c�:�|j|j�yr�)r�rTr1s   r�r�zRecord_NULL.encode�r�r�c�&�t||�|_yr�)r�rTr�s   r�r�zRecord_NULL.decode�s��$�U�F�3��r�c�,�t|j�Sr�)rrTrs r�rzRecord_NULL.__hash__�r�r�)NNr�)r�r�r�r�r�r�rgr[r-r�r�r�r�rr�r�r�rYrYks<����M� �*�-�u�5�N�*���D�!�"�4�"r�rYc�R�eZdZdZdZdZgd�ZeZe	d��Z
dd�Zdd�Zdd	�Z
d
�Zy)
rbaX
    A well known service description.

    This record type is obsolete.  See L{Record_SRV}.

    @type address: L{bytes}
    @ivar address: The packed network-order representation of the IPv4 address
        associated with this record.

    @type protocol: L{int}
    @ivar protocol: The 8 bit IP protocol number for which this service map is
        relevant.

    @type map: L{bytes}
    @ivar map: A bitvector indicating the services available at the specified
        address.

    @type ttl: L{int}
    @ivar ttl: The maximum number of seconds which this record should be
        cached.
    r7)r�r�maprS)��_addressr�r�rrSc�@�tj|j�Sr�r�rs r�r�zRecord_WKS._address�s��������-�-r�Nc��t|t�r|jd�}tj|�|_||c|_|_t|�|_	y)r�r�N)
r�r~r�r�r�r�rr�r�rS)r�r�rr�rSs     r�r�zRecord_WKS.__init__�sI���g�u�%��n�n�V�,�G��'�'��0���"*�C���
�t�x��C�=��r�c���|j|j�|jtjd|j��|j|j
�y�N�!B)r�r�r�rrr�r1s   r�r�zRecord_WKS.encode�s=��
���D�L�L�!�
���F�K�K��d�m�m�4�5�
���D�H�H�r�c��t|d�|_tjdt|d��d|_t||dz
�|_y)Nr�r�r�rr�)r�r�r�r�rr�r�s   r�r�zRecord_WKS.decode�s@��$�U�A�.����
�
�d�M�%��,C�D�Q�G��
� ����
�3��r�c�Z�t|j|j|jf�Sr�)rr�rr�rs r�rzRecord_WKS.__hash__�s ���T�\�\�4�=�=�$�(�(�;�<�<r�)r�rr�Nr�)r�r�r�r�r�r[rgr7r�rhr�r�r�r�rr�r�r�rbrb�sD���,�M�=��G�N��D�
�.��.�!��
4�
=r�rbc�N�eZdZdZeZdZdZdZe	d��Z
dd�Zdd�Zdd	�Z
d
�Zy)
rKaT
    An IPv6 host address.

    @type address: L{bytes}
    @ivar address: The packed network-order representation of the IPv6 address
        associated with this record.

    @type ttl: L{int}
    @ivar ttl: The maximum number of seconds which this record should be
        cached.

    @see: U{http://www.faqs.org/rfcs/rfc1886.html}
    r)r�rSr�c�J�tjt|j�Sr�)r��	inet_ntop�AF_INET6r�rs r�r�zRecord_AAAA._address�s������$�,�,�7�7r�Nc��t|t�r|jd�}tjt
|�|_t|�|_y)z
        @type address: L{bytes} or L{str}
        @param address: The IPv6 address for this host, in RFC 2373 format.
        r�N)	r�r~r�r��	inet_ptonr�r�r�rSr�s   r�r�zRecord_AAAA.__init__�s;��
�g�u�%��n�n�V�,�G��'�'��'�:����C�=��r�c�:�|j|j�yr�r�r1s   r�r�zRecord_AAAA.encode�r�r�c�&�t|d�|_y)Nr�r�r�s   r�r�zRecord_AAAA.decode�s��$�U�B�/��r�c�,�t|j�Sr�r�rs r�rzRecord_AAAA.__hash__�r�r�)�::Nr�)r�r�r�r�rr�r�rgr[rhr�r�r�r�rr�r�r�rKrK�sD����D��M�;�N�*��
�8��8�	!�"�0�"r�rKc�v�eZdZdZeZdZdZdZe	d��Z
				d
							dd�Zdd�Zdd	�Z
dd
�Zd�Zdd�Zy)rJa�
    An IPv6 address.

    This is an experimental record type.

    @type prefixLen: L{int}
    @ivar prefixLen: The length of the suffix.

    @type suffix: L{bytes}
    @ivar suffix: An IPv6 address suffix in network order.

    @type prefix: L{Name}
    @ivar prefix: If specified, a name which will be used as a prefix for other
        A6 records.

    @type bytes: L{int}
    @ivar bytes: The length of the prefix.

    @type ttl: L{int}
    @ivar ttl: The maximum number of seconds which this record should be
        cached.

    @see: U{http://www.faqs.org/rfcs/rfc2874.html}
    @see: U{http://www.faqs.org/rfcs/rfc3363.html}
    @see: U{http://www.faqs.org/rfcs/rfc3364.html}
    r))�_suffix�suffixr�)ryryr�rS)�	prefixLenryr�rSc�J�tjt|j�Sr�)r�r�r�r�rs r�r�zRecord_A6._suffixs������$�+�+�6�6r�Nc��t|t�r|jd�}||_t	j
t|�|_t|�|_	td|jz
dz�|_t|�|_y)z�
        @param suffix: An IPv6 address suffix in in RFC 2373 format.
        @type suffix: L{bytes} or L{str}

        @param prefix: An IPv6 address prefix for other A6 records.
        @type prefix: L{bytes} or L{str}
        r��� @N)
r�r~r�r�r�r�r�r�rkryr�r�rS)r�r�r�ryrSs     r�r�zRecord_A6.__init__sg���f�e�$��]�]�6�*�F�"����&�&�x��8����6�l����#����.�#�5�6��
��C�=��r�c��|jtjd|j��|jr)|j|j
|jd�|jr|jj|d�yyr�)r�r�rr�r~r�ryr�r1s   r�r�zRecord_A6.encode5sa��
���F�K�K��d�n�n�5�6��:�:��K�K����T�Z�Z�K�M�2�3��>�>��K�K���u�d�+�r�c�X�tjdt|d��d|_t	d|jz
dz�|_|j
r.dd|j
z
zt||j
�z|_|jr|jj|�yy)Nr�r�rr�r�rr�)	r�r�r�r�r�r~r�ryr�r�s   r�r�zRecord_A6.decode=s������t�]�5�!�-D�E�a�H����#����.�#�5�6��
��:�:�!�R�$�*�*�_�5�
�e�T�Z�Z�8X�X�D�K��>�>��K�K���u�%�r�c�:�t|t�r�|j|jk(xrk|j|jd|j|jdk(xr4|j
|j
k(xr|j|jk(StSr�)r�rJr�r�r~ryrSrrs  r�rzRecord_A6.__eq__Es����e�Y�'����%�/�/�1�*��K�K�����
�.�%�,�,��
�
�{�}�2M�M�*��K�K�5�<�<�/�*��H�H��	�	�)�	
��r�c�v�t|j|j|jd|jf�Sr�)rr�r�r~ryrs r�rzRecord_A6.__hash__Os-���T�^�^�T�[�[�$�*�*���%?����M�N�Nr�c��d|jtjt|j�|j
|jfzS)Nz<A6 %s %s (%d) ttl=%s>)ryr�r�r�r�r�rSrs r�r	zRecord_A6.__str__Rs=��'��K�K����X�t�{�{�3��N�N��H�H�	+
�
�	
r�)rr�r�N)r�r�r�r)ryr)rS�Union[str, bytes, int, None]r�rr)r�r�r�r�rr�r�rgr[rhr�r�r�r�rrr	r�r�r�rJrJ�s����6�D��M�U�N�@��
�7��7�
�"�!�,0�!��!��!��	!�
*�!�.,�&��O�
r�rJc�>�eZdZdZeZdZdZdZd
d�Z	dd�Z
dd�Zd	�Zy)r^a:
    The location of the server(s) for a specific protocol and domain.

    This is an experimental record type.

    @type priority: L{int}
    @ivar priority: The priority of this target host.  A client MUST attempt to
        contact the target host with the lowest-numbered priority it can reach;
        target hosts with the same priority SHOULD be tried in an order defined
        by the weight field.

    @type weight: L{int}
    @ivar weight: Specifies a relative weight for entries with the same
        priority. Larger weights SHOULD be given a proportionately higher
        probability of being selected.

    @type port: L{int}
    @ivar port: The port on this target host of this service.

    @type target: L{Name}
    @ivar target: The domain name of the target host.  There MUST be one or
        more address records for this name, the name MUST NOT be an alias (in
        the sense of RFC 1034 or RFC 2181).  Implementors are urged, but not
        required, to return the address record(s) in the Additional Data
        section.  Unless and until permitted by future standards action, name
        compression is not to be used for this field.

    @type ttl: L{int}
    @ivar ttl: The maximum number of seconds which this record should be
        cached.

    @see: U{http://www.faqs.org/rfcs/rfc2782.html}
    r3)�priority�weight�target�portrS)r�r�)r�r�r�r�rSNc��t|�|_t|�|_t|�|_t	|�|_t
|�|_y)zb
        @param target: See L{Record_SRV.target}
        @type target: L{bytes} or L{str}
        N)r�r�r�r�rkr�r�rS)r�r�r�r�r�rSs      r�r�zRecord_SRV.__init__�s;��
�H�
��
��&�k�����I��	��6�l����C�=��r�c���|jtjd|j|j|j
��|jj|d�y�N�!HHH)r�r�rr�r�r�r�r�r1s   r�r�zRecord_SRV.encode�s=��
���F�K�K���
�
�t�{�{�D�I�I�N�O������5�$�'r�c	���tjdt|tjd���}|\|_|_|_t�|_|jj|�yr�)
r�r�r�rqr�r�r�rkr�r�r�s    r�r�zRecord_SRV.decode�sO���M�M�&�-��v���v�7N�"O�P��01�-��
�t�{�D�I��f��������5�!r�c�p�t|j|j|j|jf�Sr�)rr�r�r�r�rs r�rzRecord_SRV.__hash__�s&���T�]�]�D�K�K����D�K�K�H�I�Ir�)rrrr�Nr�)
r�r�r�r�r3r�r�r[rgr�r�r�rr�r�r�r^r^[s4�� �D�D��M�G��V�N�	!�(�
"�Jr�r^c�L�eZdZdZeZdZdZdZ							d
d�Z	dd�Z
dd�Zd	�Zy)rWa
    The location of the server(s) for a specific protocol and domain.

    @type order: L{int}
    @ivar order: An integer specifying the order in which the NAPTR records
        MUST be processed to ensure the correct ordering of rules.  Low numbers
        are processed before high numbers.

    @type preference: L{int}
    @ivar preference: An integer that specifies the order in which NAPTR
        records with equal "order" values SHOULD be processed, low numbers
        being processed before high numbers.

    @type flag: L{Charstr}
    @ivar flag: A <character-string> containing flags to control aspects of the
        rewriting and interpretation of the fields in the record.  Flags
        are single characters from the set [A-Z0-9].  The case of the alphabetic
        characters is not significant.

        At this time only four flags, "S", "A", "U", and "P", are defined.

    @type service: L{Charstr}
    @ivar service: Specifies the service(s) available down this rewrite path.
        It may also specify the particular protocol that is used to talk with a
        service.  A protocol MUST be specified if the flags field states that
        the NAPTR is terminal.

    @type regexp: L{Charstr}
    @ivar regexp: A STRING containing a substitution expression that is applied
        to the original string held by the client in order to construct the
        next domain name to lookup.

    @type replacement: L{Name}
    @ivar replacement: The next NAME to query for NAPTR, SRV, or address
        records depending on the value of the flags field.  This MUST be a
        fully qualified domain-name.

    @type ttl: L{int}
    @ivar ttl: The maximum number of seconds which this record should be
        cached.

    @see: U{http://www.faqs.org/rfcs/rfc2915.html}
    )�order�
preference�flags�service�regexp�replacementr+)r�r�)r�r�r�)r�r�r�)r�r�r�)r�r�r�rSNc���t|�|_t|�|_t|�|_t|�|_t|�|_t|�|_t|�|_
y)zs
        @param replacement: See L{Record_NAPTR.replacement}
        @type replacement: L{bytes} or L{str}
        N)r�r�r�rir�r�r�rkr�r�rS)r�r�r�r�r�r�r�rSs        r�r�zRecord_NAPTR.__init__�sT����Z��
��j�/����U�^��
��w�'����f�o�����,����C�=��r�c�X�|jtjd|j|j��|j
j
|d�|jj
|d�|jj
|d�|jj
|d�yr/)
r�r�rr�r�r�r�r�r�r�r1s   r�r�zRecord_NAPTR.encode�su��
���F�K�K��t�z�z�4�?�?�C�D��
�
���%��&������E�4�(������5�$�'�������t�,r�c	���tjdt|tjd���}|\|_|_t
�|_t
�|_t
�|_	t�|_|jj|�|jj|�|jj|�|jj|�yr/)
r�r�r�rqr�r�rir�r�r�rkr�r�r�s    r�r�zRecord_NAPTR.decodes����M�M�%��u�f�o�o�e�6L�!M�N��&'�#��
�D�O��Y��
��y����i����6����
�
���%� ������E�"������5�!�������&r�c��t|j|j|j|j|j
|jf�Sr�)rr�r�r�r�r�r�rs r�rzRecord_NAPTR.__hash__
s@����
�
�����
�
�������� � �

�	
�		
r�)rrr�r�r�r�Nr�)
r�r�r�r�r+r�r[r�rgr�r�r�rr�r�r�rWrW�sP��*�X�D����M��N��������!�,-�
'�

r�rWc�>�eZdZdZeZdZdZdZd
d�Z	dd�Z
dd�Zd	�Zy)rLa�
    Map from a domain name to the name of an AFS cell database server.

    @type subtype: L{int}
    @ivar subtype: In the case of subtype 1, the host has an AFS version 3.0
        Volume Location Server for the named AFS cell.  In the case of subtype
        2, the host has an authenticated name server holding the cell-root
        directory node for the named DCE/NCA cell.

    @type hostname: L{Name}
    @ivar hostname: The domain name of a host that has a server for the cell
        named by this record.

    @type ttl: L{int}
    @ivar ttl: The maximum number of seconds which this record should be
        cached.

    @see: U{http://www.faqs.org/rfcs/rfc1183.html}
    r)�subtype�hostnamerS)r�)r�r�r�rSNc�d�t|�|_t|�|_t	|�|_y)zj
        @param hostname: See L{Record_AFSDB.hostname}
        @type hostname: L{bytes} or L{str}
        N)r�r�rkr�r�rS)r�r�r�rSs    r�r�zRecord_AFSDB.__init__6s%��
�7�|����X���
��C�=��r�c��|jtjd|j��|jj||�y�Nr)r�r�rr�r�r�r1s   r�r�zRecord_AFSDB.encode?s1��
���F�K�K��d�l�l�3�4��
�
���U�H�-r�c	��tjdt|tjd���}|\|_|j
j
|�yr)r�r�r�rqr�r�r�r�s    r�r�zRecord_AFSDB.decodeCs=���M�M�$�
�e�V�_�_�T�5J� K�L�������
�
���U�#r�c�D�t|j|jf�Sr�)rr�r�rs r�rzRecord_AFSDB.__hash__Hs���T�\�\�4�=�=�1�2�2r��rr�Nr�)
r�r�r�r�rr�r�r[rgr�r�r�rr�r�r�rLrLs2���(�D��M�6��G�N�!�.�$�
3r�rLc�>�eZdZdZeZdZdZdZd
d�Z	dd�Z
dd�Zd	�Zy)r[a�
    The responsible person for a domain.

    @type mbox: L{Name}
    @ivar mbox: A domain name that specifies the mailbox for the responsible
        person.

    @type txt: L{Name}
    @ivar txt: A domain name for which TXT RR's exist (indirection through
        which allows information sharing about the contents of this RP record).

    @type ttl: L{int}
    @ivar ttl: The maximum number of seconds which this record should be
        cached.

    @see: U{http://www.faqs.org/rfcs/rfc1183.html}
    r0)�mbox�txtrS))rrr�)rrr�rSNc�d�t|�|_t|�|_t|�|_y)z�
        @param mbox: See L{Record_RP.mbox}.
        @type mbox: L{bytes} or L{str}

        @param txt: See L{Record_RP.txt}
        @type txt: L{bytes} or L{str}
        N)rkrrr�rS)r�rrrSs    r�r�zRecord_RP.__init__fs%����J��	���9����C�=��r�c�t�|jj||�|jj||�yr�)rr�rr1s   r�r�zRecord_RP.encoders(���	�	�����)�������x�(r�c��t�|_t�|_|jj|�|jj|�yr�)rkrrr�r�s   r�r�zRecord_RP.decodevs6���F��	��6����	�	�����������r�c�D�t|j|jf�Sr�)rrrrs r�rzRecord_RP.__hash__|����T�Y�Y����)�*�*r��r�r�Nr�)
r�r�r�r�r0r�r�r[rgr�r�r�rr�r�r�r[r[Ls2���$�D��M�.��J�N�
!�)��+r�r[c�f�eZdZdZeZdZdefdefdfZdZ				d
					dd�Z
dd	�Zdd
�Zdd�Z
d�Zy)rOa
    Host information.

    @type cpu: L{bytes}
    @ivar cpu: Specifies the CPU type.

    @type os: L{bytes}
    @ivar os: Specifies the OS.

    @type ttl: L{int}
    @ivar ttl: The maximum number of seconds which this record should be
        cached.
    r!�cpu�osrS)rrrSNc�B�||c|_|_t|�|_yr�)rrr�rS)r�rrrSs    r�r�zRecord_HINFO.__init__�s�� �����$�'��C�=��r�c��|jtjdt|j��|jz�|jtjdt|j
��|j
z�yr�)r�r�rr�rrr1s   r�r�zRecord_HINFO.encode�sR��
���F�K�K��c�$�(�(�m�4�t�x�x�?�@�
���F�K�K��c�$�'�'�l�3�d�g�g�=�>r�c���tjdt|d��d}t||�|_tjdt|d��d}t||�|_y)Nr�r�r)r�r�r�rr)r�r�r�rrs     r�r�zRecord_HINFO.decode�sV���m�m�D�-��q�"9�:�1�=�� ���,���
�]�]�4��u�a�!8�
9�!�
<����r�*��r�c�<�t|t�r�|jj�|jj�k(xrP|jj�|jj�k(xr|j
|j
k(StSr�)r�rOrr�rrSrrs  r�rzRecord_HINFO.__eq__�sn���e�\�*����
�
��5�8�8�>�>�#3�3�*��H�H�N�N�$��	�	���(9�9�*��H�H��	�	�)�
�
�r�c�|�t|jj�|jj�f�Sr�)rrr�rrs r�rzRecord_HINFO.__hash__�s'���T�W�W�]�]�_�d�h�h�n�n�&6�7�8�8r�r)rr~rr~rSr�r�r)r�r�r�r�r!r�r�r�rgr[r�r�r�rrr�r�r�rOrO�so����D��M��j�)�D�*�+=�u�E�N�,����,0�	!�
�!�
�!�*�	!�?�+��9r�rOc�F�eZdZdZeZdZdZdZdZ	dZ
d
d�Zdd�Zdd�Z
d	�Zy)rTa�
    Mailbox or mail list information.

    This is an experimental record type.

    @type rmailbx: L{Name}
    @ivar rmailbx: A domain-name which specifies a mailbox which is responsible
        for the mailing list or mailbox.  If this domain name names the root,
        the owner of the MINFO RR is responsible for itself.

    @type emailbx: L{Name}
    @ivar emailbx: A domain-name which specifies a mailbox which is to receive
        error messages related to the mailing list or mailbox specified by the
        owner of the MINFO record.  If this domain name names the root, errors
        should be returned to the sender of the message.

    @type ttl: L{int}
    @ivar ttl: The maximum number of seconds which this record should be
        cached.
    Nr()�rmailbx�emailbxrS))r�responsibilityr�)r�errorsr�rSc�f�t|�t|�c|_|_t|�|_y)z�
        @param rmailbx: See L{Record_MINFO.rmailbx}.
        @type rmailbx: L{bytes} or L{str}

        @param emailbx: See L{Record_MINFO.rmailbx}.
        @type emailbx: L{bytes} or L{str}
        N)rkrrr�rS)r�rrrSs    r�r�zRecord_MINFO.__init__�s'��&*�'�]�D��M�"���d�l��C�=��r�c�t�|jj||�|jj||�yr�)rr�rr1s   r�r�zRecord_MINFO.encode�s*�������E�8�,������E�8�,r�c��t�t�c|_|_|jj|�|jj|�yr�)rkrrr�r�s   r�r�zRecord_MINFO.decode�s:��%)�V�T�V�"���d�l������E�"������E�"r�c�D�t|j|jf�Sr�)rrrrs r�rzRecord_MINFO.__hash__�s���T�\�\�4�<�<�0�1�1r�rr�)r�r�r�r�r(r�rrr�r[rgr�r�r�rr�r�r�rTrT�s>���*�D��G��G��M�5���N�	!�-�#�
2r�rTc�>�eZdZdZeZdZdZdZd
d�Z	dd�Z
dd�Zd	�Zy)rVa�
    Mail exchange.

    @type preference: L{int}
    @ivar preference: Specifies the preference given to this RR among others at
        the same owner.  Lower values are preferred.

    @type name: L{Name}
    @ivar name: A domain-name which specifies a host willing to act as a mail
        exchange.

    @type ttl: L{int}
    @ivar ttl: The maximum number of seconds which this record should be
        cached.
    r*)r�r�rS)r�r�rSNc��t|�|_t|jd|��|_t|�|_y)z\
        @param name: See L{Record_MX.name}.
        @type name: L{bytes} or L{str}
        �exchangeN)r�r�rkr:r�r�rS)r�r�r�rS�kwargss     r�r�zRecord_MX.__init__
s1��
�j�/�������J��5�6��	��C�=��r�c��|jtjd|j��|jj||�yr)r�r�rr�r�r�r1s   r�r�zRecord_MX.encodes1��
���F�K�K��d�o�o�6�7��	�	�����)r�c��tjdt|d��d|_t	�|_|j
j
|�y)Nrr�r)r�r�r�r�rkr�r�r�s   r�r�zRecord_MX.decodes;�� �-�-��m�E�1�.E�F�q�I����F��	��	�	����r�c�D�t|j|jf�Sr�)rr�r�rs r�rzRecord_MX.__hash__s���T�_�_�d�i�i�0�1�1r�rr�)
r�r�r�r�r*r�r�r[rgr�r�r�rr�r�r�rVrV�s2��� �D��M�5��B�N�!�*� �
2r�rVc�V�eZdZdZdZdZdZeZdZ	dZ
dZdZdZ
dZdd	�Zdd�Zdd�Zd
�Zy
)r_ab
    A record containing the fingerprint of an SSH key.

    @type algorithm: L{int}
    @ivar algorithm: The SSH key's algorithm, such as L{ALGORITHM_RSA}.
        Note that the numbering used for SSH key algorithms is specific
        to the SSHFP record, and is not the same as the numbering
        used for KEY or SIG records.

    @type fingerprintType: L{int}
    @ivar fingerprintType: The fingerprint type,
        such as L{FINGERPRINT_TYPE_SHA256}.

    @type fingerprint: L{bytes}
    @ivar fingerprint: The key's fingerprint, e.g. a 32-byte SHA-256 digest.

    @cvar ALGORITHM_RSA: The algorithm value for C{ssh-rsa} keys.
    @cvar ALGORITHM_DSS: The algorithm value for C{ssh-dss} keys.
    @cvar ALGORITHM_ECDSA: The algorithm value for C{ecdsa-sha2-*} keys.
    @cvar ALGORITHM_Ed25519: The algorithm value for C{ed25519} keys.

    @cvar FINGERPRINT_TYPE_SHA1: The type for SHA-1 fingerprints.
    @cvar FINGERPRINT_TYPE_SHA256: The type for SHA-256 fingerprints.

    @see: U{RFC 4255 <https://tools.ietf.org/html/rfc4255>}
          and
          U{RFC 6594 <https://tools.ietf.org/html/rfc6594>}
    r5��	algorithm�fingerprintType�fingerprintrS)r)r*r+r�r�r�r�c�<�||_||_||_||_yr�r()r�r)r*r+rSs     r�r�zRecord_SSHFP.__init__Ms ��"���.���&�����r�Nc��|jtjd|j|j��|j|j
�y)N�!BB)r�r�rr)r*r+r1s   r�r�zRecord_SSHFP.encodeSs7��
���F�K�K��t�~�~�t�7K�7K�L�M�
���D�$�$�%r�c��tjdt|d��}|\|_|_t||dz
�|_y)Nr.r�)r�r�r�r)r*r+r�s    r�r�zRecord_SSHFP.decodeWs;���M�M�%��u�a�!8�9��12�.����-�(����
�;��r�c�Z�t|j|j|jf�Sr�)rr)r*r+rs r�rzRecord_SSHFP.__hash__\s$���T�^�^�T�%9�%9�4�;K�;K�L�M�Mr�)rrr�rr�)r�r�r�r�r�r[rgr5r��
ALGORITHM_RSA�
ALGORITHM_DSS�ALGORITHM_ECDSA�ALGORITHM_Ed25519�FINGERPRINT_TYPE_SHA1�FINGERPRINT_TYPE_SHA256r�r�r�rr�r�r�r_r_ sT���:�M�N��D�N��D��M��M��O��������&�<�
Nr�r_c�D�eZdZdZeZdZdefdfZdZ	d�Z
dd�Zdd	�Zd
�Z
y)raz�
    Freeform text.

    @type data: L{list} of L{bytes}
    @ivar data: Freeform text which makes up this record.

    @type ttl: L{int}
    @ivar ttl: The maximum number of seconds which this record should be cached.
    r4rbrS�rbrSc�d�t|�|_t|jdd��|_y)NrS)r�rbr�r:rS)r�rb�kws   r�r�zRecord_TXT.__init__rs$����J��	��B�F�F�5�$�/�0��r�Nc	��|jD]3}|jtjdt	|��|z��5yr�)rbr�r�rr�)r�r�r��ds    r�r�zRecord_TXT.encodews5�����	7�A��K�K����D�#�a�&�1�A�5�6�	7r�c�"�d}g|_||krVtjdt|d��d}|jj	t||��||dzz
}||kr�V||k7r&tjd||j|fz�yy)Nrr�r�z1Decoded %d bytes in %s record, but rdlength is %d)rbr�r�r�r�r�msgr�)r�r�r��soFar�Ls     r�r�zRecord_TXT.decode{s�������	��f�n��
�
�d�M�%��$;�<�Q�?�A��I�I���]�5�!�4�5��Q��U�N�E��f�n��F�?��G�G�C��$�,�,�f�5�6�
�r�c�>�tt|j��Sr�)r�tuplerbrs r�rzRecord_TXT.__hash__�s���E�$�)�)�$�%�%r�r�)r�r�r�r�r4r�r�r�rgr[r�r�r�rr�r�r�rara`s<����D��M��~�.��6�N�'��1�
7��&r�rac�F�eZdZdZdZdZdZdefdfZdd�Z	dd�Z
dd	�Zd
�Zy)
rca>
    Encapsulate the wire data for unknown record types so that they can
    pass through the system unchanged.

    @type data: L{bytes}
    @ivar data: Wire data which makes up this record.

    @type ttl: L{int}
    @ivar ttl: The maximum number of seconds which this record should be cached.

    @since: 11.1
    N�UNKNOWNr8rbrSc�2�||_t|�|_yr�)rbr�rS)r�rbrSs   r�r�zUnknownRecord.__init__�s����	��C�=��r�c�:�|j|j�y)zc
        Write the raw bytes corresponding to this record's payload to the
        stream.
        N)r�rbr1s   r�r�zUnknownRecord.encode�s��
	���D�I�I�r�c�@�|�td��t||�|_y)z~
        Load the bytes which are part of this record from the stream and store
        them unparsed and unmodified.
        Nz)must know length for unknown record types)�	Exceptionr�rbr�s   r�r�zUnknownRecord.decode�s#��
�>��G�H�H�!�%��0��	r�c�D�t|j|jf�Sr�)rrbrSrs r�rzUnknownRecord.__hash__�r
r�r�r�)
r�r�r�r�r�r�r[r�rgr�r�r�rr�r�r�rcrc�s<����D��M�'���z�*�E�2�N�!��1�+r�rcc��eZdZdZeZdZy)r]ao
    Structurally, freeform text. Semantically, a policy definition, formatted
    as defined in U{rfc 4408<http://www.faqs.org/rfcs/rfc4408.html>}.

    @type data: L{list} of L{bytes}
    @ivar data: Freeform text which makes up this record.

    @type ttl: L{int}
    @ivar ttl: The maximum number of seconds
               which this record should be cached.
    r2N)r�r�r�r�r2r�r�r�r�r�r]r]�s��
��D��Mr�r]c�R�eZdZdZdZdZgd�ZeZddddde	ddfd	�Z
d
d
�Zd
d�Zd�Z
y)r`a�
    A transaction signature, encapsulated in a RR, as described
    in U{RFC 2845 <https://tools.ietf.org/html/rfc2845>}.

    @type algorithm: L{Name}
    @ivar algorithm: The name of the signature or MAC algorithm.

    @type timeSigned: L{int}
    @ivar timeSigned: Signing time, as seconds from the POSIX epoch.

    @type fudge: L{int}
    @ivar fudge: Allowable time skew, in seconds.

    @type MAC: L{bytes}
    @ivar MAC: The message digest or signature.

    @type originalID: L{int}
    @ivar originalID: A message ID.

    @type error: L{int}
    @ivar error: An error code (extended C{RCODE}) carried
          in exceptional cases.

    @type otherData: L{bytes}
    @ivar otherData: Other data carried in exceptional cases.

    r6)r)�
timeSigned�fudge�MAC�
originalID�error�	otherDatarS)r)rLrNrPrQNr�rr�c	��|�dn
t|�|_||_t|�|_||_||_||_||_||_	yr�)
rkr)rLr�rMrNrOrPrQrS)	r�r)rLrMrNrOrPrQrSs	         r�r�zRecord_TSIG.__init__�sK�� "+�!2���Y����$����e�_��
����$�����
�"�����r�c
�.�|jj||�|jtjd|j
�dd�|jtjd|jt|j���|j|j�|jtjd|j|jt|j���|j|j�y)Nz!Qr�r0r�)r)r�r�r�rrLrMr�rNrOrPrQr1s   r�r�zRecord_TSIG.encode	s��������e�X�.�
���F�K�K��d�o�o�6�q�r�:�;�
���F�K�K��t�z�z�3�t�x�x�=�A�B�
���D�H�H��
����K�K��������S����=P�Q�	
�	���D�N�N�#r�c�R�t�}|j|�||_tjddt|d�z�}|\|_|_}t||�|_tjdt|d��}|\|_	|_
}t||�|_y)Nz!QHHs�
r�r�)rkr�r)r�r�r�rLrMrNrOrPrQ)r�r�r�r)�fields�	macLength�otherLengths       r�r�zRecord_TSIG.decode	s����F�	������"������v�{�]�5�"�5M�'M�N��17�.�����Y� ��	�2������v�}�U�A�'>�?��39�0�����[�&�u�k�:��r�c�p�t|j|j|j|jf�Sr�)rr)rLrNrOrs r�rzRecord_TSIG.__hash__%	s&���T�^�^�T�_�_�d�h�h����P�Q�Qr�r�)r�r�r�r�r�r[rgr6r�rrr�r�r�rr�r�r�r`r`�sR���8�M�	��N�N��D��������
��2$�	;�Rr�r`c�X�|d|jdd�|��}|jdd|_|S)a�
    Generate a L{Message} like instance suitable for use as the response to
    C{message}.

    The C{queries}, C{id} attributes will be copied from C{message} and the
    C{answer} flag will be set to L{True}.

    @param responseConstructor: A response message constructor with an
         initializer signature matching L{dns.Message.__init__}.
    @type responseConstructor: C{callable}

    @param message: A request message.
    @type message: L{Message}

    @param kwargs: Keyword arguments which will be passed to the initialiser
        of the response message.
    @type kwargs: L{dict}

    @return: A L{Message} like response instance.
    @rtype: C{responseConstructor}
    T)�id�answerNr�)r[�queries)�responseConstructor�messager#�responses    r��_responseFromMessagera)	s2��,#�H�g�j�j��H��H�H����q�)�H���Or�c��g}tj|jj�}|D]I}|j|j
}t
|||�}||vs||k7s�3|jd|�d|����K|S)a�
    Inspect the function signature of C{obj}'s constructor,
    and get a list of which arguments should be displayed.
    This is a helper function for C{_compactRepr}.

    @param obj: The instance whose repr is being generated.
    @param alwaysShow: A L{list} of field names which should always be shown.
    @param fieldNames: A L{list} of field attribute names which should be shown
        if they have non-default values.
    @return: A L{list} of displayable arguments.
    r8�=)�inspect�	signature�	__class__r��
parameters�defaultr]r�)�obj�
alwaysShow�
fieldNames�displayableArgsrer��defaultValue�
fieldValues        r��_getDisplayableArgumentsroD	s����O��!�!�#�-�-�"8�"8�9�I��>�� �+�+�D�1�9�9���S�$��5�
��J��J�,�$>��"�"�Q�t�f�A�j�^�#<�=�	>��r�c���|�g}|�g}|�g}|�g}g}|D](}||vst||d�dk(s�|j|��*t|||�}d|jjg|z}|r/|jdjdj
|���|D])}t||g�}	|	s�|jd|�d|	����+|jd�d	j
|�S)
a�
    Return a L{str} representation of C{obj} which only shows fields with
    non-default values, flags which are True and sections which have been
    explicitly set.

    @param obj: The instance whose repr is being generated.
    @param alwaysShow: A L{list} of field names which should always be shown.
    @param flagNames: A L{list} of flag attribute names which should be shown if
        they are L{True}.
    @param fieldNames: A L{list} of field attribute names which should be shown
        if they have non-default values.
    @param sectionNames: A L{list} of section attribute names which should be
        shown if they have been assigned a value.

    @return: A L{str} representation of C{obj}.
    FT�<z	 flags={}�,r8rcr9�)r]r�rorfr�r�r�)
rirj�	flagNamesrk�sectionNames�setFlagsr�rl�out�sections
          r��_compactReprry\	s��.���
����	����
������H��"���:����d�E�!:�d�!B��O�O�D�!�"�/�s�J�
�K�O���
�
�&�&�
'�/�
9�C���
�
�;�%�%�c�h�h�x�&8�9�:��/���#�t�R�(����J�J��4�&��'��-�.�/�
�J�J�s�O�
�7�7�3�<�r�c�$�eZdZdZdZdZeje�ZdxZ	xZ
xZZdddddde
ddddfd�Zdd�Zeefd	�Zd
�Zdd�Zd�ZiZe�D]3Zej3d
�s�e�eee�ej4<�5[d�Zd�Zd�Zy)rjah
    L{Message} contains all the information represented by a single
    DNS request or response.

    @ivar id: See L{__init__}
    @ivar answer: See L{__init__}
    @ivar opCode: See L{__init__}
    @ivar recDes: See L{__init__}
    @ivar recAv: See L{__init__}
    @ivar auth: See L{__init__}
    @ivar rCode: See L{__init__}
    @ivar trunc: See L{__init__}
    @ivar maxSize: See L{__init__}
    @ivar authenticData: See L{__init__}
    @ivar checkingDisabled: See L{__init__}

    @ivar queries: The queries which are being asked of or answered by
        DNS server.
    @type queries: L{list} of L{Query}

    @ivar answers: Records containing the answers to C{queries} if
        this is a response message.
    @type answers: L{list} of L{RRHeader}

    @ivar authority: Records containing information about the
        authoritative DNS servers for the names in C{queries}.
    @type authority: L{list} of L{RRHeader}

    @ivar additional: Records containing IP addresses of host names
        in C{answers} and C{authority}.
    @type additional: L{list} of L{RRHeader}

    @ivar _flagNames: The names of attributes representing the flag header
        fields.
    @ivar _fieldNames: The names of attributes representing non-flag fixed
        header fields.
    @ivar _sectionNames: The names of attributes representing the record
        sections of this message.
    )r[r\�opCode�recDes�recAvrs�rCode�trunc�maxSize�
authenticData�checkingDisabledr]�answers�	authority�
additionalz!H2B4HNr�c���|	|_||_||_||_||_||_||_||_||_|
|_	||_
g|_g|_g|_
g|_y)a�

        @param id: A 16 bit identifier assigned by the program that
            generates any kind of query.  This identifier is copied to
            the corresponding reply and can be used by the requester
            to match up replies to outstanding queries.
        @type id: L{int}

        @param answer: A one bit field that specifies whether this
            message is a query (0), or a response (1).
        @type answer: L{int}

        @param opCode: A four bit field that specifies kind of query in
            this message.  This value is set by the originator of a query
            and copied into the response.
        @type opCode: L{int}

        @param recDes: Recursion Desired - this bit may be set in a
            query and is copied into the response.  If RD is set, it
            directs the name server to pursue the query recursively.
            Recursive query support is optional.
        @type recDes: L{int}

        @param recAv: Recursion Available - this bit is set or cleared
            in a response and denotes whether recursive query support
            is available in the name server.
        @type recAv: L{int}

        @param auth: Authoritative Answer - this bit is valid in
            responses and specifies that the responding name server
            is an authority for the domain name in question section.
        @type auth: L{int}

        @ivar rCode: A response code, used to indicate success or failure in a
            message which is a response from a server to a client request.
        @type rCode: C{0 <= int < 16}

        @param trunc: A flag indicating that this message was
            truncated due to length greater than that permitted on the
            transmission channel.
        @type trunc: L{int}

        @param maxSize: The requestor's UDP payload size is the number
            of octets of the largest UDP payload that can be
            reassembled and delivered in the requestor's network
            stack.
        @type maxSize: L{int}

        @param authenticData: A flag indicating in a response that all
            the data included in the answer and authority portion of
            the response has been authenticated by the server
            according to the policies of that server.
            See U{RFC2535 section-6.1<https://tools.ietf.org/html/rfc2535#section-6.1>}.
        @type authenticData: L{int}

        @param checkingDisabled: A flag indicating in a query that
            pending (non-authenticated) data is acceptable to the
            resolver sending the query.
            See U{RFC2535 section-6.1<https://tools.ietf.org/html/rfc2535#section-6.1>}.
        @type authenticData: L{int}
        N)r�r[r\r{rsrr|r}r~r�r�r]r�r�r�)r�r[r\r{r|r}rsr~rr�r�r�s            r�r�zMessage.__init__�	sp��T��������������	���
������
���
�*��� 0��������������r�c�"�t|dddd��S)z�
        Generate a repr of this L{Message}.

        Only includes the non-default fields and sections and only includes
        flags which are set. The C{id} is always shown.

        @return: The native string repr.
        )r\rsrr|r}r�r�)r[r{r~r��r]r�r�r��r[�rtrkrurj�ryrs r�r@zMessage.__repr__0
s$�����<�J��
�	
r�c�P�|jjt|||��y)z�
        Add another query to this Message.

        @type name: L{bytes}
        @param name: The name to query.

        @type type: L{int}
        @param type: Query type

        @type cls: L{int}
        @param cls: Query class
        N)r]r�rlr-s    r��addQueryzMessage.addQueryI
s��	
�����E�$��c�2�3r�c�~�i}t�}|jD]}|j||��|jD]}|j||��|jD]}|j||��|j
D]}|j||��|j
�}t|�|jz}|jr2||jkDr#d|_
|d|j|jz
}|jdzdz|jdzdzz|jdzdzz|jdzdzz|jdzz}|jdzdz|j dzdzz|j"dzdzz|j$dzz}|j't)j*|j,|j.||t|j�t|j�t|j�t|j
���|j'|�y)Nr��rRr�r�r�r�)rr]r�r�r�r�rUr�rr�rr\r{rsr|r}r�r�r~r�r�r�	headerFmtr[)	r�r�r��body_tmp�q�body�size�byte3�byte4s	         r�r�zMessage.encodeX
s�����9�����	)�A�
�H�H�X�x�(�	)����	)�A�
�H�H�X�x�(�	)����	)�A�
�H�H�X�x�(�	)����	)�A�
�H�H�X�x�(�	)�� � �"���4�y�4�?�?�*���<�<�D�4�<�<�/��D�J��8�$�,�,����8�9�D��k�k�A�o�!�
#����c�!�a�'�
)��	�	�A�
�!�#�
%��
�
�Q��1�$�
&��{�{�Q��	
 �	��j�j�1�n��
"��"�"�Q�&�1�,�
.��%�%��)�a�/�
1��z�z�C��
!�	�	����K�K����������D�L�L�!��D�L�L�!��D�N�N�#��D�O�O�$�	
�	
�	���D�r�c���d|_t||j�}tj|j
|�}|\|_}}}}}	}
|dz	dz|_|dz	dz|_|dz	dz|_	|dz	dz|_
|dz|_|dz	dz|_|dz	dz|_
|dz	dz|_|dz|_g|_t#|�D]9}t%�}	|j'|�|j j+|��;|j,|f|j.|	f|j0|
ff}
|
D]\}}|j3|||��y#t($rYywxYw)	Nrr�r�r�rRr�r�r�)r�r�rr�r�r�r[r\r{rsrr|r}r�r�r~r]�rangerlr�r�r�r�r�r��parseRecords)r�r�r��headerr|r�r��nqueries�nans�nns�nadd�ir��itemsr�rEs                r�r�zMessage.decode�
ss������u�d�o�o�6���M�M�$�.�.�&�1��;<�8�����x��s�D���z�Q�&�����z�S�(����a�Z�1�$��	��q�j�A�%��
��a�i����q�j�A�%��
�#�q�j�A�-���!&�!��q� 0����S�[��
�����x��	#�A���A�
������
�L�L����"�
	#��,�,��%�����'<�t���PT�>U�V���	+�D�A�q����a��E�*�	+��
�
��
�s�E�	E�Ec��t|�D]�}t|j��}	|j|�|j|j�}|s�I||j��|_	|jj||j�|j|���y#t$rYywxYw#t$rYywxYw)Nr~)rS)r�rmrsr�r��lookupRecordTyper�rSrTrYr�)r�r��numr�r�r�r<s       r�r�zMessage.parseRecords�
s����s��	 �A��4�9�9�-�F�
��
�
�e�$��%�%�f�k�k�2�A����6�:�:�.�F�N�
����%�%�e�V�_�_�=�
�K�K���	 ���
��
���
��
�s#�B(�.&B8�(	B5�4B5�8	C�C�Record_c�B�|jj|t�S)aC
        Retrieve the L{IRecord} implementation for the given record type.

        @param type: A record type, such as C{A} or L{NS}.
        @type type: L{int}

        @return: An object which implements L{IRecord} or L{None} if none
            can be found for the given type.
        @rtype: C{Type[IRecord]}
        )�_recordTypesr:rc)r�r�s  r�r�zMessage.lookupRecordType�
s��� � �$�$�T�=�9�9r�c�X�t�}|j|�|j�S)z�
        Encode this L{Message} into a byte string in the format described by RFC
        1035.

        @rtype: L{bytes}
        )rr�rU)r�r�s  r��toStrz
Message.toStr�
s$���	�����E���~�~��r�c�<�t|�}|j|�y)z�
        Decode a byte string in the format described by RFC 1035 into this
        L{Message}.

        @param str: L{bytes}
        N)rr�)r�r�r�s   r��fromStrzMessage.fromStr�
s���������E�r�rr�)r�r�r�r�r[r�r�rqrr]r�r�nsrrr�r@r=r<r�r�r�r�r��globalsr��
startswithr�r�r�r�r�r�r�rjrj�	s���&�P��$�I� �����+�J�$(�'�G�'�g�'��b�
�����
������Y�v
�2#.�2�
4�*�X+�: �*�L��	�A���?�?�9�%�18��4��L���4��-�-�.�A�	
�:�	 �r�rjc�l�eZdZdZdZeZddeddddddddddddddfd�Zd
d�Z	d	�Z
d
�Zed��Z
d�Zy)�_EDNSMessagea�
    An I{EDNS} message.

    Designed for compatibility with L{Message} but with a narrower public
    interface.

    Most importantly, L{_EDNSMessage.fromStr} will interpret and remove I{OPT}
    records that are present in the additional records section.

    The I{OPT} records are used to populate certain I{EDNS} specific attributes.

    L{_EDNSMessage.toStr} will add suitable I{OPT} records to the additional
    section to represent the extended EDNS information.

    @see: U{https://tools.ietf.org/html/rfc6891}

    @ivar id: See L{__init__}
    @ivar answer: See L{__init__}
    @ivar opCode: See L{__init__}
    @ivar auth: See L{__init__}
    @ivar trunc: See L{__init__}
    @ivar recDes: See L{__init__}
    @ivar recAv: See L{__init__}
    @ivar rCode: See L{__init__}
    @ivar ednsVersion: See L{__init__}
    @ivar dnssecOK: See L{__init__}
    @ivar authenticData: See L{__init__}
    @ivar checkingDisabled: See L{__init__}
    @ivar maxSize: See L{__init__}

    @ivar queries: See L{__init__}
    @ivar answers: See L{__init__}
    @ivar authority: See L{__init__}
    @ivar additional: See L{__init__}

    @ivar _messageFactory: A constructor of L{Message} instances. Called by
        C{_toMessage} and C{_fromMessage}.
    �r[r\r{rsrr|r}r~�ednsVersionrJr�r�r�r]r�r�r�rFr�Nc��||_||_||_||_||_||_||_||_|	|_|
|_	||_
||_|
|_|�g}||_
|�g}||_|�g}||_|�g}||_y)a+
        Construct a new L{_EDNSMessage}

        @see: U{RFC1035 section-4.1.1<https://tools.ietf.org/html/rfc1035#section-4.1.1>}
        @see: U{RFC2535 section-6.1<https://tools.ietf.org/html/rfc2535#section-6.1>}
        @see: U{RFC3225 section-3<https://tools.ietf.org/html/rfc3225#section-3>}
        @see: U{RFC6891 section-6.1.3<https://tools.ietf.org/html/rfc6891#section-6.1.3>}

        @param id: A 16 bit identifier assigned by the program that generates
            any kind of query.  This identifier is copied the corresponding
            reply and can be used by the requester to match up replies to
            outstanding queries.
        @type id: L{int}

        @param answer: A one bit field that specifies whether this message is a
            query (0), or a response (1).
        @type answer: L{bool}

        @param opCode: A four bit field that specifies kind of query in this
            message.  This value is set by the originator of a query and copied
            into the response.
        @type opCode: L{int}

        @param auth: Authoritative Answer - this bit is valid in responses, and
            specifies that the responding name server is an authority for the
            domain name in question section.
        @type auth: L{bool}

        @param trunc: Truncation - specifies that this message was truncated due
            to length greater than that permitted on the transmission channel.
        @type trunc: L{bool}

        @param recDes: Recursion Desired - this bit may be set in a query and is
            copied into the response.  If set, it directs the name server to
            pursue the query recursively. Recursive query support is optional.
        @type recDes: L{bool}

        @param recAv: Recursion Available - this bit is set or cleared in a
            response, and denotes whether recursive query support is available
            in the name server.
        @type recAv: L{bool}

        @param rCode: Extended 12-bit RCODE. Derived from the 4 bits defined in
            U{RFC1035 4.1.1<https://tools.ietf.org/html/rfc1035#section-4.1.1>}
            and the upper 8bits defined in U{RFC6891
            6.1.3<https://tools.ietf.org/html/rfc6891#section-6.1.3>}.
        @type rCode: L{int}

        @param ednsVersion: Indicates the EDNS implementation level. Set to
            L{None} to prevent any EDNS attributes and options being added to
            the encoded byte string.
        @type ednsVersion: L{int} or L{None}

        @param dnssecOK: DNSSEC OK bit as defined by
            U{RFC3225 3<https://tools.ietf.org/html/rfc3225#section-3>}.
        @type dnssecOK: L{bool}

        @param authenticData: A flag indicating in a response that all the data
            included in the answer and authority portion of the response has
            been authenticated by the server according to the policies of that
            server.
            See U{RFC2535 section-6.1<https://tools.ietf.org/html/rfc2535#section-6.1>}.
        @type authenticData: L{bool}

        @param checkingDisabled: A flag indicating in a query that pending
            (non-authenticated) data is acceptable to the resolver sending the
            query.
            See U{RFC2535 section-6.1<https://tools.ietf.org/html/rfc2535#section-6.1>}.
        @type authenticData: L{bool}

        @param maxSize: The requestor's UDP payload size is the number of octets
            of the largest UDP payload that can be reassembled and delivered in
            the requestor's network stack.
        @type maxSize: L{int}

        @param queries: The L{list} of L{Query} associated with this message.
        @type queries: L{list} of L{Query}

        @param answers: The L{list} of answers associated with this message.
        @type answers: L{list} of L{RRHeader}

        @param authority: The L{list} of authority records associated with this
            message.
        @type authority: L{list} of L{RRHeader}

        @param additional: The L{list} of additional records associated with
            this message.
        @type additional: L{list} of L{RRHeader}
        Nr�)r�r[r\r{rsrr|r}r~r�rJr�r�r�r]r�r�r�s                  r�r�z_EDNSMessage.__init__ s���Z�����������	���
������
���
�&��� ��
�*��� 0�������?��G�����?��G�������I�"������J�$��r�c�"�t|dddd��S)N)r\rsrr|r}r�r�rJ)r[r{r~r�r�r�r�r�r�rs r�r@z_EDNSMessage.__repr__�s#����	�K�J��
�	
r�c�l�|j|j|j|j|j|j
|j|j|jdz|j|j��
}|jdd|_|jdd|_|jdd|_
|jdd|_|j�Ut!|j|j"|j$|jdz	��}|jj'|�|S)a=
        Convert to a standard L{dns.Message}.

        If C{ednsVersion} is not None, an L{_OPTHeader} instance containing all
        the I{EDNS} specific attributes and options will be appended to the list
        of C{additional} records.

        @return: A L{dns.Message}
        @rtype: L{dns.Message}
        rR)
r[r\r{rsrr|r}r~r�r�Nr�)rIrJrGrH)�_messageFactoryr[r\r{rsrr|r}r~r�r�r]r�r�r�r�rCrJr�r�)r��mrVs   r��
_toMessagez_EDNSMessage._toMessage�s���
� � ��w�w��;�;��;�;�����*�*��;�;��*�*��*�*�s�"��,�,�!�2�2�
!�
���L�L��O��	��L�L��O��	��n�n�Q�'������q�)������'���(�(����#�|�|�"�j�j�A�o��A�
�L�L����"��r�c�>�|j�j�S)z~
        Encode to wire format by first converting to a standard L{dns.Message}.

        @return: A L{bytes} string.
        )r�r�rs r�r�z_EDNSMessage.toStr�s����� �&�&�(�(r�c��g}g}|jD]K}|jtk(r%|jtj|���;|j|��M|did|j�d|j�d|j�d|j�d|j�d|j�d|j�d|j�d	|j�d
|j�dd�d
d�d|j dd�d|j"dd�d|j$dd�d|��}t'|�dk(rY|d}|j(|_|j,|_|j.|_|j2dz|jz|_
|S)a�
        Construct and return a new L{_EDNSMessage} whose attributes and records
        are derived from the attributes and records of C{message} (a L{Message}
        instance).

        If present, an C{OPT} record will be extracted from the C{additional}
        section and its attributes and options will be used to set the EDNS
        specific attributes C{extendedRCODE}, C{ednsVersion}, C{dnssecOK},
        C{ednsOptions}.

        The C{extendedRCODE} will be combined with C{message.rCode} and assigned
        to C{self.rCode}.

        @param message: The source L{Message}.
        @type message: L{Message}

        @return: A new L{_EDNSMessage}
        @rtype: L{_EDNSMessage}
        r[r\r{rsrr|r}r~r�r�r�NrJFr]r�r�r�r�rr�r�)r�r�r.r�rCrZr[r\r{rsrr|r}r~r�r�r]r�r�r�rIr�rJrGr�rH)r,r_r��
optRecordsr|�
newMessage�opts       r��_fromMessagez_EDNSMessage._fromMessage�s���*�
��
��#�#�	%�A��v�v��}��!�!�*�"9�"9�!�"<�=��!�!�!�$�		%��
��z�z�
��>�>�
��>�>�
����	
�
�-�-�
��>�>�

��-�-�
��-�-�
�"�/�/�
�%�5�5�
��
��
��O�O�A�&�
� �O�O�A�&�!
�"�'�'��*�#
�$"�%
�
�*�z�?�a���Q�-�C�%(�[�[�J�"�"%�,�,�J��!$�!3�!3�J��"�0�0�A�5��
�
�E�J���r�c	��|j�}|j|�|j|�}|jD]}t	||t||���y)z�
        Decode from wire format, saving flags, values and records to this
        L{_EDNSMessage} instance in place.

        @param bytes: The full byte string to be decoded.
        @type bytes: L{bytes}
        N)r�r�r�r[r\r])r�r~r��ednsMessager`s     r�r�z_EDNSMessage.fromStr,sX��
� � �"��	�	�	�%���'�'��*���.�.�	D�H��D�(�G�K��$B�C�	Dr�r)r�r�r�r�r[rjr�rur�r@r�r�rir�r�r�r�r�r�r��
s~��%�N��(�O�
���
��������������%I%�V
�$(�T)��:��:�x
Dr�r�c�8�eZdZdZdZdZdd�Zd�Zd�Zd�Z	d�Z
y)	rpz�
    DNS protocol mixin shared by UDP and TCP implementations.

    @ivar _reactor: A L{IReactorTime} and L{IReactorUDP} provider which will
        be used to issue DNS queries and manage request timeouts.
    Nc�f�||_tjdd�|_|�ddlm}||_y)Nii�r)�reactor)�
controller�random�	randranger[�twisted.internetr��_reactor)r�r�r�s   r�r�zDNSMixin.__init__Gs,��$����"�"�5�%�0����?�0���
r�c�:�	t�}||jvr|S�)z1
        Return a unique ID for queries.
        )r��liveMessages�r�r[s  r��pickIDzDNSMixin.pickIDNs&�����B���*�*�*��	�r�c�>�|jj||g|���S)zL
        Wrapper around reactor.callLater, mainly for test purpose.
        )r��	callLater)r��period�func�argss    r�r�zDNSMixin.callLaterWs"��'�t�}�}�&�&�v�t�;�d�;�;r�c��t|d��}||_	||�tj
�}|j
||j||�}||f|j|<|S#t$rtj�cYSwxYw)a�
        Send out a message with the given queries.

        @type queries: L{list} of C{Query} instances
        @param queries: The queries to transmit

        @type timeout: L{int} or C{float}
        @param timeout: How long to wait before giving up

        @type id: L{int}
        @param id: Unique key for this request

        @type writeMessage: C{callable}
        @param writeMessage: One-parameter callback which writes the message

        @rtype: C{Deferred}
        @return: a C{Deferred} which will be fired with the result of the
            query, or errbacked with any errors that could happen (exceptions
            during writing of the query, timeout errors, ...).
        r�)r|)	rjr]�
BaseExceptionr�fail�Deferredr��_clearFailedr�)r�r]�timeoutr[�writeMessager��resultDeferred�
cancelCalls        r��_queryzDNSMixin._query]s���*
�B�q�!����	�	 ���O����)���^�^�G�T�->�->��PR�S�
�!/�� <����"������	 ��:�:�<��	 �s�A#�#B�Bc��	|j|=|jtjt|���y#t$rY�9wxYw)z5
        Clean the Deferred after a timeout.
        N)r��KeyError�errbackr�Failurerz)r��deferredr[s   r�r�zDNSMixin._clearFailed�sH��	��!�!�"�%�	������)=�b�)A�B�C���	��	�s�
=�	A	�A	r�)r�r�r�r�r[r�r�r�r�r�r�r�r�r�rprp<s.���
�B��L� ��<�!�FDr�rpc�@�eZdZdZdZd�Zd�Zd�Zd�Zd�Z	d�Z
d
d	�Zy)roz 
    DNS protocol over UDP.
    Nc�.�i|_i|_d|_y)z7
        Stop protocol: reset state variables.
        N)r��resends�	transportrs r��stopProtocolz DNSDatagramProtocol.stopProtocol�s����������r�c� �i|_i|_y)z3
        Upon start, reset internal state.
        N)r�r�rs r��
startProtocolz!DNSDatagramProtocol.startProtocol�s�������r�c�X�|jj|j�|�y)�X
        Send a message holding DNS queries.

        @type message: L{Message}
        N)r�r�r�)r�r_r�s   r�r�z DNSDatagramProtocol.writeMessage�s��	
�����W�]�]�_�g�6r�c�@�|jjd|d��y)Nrr�)�
maxPacketSize)r��	listenUDPrs r��startListeningz"DNSDatagramProtocol.startListening�s���
�
����4�s��;r�c���t�}	|j|�|j|jvrV|j|j\}}|j|j=|j�	|j|�y|j|jvr|j j#|||�yy#t$r&tjdt|�|fz�Yyt$r%}tjd|�d|���Yd}~yd}~wt$r+tjtj�d�YywxYw#t$rtj�YywxYw)zi
        Read a datagram, extract the message in it and trigger the associated
        Deferred.
        z#Truncated packet (%d bytes) from %sNzInvalid packet (z) from zUnexpected decoding error)rjr�r�rr>r�r�r��errrr�r[r��cancel�callbackr�r��messageReceived)r�rb�addrr��exr<�	cancellers       r��datagramReceivedz$DNSDatagramProtocol.datagramReceived�s3��

�I��	�
�I�I�d�O�
�4�4�4�$�$�$��,�,�Q�T�T�2�L�A�y��!�!�!�$�$�'�����
��
�
�1�
��t�t�4�<�<�'����/�/��4��>�(��1�	��G�G�9�S��Y��<M�M�N���	��G�G�&�r�d�'�$��8�9����	�

�G�G�G�O�O�%�'B�C��
	��!�
����	�
�s5�C�9E�,E�0E�8D�4E�E�E2�1E2c�>�	|j|=y#t$rYywxYw)zN
        Mark message ID as no longer having duplication suppression.
        N)r�r�r�s  r��removeResendz DNSDatagramProtocol.removeResend�s%��	����R� ���	��	�s�
�	�c�����js	�j�|��j�}nd�j|<��fd�}�j||||�S#t$rtj�cYSwxYw)a4
        Send out a message with the given queries.

        @type address: L{tuple} of L{str} and L{int}
        @param address: The address to which to send the query

        @type queries: L{list} of C{Query} instances
        @param queries: The queries to transmit

        @rtype: C{Deferred}
        r�c�*���j|��yr�)r�)r�r�r�s ��r�r�z/DNSDatagramProtocol.query.<locals>.writeMessage�s������a��)r�)r�r�rrr�r�r�r�)r�r�r]r�r[r�s``    r��queryzDNSDatagramProtocol.query�sv����~�~�
$��#�#�%��:�����B� �D�L�L���	*��{�{�7�G�R��>�>��%�
$��z�z�|�#�
$�s�A�A<�;A<)rUN)r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�roro�s2����G���7�<�!?�F�?r�roc�8�eZdZdZdZdZd�Zd�Zd�Zd�Z	d	d�Z
y)
rqz 
    DNS protocol over TCP.
    Nr�c��|j�}|jjtjdt|��|z�y)r�rN)r�r�r�r�rr�)r�r_r�s   r�r�zDNSProtocol.writeMessage�s5��
�M�M�O�������V�[�[��s�1�v�6��:�;r�c�H�i|_|jj|�y)zV
        Connection is made: reset internal state, and notify the controller.
        N)r�r��connectionMaders r�r�zDNSProtocol.connectionMade
s��������&�&�t�,r�c�:�|jj|�y)zZ
        Notify the controller that this protocol is no longer
        connected.
        N)r��connectionLost)r��reasons  r�rzDNSProtocol.connectionLost
s��
	
���&�&�t�,r�c�n�|xj|z
c_|j�rE|j�Wt|j�dk\r?tjd|jdd�d|_|jdd|_t|j�|jk\r�|jd|j}t�}|j
|�	|j|j\}}|j|j=|j�	|j|�|j|jd|_d|_ny|jr��Dyy#t$rtj�Y�VwxYw#t$r|jj!||�Y��wxYw)Nr�rr)�bufferr�r�r�r�rjr�r�r[r�r�r�rr�r�r�r�)r�rb�myChunkr�r<r�s      r��dataReceivedzDNSProtocol.dataReceived
sU�����t����k�k��{�{�"�s�4�;�;�'7�1�'<�$�m�m�D�$�+�+�b�q�/�B�1�E���"�k�k�!�"�o����4�;�;��4�;�;�.��+�+�m����4���I���	�	�'�"�"�#'�#4�#4�Q�T�T�#:�L�A�y��)�)�!�$�$�/��$�$�&�"��
�
�1�
�#�k�k�$�+�+�-�8���"����5�k�k��()�"����	�"�� �=��O�O�3�3�A�t�<�=�s$�F�!E)�)F	�F	�%F4�3F4c�^�|j�}|j||||j�S)z�
        Send out a message with the given queries.

        @type queries: L{list} of C{Query} instances
        @param queries: The queries to transmit

        @rtype: C{Deferred}
        )r�r�r�)r�r]r�r[s    r�r�zDNSProtocol.query4
s*���[�[�]���{�{�7�G�R��1B�1B�C�Cr�)r�)r�r�r�r�r�rr�r�rrr�r�r�r�rqrq�s-����F�
�F�<�-�-��>
Dr�rq)r�zstr | bytesr
r~)r�r�r
r�)r�zUnion[str, bytes, int]r
r�)r��Noner
r)r�r�r
zUnion[int, None])NNNN)rirrj�Sequence[str] | Nonertr	rkr	rur	r
r�)�r��
__future__rrdr�r�r��ior�	itertoolsr�typingrrrr	r
�zope.interfacerrr
r�rr�twisted.internet.errorr�twisted.pythonrrrr�tputil�twisted.python.compatrrr�__all__r�r�r�r�r�rxr�rr,r%r&rr1r$r'r)r-r7r/r!r(r*r4r0rrr3r+rr r.r5r2r�r6rer?r>r#r"r=rhr�rgr<r:r9r;r8rdrfrursrvrtrwrrr@rDrArBrCrErFrGrHr�twisted.names.errorryrzr{r�r�r�r�r�r�rrrirkrl�
FancyStrMixin�FancyEqMixinrCrcrmrnrXrQrRrMrPrSrUrZrNrIr\rYrbrKrJr^rWrLr[rOrTrVr_rarcr]r`raroryrjr�rp�DatagramProtocolro�Protocolrq)�k�vs00r��<module>rs-	��
�#��
�
�
���C�C�<�<�-�4�B�B�?�?�e��P�?�?����C�K�
��*
�!�R�L�'�����	��������	�	����	�	����
����
����
������
����s����������	�

�7����
����������	�&��������
�7��
�7����� ��!�"��#�$
�7��&���	�7���	�7���	�7����&��&�;��@).�c�3��%��d�E�5�+�	�&��&�	�7�	�7�����!&�k�&7�&7�&9�;�;L�;L�;N� O�P�f�q�!�Q��T�P�	��q�!����B��B�	���T�2�t�R��r�4��e�D�
�"/�"5�"5�"7�8���A�q�!�t�8��#(��(���*�i�
�	�
�	�27�q��.��G�W�e�W�h���"�2�r�]����(�E�i�E����(�BF�<B�,
��
��
��
��
�4�$��$�N�z�7��
�Z��.)�.)��.)�b
�Z��c'�c'��c'�L��Z��9I�9I���9I�x
�Z��w
��%�%�v�':�':�w
��w
�t
�Z��91��-�-�v�/B�/B�91��91�x
�Z��w�v�"�"�w��w�t
�
��"�6�'�'��)<�)<�"��"�L���
��
�
��
��<��������������
�<�
� 
�
��..�v�"�"�..��..�b
�
��p
��$�$�f�&:�&:�p
��p
�f
�
��"�&�&�&��(;�(;�"��"�>
�
��9=��$�$�f�&:�&:�9=��9=�x
�
��+"�&�%�%�v�';�';�+"��+"�\
�
��`
��$�$�f�&9�&9�`
��`
�F
�
��@J��$�$�f�&:�&:�@J��@J�F
�
��w
�6�&�&��(<�(<�w
��w
�t
�
��.3�6�'�'��)<�)<�.3��.3�b
�
��0+��#�#�V�%9�%9�0+��0+�f
�
��29�6�'�'��)<�)<�29��29�j
�
��82�6�&�&��(<�(<�82��82�v
�
��*2��$�$�f�&9�&9�*2��*2�Z
�
��<N�6�&�&��(<�(<�<N��<N�~
�
��(&��$�$�f�&:�&:�(&��(&�V
�
��)+�F�'�'��)=�)=�)+��)+�X���"
�
��[R�&�%�%�v�';�';�[R��[R�|�6�4(,�&*�'+�)-�5�	�5�$�5�$�5�%�	5�
'�5�	�
5�pK�f�!�!�K�\
WD�6�&�&�WD�t
LD�LD�^h?�(�H�$=�$=�h?�VHD�(�H�-�-�HD��g_
Q��9s�?
Z1�?
Z7

Zerion Mini Shell 1.0