
    h/                     P   S r SSK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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\R0                  r\R2                  r\R4                  rg)zDNS Dynamic Update Support    )AnyListNc                   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:\Users\ROHAN GUPTA\OneDrive\Desktop\mathbuddy-assessment\venv\Lib\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                  \-  S-  S\R                  R                  S\S-  S\R                  R                  S-  S\R                  R                  \-  S\S-  4U 4S	 jjjr\S
\\R(                  R*                     4S j5       r\R.                  S 5       r\S
\\R(                  R*                     4S j5       r\R.                  S 5       r\S
\\R(                  R*                     4S j5       r\R.                  S 5       rSS jrS rS\R                  R                  \-  S\S
S4S jrS\R                  R                  \-  S\S
S4S jrS\R                  R                  \-  S\S
S4S jrS\R                  R                  \-  S\S
S4S jr SS\R                  R                  \-  S\R@                  RB                  \-  S-  S
S4S jjr"S r#S r$Sr%U =r&$ ) UpdateMessage0   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__4   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   rB   r=   vs     r   r    rE   d       ar   c                      U R                   S   $ )zThe prerequisite section.r   rB   rD   s    r   prerequisiteUpdateMessage.prerequisiteh   rF   r   c                      XR                   S'   g )Nr   rB   rH   s     r   rL   rM   m   rJ   r   c                      U R                   S   $ )zThe update section.r	   rB   rD   s    r   updateUpdateMessage.updateq   rF   r   c                      XR                   S'   g )Nr	   rB   rH   s     r   rP   rQ   v   rJ   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)rP   coversr9   r8   rdtypeadd)r=   r2   ttlrddeletingsectionrT   rrsets           r   _add_rrUpdateMessage._add_rrz   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   )rZ   )r0   r1   r-   r2   r3   rdatasetRdatasetdeleterU   r\   rW   listintpoprdataRdatar:   	RdataTyper7   r8   r4   )
r=   replacerZ   r2   argsrdsrX   rW   rU   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   r2   ri   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rl   rP   r=   r2   ri   s      r   rV   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)r0   r1   r-   r2   r3   lenr9   rP   r5   ANYr:   NONEr_   r`   r\   rb   re   rf   rg   r7   rd   r8   r4   )r=   r2   ri   rj   rX   largsrU   rk   s           r   ra   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.
TNro   rp   s      r   rh   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)r0   r1   r-   r2   r3   rs   r9   rL   r5   rt   r:   ru   r_   r`   re   rf   rb   insertrl   rg   r7   )r=   r2   ri   rv   rU   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   rU   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)r0   r1   r-   r2   r3   r9   rL   r5   ru   r:   rt   rg   r7   )r=   r2   rU   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_rrseta  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-   r5   is_metaclassr:   r;   r    	exception	FormErrorrt   ru   r!   r   )r=   rZ   r2   r!   rU   rY   emptys          r   _parse_rr_headerUpdateMessage._parse_rr_headere  s    m(((++G44S]]...99mm---  99mm---3>>--s~~/B/BCC"))A,.. 2 22UgAUAU6U  11r   )r4   r8   )NN)N)'r   r   r   r   r   _section_enumr-   r5   INtsigdefault_algorithmr2   Namer1   r6   r   rc   r+   propertyr   r[   RRsetr    setterrL   rP   r\   rl   rV   ra   rh   r|   r:   rg   r   r   r   r   __classcell__)r>   s   @r   r   r   0   s   !M ,0-0^^->->"(,,/HH,F,F)Dhhmmc!D()D **)D t	)D
 %)D hhmmc))D $J)D )DV  d399??+     
[[   d399??3        SYY__-     ]] 	&AP3+ 3C 3D 3:G388==3. :Gs :Gt :Gx2CHHMMC/ 2 2 2$3CHHMMC/ 3 3 3p 8< hhmmc!  ''#-4  
	 D2 2r   r   )r   typingr   r   dns.enumr-   dns.exceptiondns.messagedns.name
dns.opcode	dns.rdatadns.rdataclassdns.rdatasetdns.rdatatype	dns.rrsetdns.tsigenumIntEnumr   messageMessager   Updater   r   r   r   r   r   r   <module>r      s   $ !            
CHH$$ 
H2CKK'' H2X
 
 						%%
r   