HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib/python3.10/site-packages/dns/__pycache__/update.cpython-310.pyc
o

!we�/�@s�dZddlmZmZmZmZddlZddlZddl	Zddl
ZddlZddlZddl
ZddlZGdd�dejj�ZGdd�dejj�ZeZejZejZejZejZdS)zDNS Dynamic Update Support�)�Any�List�Optional�UnionNc@s,eZdZdZdZdZdZdZedd��Z	dS)	�
UpdateSectionzUpdate sectionsr���cC�dS)Nr	�)�clsrr�C/home/arjun/projects/env/lib/python3.10/site-packages/dns/update.py�_maximum(�zUpdateSection._maximumN)
�__name__�
__module__�__qualname__�__doc__�ZONE�PREREQ�UPDATE�
ADDITIONAL�classmethodrrrrr
r srcs�eZdZeZdejjddejj	dfde
eejj
efdejjde
ede
ejj
deejj
efde
ef�fdd	�
Zed
eejjfdd��Zejd
d��Zed
eejjfdd��Zejdd��Zed
eejjfdd��Zejdd��Zd)dd�Zdd�Zdeejj
efded
dfdd�Zdeejj
efded
dfdd�Zdeejj
efded
dfdd�Zdeejj
efded
dfd d!�Z 	d*deejj
efd"e
eej!j"efd
dfd#d$�Z#d%d&�Z$d'd(�Z%�Z&S)+�
UpdateMessageN�zone�rdclass�keyring�keyname�keyalgorithm�idcs�t�j|d�|jtj�tjj�O_t|t�rtj	�
|�}||_tjj
�|�}||_|jr>|j|j|j|tjjddd�|durL|j|||d�dSdS)axInitialize 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.
        )rT)�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)�selfrrrrrr��	__class__rr
r$1s&
��zUpdateMessage.__init__�returncC�
|jdS)zThe zone section.r��sections�r6rrr
r\�
zUpdateMessage.zonecC�||jd<dS)Nrr;�r6�vrrr
ra�cCr:)zThe prerequisite section.rr;r=rrr
�prerequisiteer>zUpdateMessage.prerequisitecCr?)Nrr;r@rrr
rCjrBcCr:)zThe update section.rr;r=rrr
�updatenr>zUpdateMessage.updatecCr?)Nrr;r@rrr
rDsrBc
CsB|dur|j}|��}|�|||j|j||dd�}|�||�dS)z&Add a single RR to the update section.NT)rD�coversr2r1�rdtype�add)r6r+�ttl�rd�deleting�sectionrE�rrsetrrr
�_add_rrws�zUpdateMessage._add_rrc
Gs t|t�rtj�|d�}t|dtjj�r4|D]}|r"|�||j�|D]}|j	||j
||d�q$qdSt|�}t|�
d��}t|dtjj�rc|rS|�||dj�|D]}|j	||||d�qUdStjj�|�
d��}|ru|�||�|D]}	tj�|j||	|j�}|j	||||d�qwdS)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)rK)r)r*r&r+r,�rdataset�Rdataset�deleterFrMrH�list�int�pop�rdata�Rdatar3�	RdataTyper0r1r-)
r6�replacerKr+�args�rdsrIrHrF�srrr
�_add�s2
����zUpdateMessage._addr+rXcG�|jd|j|g|�R�dS)z�Add records.

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

                - rdataset...

                - ttl, rdata...

                - ttl, rdtype, string...
        FN�r[rD�r6r+rXrrr
rG�s
zUpdateMessage.addc
GsLt|t�rtj�|d�}t|�dkr)|�|j|tjj	tj
j	tj
jtjj	dd�dSt|dtjj
�rH|D]}|D]}|�|d|tjj�q8q4dSt|�}t|dtjj�rf|D]}|�|d|tjj�qWdStj
j�|�d��}t|�dkr�|�|j||j|tj
jtjj	dd�dS|D]}tj�|j|||j�}|�|d|tjj�q�dS)z�Delete records.

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

                - *empty*

                - rdataset...

                - rdata...

                - rdtype, [string...]
        NrT)r)r*r&r+r,�lenr2rDr.�ANYr3�NONErNrOrMrQrTrUrVr0rSr1r-)r6r+rXrYrI�largsrFrZrrr
rP�sZ
�
������zUpdateMessage.deletecGr\)abReplace 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.
        TNr]r^rrr
rW�szUpdateMessage.replacec
Gst|t�rtj�|d�}t|�dkr'|�|j|tjj	tj
j	tj
jddd�dSt|dtjj
�s?t|dtjj�s?t|�dkrnt|dtjj
�s`t|�}|�dd�|jd|j|g|�R�dS|jd|j|g|�R�dStj
j�|d�}|�|j|tjj	|tj
jddd�dS)aSRequire 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...
        NrTrF)r)r*r&r+r,r_r2rCr.r`r3rarNrOrTrUrQ�insertr[rVr0)r6r+rXrbrFrrr
�presentsD
����zUpdateMessage.presentrFc
Cs~t|t�rtj�|d�}|dur%|�|j|tjjtj	j
tj	jddd�dStj	j�|�}|�|j|tjj|tj	jddd�dS)z�Require 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+r,r2rCr.rar3r`rVr0)r6r+rFrrr
�absent<s0
��zUpdateMessage.absentcCr
)NTr)r6�valuerrr
�_get_one_rr_per_rrset^rz#UpdateMessage._get_one_rr_per_rrsetcCs�d}d}|tjkrtj�|�s|tjjks|jrtjj	�n$|js$tjj	�|tjj
tjjfvrA|}|jdj}|tjj
kp@|tj
k}||||fS)NFr)rrr&r.�is_metaclassr3r4r�	exception�	FormErrorr`rarr)r6rKr+rrFrJ�emptyrrr
�_parse_rr_headerbs$

����zUpdateMessage._parse_rr_header)NN)N)'rrrr�
_section_enumr&r.�IN�tsig�default_algorithmrrr+�Namer*r/rrRr$�propertyrrL�RRsetr�setterrCrDrMr[rGrPrWrdr3rVrergrl�
__classcell__rrr7r
r-sb����
���+



"(""<"8���
�"r)r�typingrrrr�dns.messager&�dns.name�
dns.opcode�	dns.rdata�dns.rdataclass�dns.rdataset�
dns.rdatatype�dns.tsig�enum�IntEnumr�message�Messager�Updaterrrrrrrr
�<module>s&
N