
    g/                     @   S r SSKJrJrJrJr  SSKrSSKrSSK	rSSK
rSSKrSSKrSSKrSSKr " S S\R                  R                   5      r " S S\R$                  R&                  5      r\r\R,                  r\R.                  r\R0                  r\R2                  rg)zDNS Dynamic Update Support    )AnyListOptionalUnionNc                   8    \ rS rSrSrSrSrSrSr\	S 5       r
Srg	)
UpdateSection    zUpdate sectionsr            c                     g)Nr    )clss    C/home/matz/Project1/venv/lib/python3.13/site-packages/dns/update.py_maximumUpdateSection._maximum(   s        r   N)__name__
__module____qualname____firstlineno____doc__ZONEPREREQUPDATE
ADDITIONALclassmethodr   __static_attributes__r   r   r   r   r       s+    DFFJ r   r   c                   t  ^  \ rS rSr\rS\R                  R                  SS\R                  R                  S4S\\\R                  R                  \4      S\R                  R                   S\\   S\\R                  R                     S\\R                  R                  \4   S\\   4U 4S	 jjjr\S
\\R,                  R.                     4S j5       r\R2                  S 5       r\S
\\R,                  R.                     4S j5       r\R2                  S 5       r\S
\\R,                  R.                     4S j5       r\R2                  S 5       rSS jrS rS\\R                  R                  \4   S\S
S4S jrS\\R                  R                  \4   S\S
S4S jrS\\R                  R                  \4   S\S
S4S jr S\\R                  R                  \4   S\S
S4S jr! SS\\R                  R                  \4   S\\\RD                  RF                  \4      S
S4S jjr$S r%S r&Sr'U =r($ ) UpdateMessage-   Nzonerdclasskeyringkeynamekeyalgorithmidc           	      P  > [         TU ]  US9  U =R                  [        R                  R                  [        R                  R                  5      -  sl        [        U[        5      (       a  [        R                  R                  U5      nXl        [        R                  R                  R                  U5      nX l        U R                  (       a@  U R!                  U R"                  U R                  U[        R$                  R&                  SSS9  Ub  U R)                  X4US9  gg)a(  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-   UpdateMessage.__init__1   s    0 	B

cjj))#***;*;<<
dC  88%%d+D..++009#;;OO		!!!   MM'lMC r   returnc                      U R                   S   $ )zThe zone section.r   sectionsr?   s    r   r"   UpdateMessage.zone\        }}Qr   c                      XR                   S'   g )Nr   rD   r?   vs     r   r"   rG   a       ar   c                      U R                   S   $ )zThe prerequisite section.r
   rD   rF   s    r   prerequisiteUpdateMessage.prerequisitee   rH   r   c                      XR                   S'   g )Nr
   rD   rJ   s     r   rN   rO   j   rL   r   c                      U R                   S   $ )zThe update section.r   rD   rF   s    r   updateUpdateMessage.updaten   rH   r   c                      XR                   S'   g )Nr   rD   rJ   s     r   rR   rS   s   rL   r   c           
          Uc  U R                   nUR                  5       nU R                  XQU R                  UR                  XdSS5      nUR                  X25        g)z&Add a single RR to the update section.NT)rR   coversr;   r:   rdtypeadd)r?   r4   ttlrddeletingsectionrV   rrsets           r   _add_rrUpdateMessage._add_rrw   sQ     ?kkG4,,bii4QU
 			"r   c           	         [        U[        5      (       a   [        R                  R	                  US5      n[        US   [        R
                  R                  5      (       aO  U HH  nU(       a  U R                  X5R                  5        U H  nU R                  X5R                  XbS9  M     MJ     g[        U5      n[        UR                  S5      5      n[        US   [        R                  R                  5      (       a?  U(       a  U R                  X4S   R                  5        U H  nU R                  X7XbS9  M     g[        R                   R"                  R%                  UR                  S5      5      nU(       a  U R                  X85        U HH  n	[        R                  R	                  U R&                  XU R(                  5      nU R                  X7XbS9  MJ     g)ah  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   )r\   )r2   r3   r/   r4   r5   rdatasetRdatasetdeleterW   r^   rY   listintpoprdataRdatar<   	RdataTyper9   r:   r6   )
r?   replacer\   r4   argsrdsrZ   rY   rW   ss
             r   _addUpdateMessage._add   sS     dC  88%%dD1Dd1gs||4455KKjj1BLLwwLD   :Ddhhqk"C$q'399??33KK1gnn5BLLBL@  0055dhhqkBKK-A,,T->->4;;WBLLBL@ r   r4   rk   c                 B    U R                   " SU R                  U/UQ76   g)zAdd records.

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

        - rdataset...

        - ttl, rdata...

        - ttl, rdtype, string...
FNrn   rR   r?   r4   rk   s      r   rX   UpdateMessage.add   s     			%d2T2r   c           
      `   [        U[        5      (       a   [        R                  R	                  US5      n[        U5      S:X  a  U R                  U R                  U[        R                  R                  [        R                  R                  [        R                  R                  [        R                  R                  SS5        g[        US   [        R                  R                  5      (       a?  U H8  nU H/  nU R                  USU[        R                  R                  5        M1     M:     g[        U5      n[        US   [        R                   R"                  5      (       a6  U H/  nU R                  USU[        R                  R                  5        M1     g[        R                  R$                  R'                  UR)                  S5      5      n[        U5      S:X  a]  U R                  U R                  UU R*                  U[        R                  R                  [        R                  R                  SS5        gU He  n[        R                   R	                  U R*                  UUU R,                  5      nU R                  USU[        R                  R                  5        Mg     g)zDelete records.

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

        - *empty*

        - rdataset...

        - rdata...

        - rdtype, [string...]
Nr   T)r2   r3   r/   r4   r5   lenr;   rR   r7   ANYr<   NONEra   rb   r^   rd   rg   rh   ri   r9   rf   r:   r6   )r?   r4   rk   rl   rZ   largsrW   rm   s           r   rc   UpdateMessage.delete   s    dC  88%%dD1Dt9>OO""!!""""	 Q!6!677BLLq"cnn.A.AB   JE%(CIIOO44BLLq"cnn.A.AB   0055eiilCu:?OO))****	 # YY00 --" KK	 T1b#..2E2EF #r   c                 B    U R                   " SU R                  U/UQ76   g)a"  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.
TNrq   rr   s      r   rj   UpdateMessage.replace   s      			$T1D1r   c           
      >   [        U[        5      (       a   [        R                  R	                  US5      n[        U5      S:X  ak  U R                  U R                  U[        R                  R                  [        R                  R                  [        R                  R                  SSS5        g[        US   [        R                  R                  5      (       d;  [        US   [        R                  R                  5      (       d  [        U5      S:  a  [        US   [        R                  R                  5      (       d=  [!        U5      nUR#                  SS5        U R$                  " SU R                  U/UQ76   gU R$                  " SU R                  U/UQ76   g[        R                  R&                  R)                  US   5      nU R                  U R                  U[        R                  R                  U[        R                  R                  SSS5        g)a  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)r2   r3   r/   r4   r5   ru   r;   rN   r7   rv   r<   rw   ra   rb   rg   rh   rd   insertrn   ri   r9   )r?   r4   rk   rx   rW   s        r   presentUpdateMessage.present  s    dC  88%%dD1Dt9>OO!!""!!""	 tAw 5 566$q'399??334y1}d1gs||'<'<==T
Q"		%!2!2DA5A		%!2!2D@4@]],,11$q':FOO!!""""	r   rW   c           
      @   [        U[        5      (       a   [        R                  R	                  US5      nUck  U R                  U R                  U[        R                  R                  [        R                  R                  [        R                  R                  SSS5        g[        R                  R                  R                  U5      nU R                  U R                  U[        R                  R                  U[        R                  R                  SSS5        g)zzRequire that an owner name (and optionally an rdata type) does
not exist as a prerequisite to the execution of the update.NT)r2   r3   r/   r4   r5   r;   rN   r7   rw   r<   rv   ri   r9   )r?   r4   rW   s      r   absentUpdateMessage.absent<  s     dC  88%%dD1D>OO!!##!!""	 ]],,11&9FOO!!##""	r   c                     g)NTr   )r?   values     r   _get_one_rr_per_rrset#UpdateMessage._get_one_rr_per_rrset^  s    r   c                    S nSnU[         R                  :X  an  [        R                  R	                  U5      (       d/  U[        R
                  R                  :w  d  U R                  (       a  [        R                  R                  eOU R                  (       d  [        R                  R                  eU[        R                  R                  [        R                  R                  4;   aR  UnU R                  S   R                  nU[        R                  R                  :H  =(       d    U[         R                  :H  nX4XV4$ )NFr   )r   r   r/   r7   is_metaclassr<   r=   r"   	exception	FormErrorrv   rw   r#   r   )r?   r\   r4   r#   rW   r[   emptys          r   _parse_rr_headerUpdateMessage._parse_rr_headerb  s    m(((++G44S]]...99mm---  99mm---3>>--s~~/B/BCC"))A,.. 2 22UgAUAU6U  11r   )r6   r:   )NN)N))r   r   r   r   r   _section_enumr/   r7   INtsigdefault_algorithmr   r   r4   Namer3   r8   r   re   r-   propertyr   r]   RRsetr"   setterrN   rR   r^   rn   rX   rc   rj   r~   r<   ri   r   r   r   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 )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2 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   