
    ,h/                     @   d Z ddlmZmZ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ddlZddlZ G d dej                  j                         Z G d dej$                  j&                        ZeZej,                  Zej.                  Zej0                  Zej2                  Zy)zDNS Dynamic Update Support    )AnyListOptionalUnionNc                   0    e Zd ZdZdZdZdZdZed        Z	y)UpdateSectionzUpdate sectionsr            c                      y)Nr    )clss    L/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/dns/update.py_maximumzUpdateSection._maximum(   s        N)
__name__
__module____qualname____doc__ZONEPREREQUPDATE
ADDITIONALclassmethodr   r   r   r   r   r       s+    DFFJ r   r   c                   R    e Zd ZeZdej                  j                  ddej                  j                  dfde
eej                  j                  ef      dej                  j                  de
e   de
ej                  j                     deej                  j                  ef   de
e   f fdZed	eej*                  j,                     fd
       Zej0                  d        Zed	eej*                  j,                     fd       Zej0                  d        Zed	eej*                  j,                     fd       Zej0                  d        ZddZd Zdeej                  j                  ef   ded	dfdZdeej                  j                  ef   ded	dfdZdeej                  j                  ef   ded	dfdZdeej                  j                  ef   ded	dfdZ 	 ddeej                  j                  ef   de
eejB                  jD                  ef      d	dfdZ#d Z$d Z% xZ&S )UpdateMessageNzonerdclasskeyringkeynamekeyalgorithmidc                 R   t         |   |       | xj                  t        j                  j                  t        j                  j                        z  c_        t        |t              rt        j                  j                  |      }|| _        t        j                  j                  j                  |      }|| _        | j                  rC| j!                  | j"                  | j                  |t        j$                  j&                  dd       || j)                  |||       yy)ax  Initialize a new DNS Update object.

        See the documentation of the Message class for a complete
        description of the keyring dictionary.

        *zone*, a ``dns.name.Name``, ``str``, or ``None``, the zone
        which is being updated.  ``None`` should only be used by dnspython's
        message constructors, as a zone is required for the convenience
        methods like ``add()``, ``replace()``, etc.

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

        The *keyring*, *keyname*, and *keyalgorithm* parameters are passed to
        ``use_tsig()``; see its documentation for details.
        )r"   T)createforce_uniqueN)	algorithm)super__init__flagsdnsopcodeto_flagsr   
isinstancestrname	from_textorigin
rdataclass
RdataClassmakezone_rdclass
find_rrsetr   	rdatatypeSOAuse_tsig)selfr   r   r   r    r!   r"   	__class__s          r   r(   zUpdateMessage.__init__1   s    0 	B

cjj))#***;*;<<
dC 88%%d+D..++009#;;OO		!!!   MM'7lMC r   returnc                      | j                   d   S )zThe zone section.r   sectionsr:   s    r   r   zUpdateMessage.zone\        }}Qr   c                 "    || j                   d<   y )Nr   r>   r:   vs     r   r   zUpdateMessage.zonea       ar   c                      | j                   d   S )zThe prerequisite section.r	   r>   r@   s    r   prerequisitezUpdateMessage.prerequisitee   rA   r   c                 "    || j                   d<   y )Nr	   r>   rC   s     r   rG   zUpdateMessage.prerequisitej   rE   r   c                      | j                   d   S )zThe update section.r
   r>   r@   s    r   updatezUpdateMessage.updaten   rA   r   c                 "    || j                   d<   y )Nr
   r>   rC   s     r   rJ   zUpdateMessage.updates   rE   r   c           
          || j                   }|j                         }| j                  ||| j                  |j                  ||dd      }|j                  ||       y)z&Add a single RR to the update section.NT)rJ   coversr6   r5   rdtypeadd)r:   r/   ttlrddeletingsectionrM   rrsets           r   _add_rrzUpdateMessage._add_rrw   sW     ?kkGT4,,bii4QU
 			"cr   c                    t        |t              r t        j                  j	                  |d      }t        |d   t        j
                  j                        rL|D ]F  }|r| j                  ||j                         |D ]!  }| j                  ||j                  ||       # H yt        |      }t        |j                  d            }t        |d   t        j                  j                        r>|r| j                  ||d   j                         |D ]  }| j                  ||||        yt        j                   j"                  j%                  |j                  d            }|r| j                  ||       |D ]M  }	t        j                  j	                  | j&                  ||	| j(                        }| j                  ||||       O y)a  Add records.

        *replace* is the replacement mode.  If ``False``,
        RRs are added to an existing RRset; if ``True``, the RRset
        is replaced with the specified contents.  The second
        argument is the section to add to.  The third argument
        is always a name.  The other arguments can be:

                - rdataset...

                - ttl, rdata...

                - ttl, rdtype, string...
        Nr   )rS   )r-   r.   r*   r/   r0   rdatasetRdatasetdeleterN   rU   rP   listintpoprdataRdatar7   	RdataTyper4   r5   r1   )
r:   replacerS   r/   argsrdsrQ   rP   rN   ss
             r   _addzUpdateMessage._add   sz     dC 88%%dD1Dd1gs||445 EKKcjj1 EBLLswwGLDEE :Ddhhqk"C$q'399??3KKd1gnn5 ABLLsBL@A 0055dhhqkBKKf- AA,,T->->4;;WBLLsBL@Ar   r/   ra   c                 B     | j                   d| j                  |g|  y)zAdd records.

        The first argument is always a name.  The other
        arguments can be:

                - rdataset...

                - ttl, rdata...

                - ttl, rdtype, string...
        FNrd   rJ   r:   r/   ra   s      r   rO   zUpdateMessage.add   s     			%d2T2r   c           
      .   t        |t              r t        j                  j	                  |d      }t        |      dk(  r| j                  | j                  |t        j                  j                  t        j                  j                  t        j                  j                  t        j                  j                  dd       yt        |d   t        j                  j                        r;|D ]5  }|D ].  }| j                  |d|t        j                  j                         0 7 yt        |      }t        |d   t        j                   j"                        r4|D ].  }| j                  |d|t        j                  j                         0 yt        j                  j$                  j'                  |j)                  d            }t        |      dk(  r]| j                  | j                  || j*                  |t        j                  j                  t        j                  j                  dd       y|D ]d  }t        j                   j	                  | j*                  ||| j,                        }| j                  |d|t        j                  j                         f y)zDelete records.

        The first argument is always a name.  The other
        arguments can be:

                - *empty*

                - rdataset...

                - rdata...

                - rdtype, [string...]
        Nr   T)r-   r.   r*   r/   r0   lenr6   rJ   r2   ANYr7   NONErW   rX   rU   rZ   r]   r^   r_   r4   r\   r5   r1   )r:   r/   ra   rb   rQ   largsrN   rc   s           r   rY   zUpdateMessage.delete   s    dC 88%%dD1Dt9>OO""!!""""	 Q!6!67 C CBLLq"cnn.A.ABCC JE%(CIIOO4 CBLLq"cnn.A.ABC 0055eiilCu:?OO))****	 # G YY00 --" KK	 T1b#..2E2EFGr   c                 B     | j                   d| j                  |g|  y)ab  Replace records.

        The first argument is always a name.  The other
        arguments can be:

                - rdataset...

                - ttl, rdata...

                - ttl, rdtype, string...

        Note that if you want to replace the entire node, you should do
        a delete of the name followed by one or more calls to add.
        TNrf   rg   s      r   r`   zUpdateMessage.replace   s      			$T1D1r   c           
         t        |t              r t        j                  j	                  |d      }t        |      dk(  rk| j                  | j                  |t        j                  j                  t        j                  j                  t        j                  j                  ddd       yt        |d   t        j                  j                        s5t        |d   t        j                  j                        st        |      dkD  rt        |d   t        j                  j                        s=t!        |      }|j#                  dd        | j$                  d| j                  |g|  y | j$                  d| j                  |g|  yt        j                  j&                  j)                  |d         }| j                  | j                  |t        j                  j                  |t        j                  j                  ddd       y)aS  Require that an owner name (and optionally an rdata type,
        or specific rdataset) exists as a prerequisite to the
        execution of the update.

        The first argument is always a name.
        The other arguments can be:

                - rdataset...

                - rdata...

                - rdtype, string...
        Nr   Tr	   F)r-   r.   r*   r/   r0   ri   r6   rG   r2   rj   r7   rk   rW   rX   r]   r^   rZ   insertrd   r_   r4   )r:   r/   ra   rl   rN   s        r   presentzUpdateMessage.present  sw    dC 88%%dD1Dt9>OO!!""!!""	 tAw 5 56$q'399??34y1}d1gs||'<'<=T
Q"		%!2!2DA5A		%!2!2D@4@]],,11$q':FOO!!""""	r   rN   c           
      4   t        |t              r t        j                  j	                  |d      }|k| j                  | j                  |t        j                  j                  t        j                  j                  t        j                  j                  ddd       yt        j                  j                  j                  |      }| j                  | j                  |t        j                  j                  |t        j                  j                  ddd       y)zRequire that an owner name (and optionally an rdata type) does
        not exist as a prerequisite to the execution of the update.NT)r-   r.   r*   r/   r0   r6   rG   r2   rk   r7   rj   r_   r4   )r:   r/   rN   s      r   absentzUpdateMessage.absent<  s     dC 88%%dD1D>OO!!##!!""	 ]],,11&9FOO!!##""	r   c                      y)NTr   )r:   values     r   _get_one_rr_per_rrsetz#UpdateMessage._get_one_rr_per_rrset^  s    r   c                 R   d }d}|t         j                  k(  rbt        j                  j	                  |      s)|t        j
                  j                  k7  s| j                  rt        j                  j                  | j                  st        j                  j                  |t        j                  j                  t        j                  j                  fv rM|}| j                  d   j                  }|t        j                  j                  k(  xs |t         j                  k(  }||||fS )NFr   )r   r   r*   r2   is_metaclassr7   r8   r   	exception	FormErrorrj   rk   r   r   )r:   rS   r/   r   rN   rR   emptys          r   _parse_rr_headerzUpdateMessage._parse_rr_headerb  s    m(((++G4S]]...99mm---99mm---3>>--s~~/B/BCC"))A,.. 2 22UgAUAU6U  511r   )NN)N)'r   r   r   r   _section_enumr*   r2   INtsigdefault_algorithmr   r   r/   Namer.   r3   r   r[   r(   propertyr   rT   RRsetr   setterrG   rJ   rU   rd   rO   rY   r`   rp   r7   r_   rr   ru   r{   __classcell__)r;   s   @r   r   r   -   s   !M 59-0^^->->!%+/25((2L2L )DuSXX]]C/01)D **)D #	)D
 #((--()D CHHMM3./)D SM)DV  d399??+     
[[   d399??3        SYY__-     ]] 	&AP3chhmmS01 3# 3$ 3:G5!34 :GS :GT :Gx2E#((--"45 2c 2d 2$3E#((--"45 3c 3d 3p AE CHHMM3&'  s}}66;<=  
	 D2r   r   )r   typingr   r   r   r   dns.messager*   dns.name
dns.opcode	dns.rdatadns.rdataclassdns.rdatasetdns.rdatatypedns.tsigenumIntEnumr   messageMessager   Updater   r   r   r   r   r   r   <module>r      s   $ ! - -        
CHH$$ 
H2CKK'' H2X
 
 						%%
r   