§
    HºiS1  ã                   óZ  — d Z ddlZddlZddlmZmZ ddlZddlZddl	Zddl
ZddlZddlZej        j        hZej        j        ej        j        ej        j        hZd„ Zej         G d„ dej        ¦  «        ¦   «         Z G d„ d¦  «        Zej        j         G d	„ d
e¦  «        ¦   «         ZdS )z)DNS nodes.  A node is a set of rdatasets.é    N)ÚAnyÚDictc                 ó<   — || v p|t           j        j        k    o|| v S ©N)ÚdnsÚ	rdatatypeÚRRSIG)ÚrdtypesÚrdtypeÚcoverss      úM/home/mmwave/public_html/mmwave/venv/lib/python3.11/site-packages/dns/node.pyÚ_matches_type_or_its_signaturer   +   s&   € Ø�WÐÐU ­3¬=Ô+>Ò!>Ð!TÀ6ÈWÐCTÐUó    c                   óž   — e Zd ZdZdZdZdZedej	        j
        dej	        j
        dd fd„¦   «         Zed	ej        j        dd fd
„¦   «         ZdS )ÚNodeKindzRdatasets in nodesr   é   é   r   r   Úreturnc                 ó¢   — t          t          ||¦  «        rt          j        S t          t          ||¦  «        rt          j        S t          j        S r   )r   Ú_cname_typesr   ÚCNAMEÚ_neutral_typesÚNEUTRALÚREGULAR)Úclsr   r   s      r   ÚclassifyzNodeKind.classify7   sF   € õ *­,¸ÀÑGÔGð 	$Ý”>Ð!Ý+­N¸FÀFÑKÔKð 	$ÝÔ#Ð#åÔ#Ð#r   Úrdatasetc                 óB   — |                       |j        |j        ¦  «        S r   )r   r   r   )r   r   s     r   Úclassify_rdatasetzNodeKind.classify_rdatasetB   s   € à�|Š|˜HœO¨X¬_Ñ=Ô=Ð=r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   Úclassmethodr   r   Ú	RdataTyper   r   ÚRdatasetr   © r   r   r   r   /   sœ   € € € € € àÐà€GØ€GØ€Eàð$Ø”]Ô,ð$Ø69´mÔ6Mð$à	ð$ð $ð $ñ „[ð$ð ð>¨¬Ô)>ð >À:ð >ð >ð >ñ „[ð>ð >ð >r   r   c                   ó4  — e Zd ZdZdgZd„ Zdej        j        de	e
ef         de
fd„Zd„ Zd	„ Zd
„ Zd„ Zd„ Zd„ Zej        j        dfdej        j        dej        j        dej        j        dedej        j        f
d„Zej        j        dfdej        j        dej        j        dej        j        dedej        j        dz  f
d„Zej        j        fdej        j        dej        j        dej        j        ddfd„Zdej        j        ddfd„Zdefd„Z defd„Z!dS )ÚNodeaÖ  A Node is a set of rdatasets.

    A node is either a CNAME node or an "other data" node.  A CNAME
    node contains only CNAME, KEY, NSEC, and NSEC3 rdatasets along with their
    covering RRSIG rdatasets.  An "other data" node contains any
    rdataset other than a CNAME or RRSIG(CNAME) rdataset.  When
    changes are made to a node, the CNAME or "other data" state is
    always consistent with the update, i.e. the most recent change
    wins.  For example, if you have a node which contains a CNAME
    rdataset, and then add an MX rdataset to it, then the CNAME
    rdataset will be deleted.  Likewise if you have a node containing
    an MX rdataset and add a CNAME rdataset, the MX rdataset will be
    deleted.
    Ú	rdatasetsc                 ó   — g | _         d S r   ©r*   ©Úselfs    r   Ú__init__zNode.__init__Y   s   € àˆŒˆˆr   ÚnameÚkwr   c                 ó  — t          j        ¦   «         }| j        D ]K}t          |¦  «        dk    r6|                      |j        |fi |¤Ž¦  «         |                     d¦  «         ŒL|                     ¦   «         dd…         S )a"  Convert a node to text format.

        Each rdataset at the node is printed.  Any keyword arguments
        to this method are passed on to the rdataset's to_text() method.

        *name*, a ``dns.name.Name``, the owner name of the
        rdatasets.

        Returns a ``str``.

        r   ú
Néÿÿÿÿ)ÚioÚStringIOr*   ÚlenÚwriteÚto_textÚgetvalue)r.   r0   r1   ÚsÚrdss        r   r9   zNode.to_text]   s|   € õ ŒK‰MŒMˆØ”>ð 	ð 	ˆCÝ�3‰xŒx˜!Š|ˆ|Ø—’˜˜œ DÐ/Ð/¨BÐ/Ð/Ñ0Ô0Ð0Ø—’˜‘”�øØ�zŠz‰|Œ|˜C˜R˜CÔ Ð r   c                 óF   — dt          t          | ¦  «        ¦  «        z   dz   S )Nz
<DNS node ú>)ÚstrÚidr-   s    r   Ú__repr__zNode.__repr__q   s   € Ø�c¥" T¡(¤(™mœmÑ+¨cÑ1Ð1r   c                 ó^   — | j         D ]}||j         vr dS Œ|j         D ]}|| j         vr dS ŒdS )NFTr,   )r.   ÚotherÚrds      r   Ú__eq__zNode.__eq__t   s]   € ð ”.ð 	ð 	ˆBØ˜œÐ(Ð(Ø�u�uð )à”/ð 	ð 	ˆBØ˜œÐ'Ð'Ø�u�uð (àˆtr   c                 ó.   — |                       |¦  «         S r   )rE   )r.   rC   s     r   Ú__ne__zNode.__ne__€   s   € Ø—;’;˜uÑ%Ô%Ð%Ð%r   c                 ó*   — t          | j        ¦  «        S r   )r7   r*   r-   s    r   Ú__len__zNode.__len__ƒ   s   € Ý�4”>Ñ"Ô"Ð"r   c                 ó*   — t          | j        ¦  «        S r   )Úiterr*   r-   s    r   Ú__iter__zNode.__iter__†   s   € Ý�D”NÑ#Ô#Ð#r   c                 ó8  — t          | j        ¦  «        dk    rgt                               |¦  «        }|t          j        k    rd„ | j        D ¦   «         | _        n&|t          j        k    rd„ | j        D ¦   «         | _        | j                             |¦  «         dS )a†  Append rdataset to the node with special handling for CNAME and
        other data conditions.

        Specifically, if the rdataset being appended has ``NodeKind.CNAME``,
        then all rdatasets other than KEY, NSEC, NSEC3, and their covering
        RRSIGs are deleted.  If the rdataset being appended has
        ``NodeKind.REGULAR`` then CNAME and RRSIG(CNAME) are deleted.
        r   c                 ób   — g | ],}t                                |¦  «        t           j        k    ¯*|‘Œ-S r'   )r   r   r   ©Ú.0r<   s     r   ú
<listcomp>z)Node._append_rdataset.<locals>.<listcomp>–   s>   € ð "ð "ð "àÝ×1Ò1°#Ñ6Ô6½(Ô:JÒJÐJð àJÐJÐJr   c                 ób   — g | ],}t                                |¦  «        t           j        k    ¯*|‘Œ-S r'   )r   r   r   rO   s     r   rQ   z)Node._append_rdataset.<locals>.<listcomp>œ   s=   € ð "ð "ð "àÝ×1Ò1°#Ñ6Ô6½(¼.ÒHÐHð àHÐHÐHr   N)r7   r*   r   r   r   r   Úappend©r.   r   Úkinds      r   Ú_append_rdatasetzNode._append_rdataset‰   s­   € õ ˆtŒ~ÑÔ Ò"Ð"Ý×-Ò-¨hÑ7Ô7ˆDØ•x”~Ò%Ð%ð"ð "à#œ~ð"ñ "ô "�”�ð
 �Ô)Ò)Ð)ð"ð "à#œ~ð"ñ "ô "�”ð 	Œ×Ò˜hÑ'Ô'Ð'Ð'Ð'r   FÚrdclassr   r   Úcreatec                 óÎ   — | j         D ]}|                     |||¦  «        r|c S Œ|st          ‚t          j                             |||¦  «        }|                      |¦  «         |S )a*  Find an rdataset matching the specified properties in the
        current node.

        *rdclass*, a ``dns.rdataclass.RdataClass``, the class of the rdataset.

        *rdtype*, a ``dns.rdatatype.RdataType``, the type of the rdataset.

        *covers*, a ``dns.rdatatype.RdataType``, the covered type.
        Usually this value is ``dns.rdatatype.NONE``, but if the
        rdtype is ``dns.rdatatype.SIG`` or ``dns.rdatatype.RRSIG``,
        then the covers value will be the rdata type the SIG/RRSIG
        covers.  The library treats the SIG and RRSIG types as if they
        were a family of types, e.g. RRSIG(A), RRSIG(NS), RRSIG(SOA).
        This makes RRSIGs much easier to work with than if RRSIGs
        covering different rdata types were aggregated into a single
        RRSIG rdataset.

        *create*, a ``bool``.  If True, create the rdataset if it is not found.

        Raises ``KeyError`` if an rdataset of the desired type and class does
        not exist and *create* is not ``True``.

        Returns a ``dns.rdataset.Rdataset``.
        )r*   ÚmatchÚKeyErrorr   r   r&   rV   ©r.   rW   r   r   rX   r<   s         r   Úfind_rdatasetzNode.find_rdataset¥   s{   € ð@ ”>ð 	ð 	ˆCØ�yŠy˜ &¨&Ñ1Ô1ð Ø�
�
�
ðàð 	ÝˆNÝŒl×#Ò# G¨V°VÑ<Ô<ˆØ×Ò˜cÑ"Ô"Ð"Øˆ
r   Nc                 ó^   — 	 |                       ||||¦  «        }n# t          $ r d}Y nw xY w|S )aç  Get an rdataset matching the specified properties in the
        current node.

        None is returned if an rdataset of the specified type and
        class does not exist and *create* is not ``True``.

        *rdclass*, an ``int``, the class of the rdataset.

        *rdtype*, an ``int``, the type of the rdataset.

        *covers*, an ``int``, the covered type.  Usually this value is
        dns.rdatatype.NONE, but if the rdtype is dns.rdatatype.SIG or
        dns.rdatatype.RRSIG, then the covers value will be the rdata
        type the SIG/RRSIG covers.  The library treats the SIG and RRSIG
        types as if they were a family of
        types, e.g. RRSIG(A), RRSIG(NS), RRSIG(SOA).  This makes RRSIGs much
        easier to work with than if RRSIGs covering different rdata
        types were aggregated into a single RRSIG rdataset.

        *create*, a ``bool``.  If True, create the rdataset if it is not found.

        Returns a ``dns.rdataset.Rdataset`` or ``None``.
        N)r]   r[   r\   s         r   Úget_rdatasetzNode.get_rdatasetÎ   sK   € ð>	Ø×$Ò$ W¨f°f¸fÑEÔEˆCˆCøÝð 	ð 	ð 	ØˆCˆCˆCð	øøøàˆ
s   ‚ ›*©*c                 óp   — |                       |||¦  «        }|�| j                             |¦  «         dS dS )aD  Delete the rdataset matching the specified properties in the
        current node.

        If a matching rdataset does not exist, it is not an error.

        *rdclass*, an ``int``, the class of the rdataset.

        *rdtype*, an ``int``, the type of the rdataset.

        *covers*, an ``int``, the covered type.
        N)r_   r*   Úremove)r.   rW   r   r   r<   s        r   Údelete_rdatasetzNode.delete_rdatasetó   sC   € ð$ ×Ò ¨°Ñ8Ô8ˆØˆ?ØŒN×!Ò! #Ñ&Ô&Ð&Ð&Ð&ð ˆ?r   Úreplacementc                 ó>  — t          |t          j        j        ¦  «        st	          d¦  «        ‚t          |t          j        j        ¦  «        r|                     ¦   «         }|                      |j	        |j
        |j        ¦  «         |                      |¦  «         dS )aÅ  Replace an rdataset.

        It is not an error if there is no rdataset matching *replacement*.

        Ownership of the *replacement* object is transferred to the node;
        in other words, this method does not store a copy of *replacement*
        at the node, it stores *replacement* itself.

        *replacement*, a ``dns.rdataset.Rdataset``.

        Raises ``ValueError`` if *replacement* is not a
        ``dns.rdataset.Rdataset``.
        zreplacement is not an rdatasetN)Ú
isinstancer   r   r&   Ú
ValueErrorÚrrsetÚRRsetÚto_rdatasetrb   rW   r   r   rV   ©r.   rc   s     r   Úreplace_rdatasetzNode.replace_rdataset	  s—   € õ ˜+¥s¤|Ô'<Ñ=Ô=ð 	?ÝÐ=Ñ>Ô>Ð>Ý�k¥3¤9¤?Ñ3Ô3ð 	4ð &×1Ò1Ñ3Ô3ˆKØ×ÒØÔ Ô!3°[Ô5Gñ	
ô 	
ð 	
ð 	×Ò˜kÑ*Ô*Ð*Ð*Ð*r   c                 ó    — | j         D ];}t                               |j        |j        ¦  «        }|t          j        k    r|c S Œ<t          j        S )aT  Classify a node.

        A node which contains a CNAME or RRSIG(CNAME) is a
        ``NodeKind.CNAME`` node.

        A node which contains only "neutral" types, i.e. types allowed to
        co-exist with a CNAME, is a ``NodeKind.NEUTRAL`` node.  The neutral
        types are NSEC, NSEC3, KEY, and their associated RRSIGS.  An empty node
        is also considered neutral.

        A node which contains some rdataset which is not a CNAME, RRSIG(CNAME),
        or a neutral type is a a ``NodeKind.REGULAR`` node.  Regular nodes are
        also commonly referred to as "other data".
        )r*   r   r   r   r   r   rT   s      r   r   zNode.classify#  sS   € ð œð 	ð 	ˆHÝ×$Ò$ X¤_°h´oÑFÔFˆDØ•xÔ'Ò'Ð'Ø���ð (åÔÐr   c                 ó   — dS )NFr'   r-   s    r   Úis_immutablezNode.is_immutable8  s   € Øˆur   )"r    r!   r"   r#   Ú	__slots__r/   r   r0   ÚNamer   r?   r   r9   rA   rE   rG   rI   rL   rV   r   ÚNONEÚ
rdataclassÚ
RdataClassr%   Úboolr   r&   r]   r_   rb   rk   r   r   rn   r'   r   r   r)   r)   G   sV  € € € € € ðð ð �€Iðð ð ð!˜CœHœMð !°°c¸3°h´ð !ÀCð !ð !ð !ð !ð(2ð 2ð 2ð
ð 
ð 
ð&ð &ð &ð#ð #ð #ð$ð $ð $ð(ð (ð (ð@ +.¬-Ô*<Øð'ð 'à”Ô*ð'ð ”Ô'ð'ð ”Ô'ð	'ð
 ð'ð 
ŒÔ	ð'ð 'ð 'ð 'ðZ +.¬-Ô*<Øð#ð #à”Ô*ð#ð ”Ô'ð#ð ”Ô'ð	#ð
 ð#ð 
ŒÔ	 Ñ	%ð#ð #ð #ð #ðR +.¬-Ô*<ð	'ð 'à”Ô*ð'ð ”Ô'ð'ð ”Ô'ð	'ð
 
ð'ð 'ð 'ð 'ð,+¨C¬LÔ,Að +Àdð +ð +ð +ð +ð4 ˜(ð  ð  ð  ð  ð*˜dð ð ð ð ð ð r   r)   c                   óÔ  ‡ — e Zd Zˆ fd„Zej        j        dfdej        j        dej        j	        dej        j	        de
dej        j        f
ˆ fd„Zej        j        dfdej        j        dej        j	        dej        j	        de
dej        j        d	z  f
ˆ fd
„Zej        j        fdej        j        dej        j	        dej        j	        dd	fd„Zdej        j        dd	fd„Zde
fd„Zˆ xZS )ÚImmutableNodec                 óŽ   •— t          ¦   «                              ¦   «          t          d„ |j        D ¦   «         ¦  «        | _        d S )Nc                 óL   — g | ]!}t           j                             |¦  «        ‘Œ"S r'   )r   r   ÚImmutableRdatasetrO   s     r   rQ   z*ImmutableNode.__init__.<locals>.<listcomp>A  s(   € ÐKÐKÐK°S�SŒ\×+Ò+¨CÑ0Ô0ÐKÐKÐKr   )Úsuperr/   Útupler*   )r.   ÚnodeÚ	__class__s     €r   r/   zImmutableNode.__init__>  sA   ø€ Ý‰Œ×ÒÑÔÐÝØKÐK¸D¼NÐKÑKÔKñ
ô 
ˆŒˆˆr   FrW   r   r   rX   r   c                 ón   •— |rt          d¦  «        ‚t          ¦   «                              |||d¦  «        S ©NÚ	immutableF)Ú	TypeErrorrz   r]   ©r.   rW   r   r   rX   r}   s        €r   r]   zImmutableNode.find_rdatasetD  s9   ø€ ð ð 	)Ý˜KÑ(Ô(Ð(Ý‰wŒw×$Ò$ W¨f°f¸eÑDÔDÐDr   Nc                 ón   •— |rt          d¦  «        ‚t          ¦   «                              |||d¦  «        S r   )r�   rz   r_   r‚   s        €r   r_   zImmutableNode.get_rdatasetO  s9   ø€ ð ð 	)Ý˜KÑ(Ô(Ð(Ý‰wŒw×#Ò# G¨V°V¸UÑCÔCÐCr   c                 ó    — t          d¦  «        ‚©Nr€   ©r�   )r.   rW   r   r   s       r   rb   zImmutableNode.delete_rdatasetZ  s   € õ ˜Ñ$Ô$Ð$r   rc   c                 ó    — t          d¦  «        ‚r…   r†   rj   s     r   rk   zImmutableNode.replace_rdatasetb  s   € Ý˜Ñ$Ô$Ð$r   c                 ó   — dS )NTr'   r-   s    r   rn   zImmutableNode.is_immutablee  s   € Øˆtr   )r    r!   r"   r/   r   r   rq   rr   rs   r%   rt   r   r&   r]   r_   rb   rk   rn   Ú__classcell__)r}   s   @r   rv   rv   <  s×  ø€ € € € € ð
ð 
ð 
ð 
ð 
ð +.¬-Ô*<Øð	Eð 	Eà”Ô*ð	Eð ”Ô'ð	Eð ”Ô'ð		Eð
 ð	Eð 
ŒÔ	ð	Eð 	Eð 	Eð 	Eð 	Eð 	Eð +.¬-Ô*<Øð	Dð 	Dà”Ô*ð	Dð ”Ô'ð	Dð ”Ô'ð		Dð
 ð	Dð 
ŒÔ	 Ñ	%ð	Dð 	Dð 	Dð 	Dð 	Dð 	Dð +.¬-Ô*<ð	%ð %à”Ô*ð%ð ”Ô'ð%ð ”Ô'ð	%ð
 
ð%ð %ð %ð %ð%¨C¬LÔ,Að %Àdð %ð %ð %ð %ð˜dð ð ð ð ð ð ð ð r   rv   )r#   Úenumr5   Útypingr   r   Údns.immutabler   Údns.nameÚdns.rdataclassÚdns.rdatasetÚdns.rdatatypeÚ	dns.rrsetr   r   r   ÚNSECÚNSEC3ÚKEYr   r   ÚuniqueÚEnumr   r)   r€   rv   r'   r   r   ú<module>r—      sq  ðð$ 0Ð /à €€€Ø 	€	€	€	Ø Ð Ð Ð Ð Ð Ð Ð à Ð Ð Ð Ø €€€Ø Ð Ð Ð Ø Ð Ð Ð Ø Ð Ð Ð Ø Ð Ð Ð ð „MÔð€ð „MÔØ„MÔØ„MÔð€ðVð Vð Vð „ð>ð >ð >ð >ð >ˆtŒyñ >ô >ñ „ð>ð.rð rð rð rð rñ rô rð rðj „Ôð)ð )ð )ð )ð )�Dñ )ô )ñ Ôð)ð )ð )r   