관리-도구
편집 파일: update.cpython-39.pyc
a �����M�e�/����������������������@���s����d�Z�ddlmZmZmZmZ�ddlZddlZddl Zddl ZddlZddlZddl ZddlZG�dd��dejj�ZG�dd��dejj�ZeZejZejZejZejZdS�)zDNS Dynamic Update Support�����)�Any�List�Optional�UnionNc�������������������@���s,���e�Zd�ZdZdZdZdZdZedd���Z dS�) � UpdateSectionzUpdate sectionsr���������������c�����������������C���s���dS�)Nr �����)�clsr ���r ����./usr/lib/python3.9/site-packages/dns/update.py�_maximum(���s����zUpdateSection._maximumN) �__name__� __module__�__qualname__�__doc__�ZONE�PREREQ�UPDATE� ADDITIONAL�classmethodr ���r ���r ���r ���r���r��� ���s���r���c�����������������������s���e�Zd�ZeZdejjddejj dfe eejj ef��ejje e�e ejj �eejj ef�e e�d���fdd� Zeeejj�d�dd��Zejdd���Zeeejj�d�d d ��Zejdd ���Zeeejj�d�dd ��Zejdd ���Zd#dd�Zdd��Zeejj ef�edd�dd�Zeejj ef�edd�dd�Zeejj ef�edd�dd�Zeejj ef�edd�dd�Z d$eejj ef�e eej!j"ef��dd�dd�Z#dd ��Z$d!d"��Z%���Z&S�)%� UpdateMessageN)�zone�rdclass�keyring�keyname�keyalgorithm�idc��������������������s����t���j|d��|��jtj�tjj�O��_t|t�r>tj � |�}||�_tjj �|�}||�_|�jr||�j|�j|�j|tjjddd��|dur�|�j|||d��dS�)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)ZcreateZforce_uniqueN)� algorithm)�super�__init__�flags�dnsZopcodeZto_flagsr���� isinstance�str�name� from_text�origin� rdataclass� RdataClass�make�zone_rdclass� find_rrsetr���� rdatatype�SOAZuse_tsig)�selfr���r���r���r���r���r����� __class__r ���r���r ���1���s$���� �zUpdateMessage.__init__)�returnc�����������������C���s ���|�j�d�S�)zThe zone section.r����Zsections�r/���r ���r ���r���r���\���s����zUpdateMessage.zonec�����������������C���s���||�j�d<�d�S�)Nr���r3����r/����vr ���r ���r���r���a���s����c�����������������C���s ���|�j�d�S�)zThe prerequisite section.r���r3���r4���r ���r ���r����prerequisitee���s����zUpdateMessage.prerequisitec�����������������C���s���||�j�d<�d�S�)Nr���r3���r5���r ���r ���r���r7���j���s����c�����������������C���s ���|�j�d�S�)zThe update section.r���r3���r4���r ���r ���r����updaten���s����zUpdateMessage.updatec�����������������C���s���||�j�d<�d�S�)Nr���r3���r5���r ���r ���r���r8���s���s����c�������������� ���C���sB���|du�r|�j�}|���}|��|||�j|j||dd�}|�||��dS�)z&Add a single RR to the update section.NT)r8����coversr,���r+����rdtype�add)r/���r%����ttl�rd�deleting�sectionr9����rrsetr ���r ���r����_add_rrw���s�����zUpdateMessage._add_rrc����������� ������G���s��t�|t�rtj�|d�}t�|d�tjj�rf|D�]4}|rD|��||j��|D�]}|�j ||j ||d��qHq.n�t|�}t|� d��}t�|d�tjj�r�|r�|��||d�j��|D�]}|�j ||||d��q�nVtjj�|� d��}|r�|��||��|D�],} tj�|�j|| |�j�}|�j ||||d��q�dS�)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���)r?���)r#���r$���r"���r%���r&����rdataset�Rdataset�deleter:���rA���r<����list�int�pop�rdata�Rdatar-���� RdataTyper*���r+���r'���) r/����replacer?���r%����args�rdsr=���r<���r:����sr ���r ���r����_add����s*���� zUpdateMessage._add)r%���rL���r2���c�����������������G���s���|�j�d|�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�rO���r8����r/���r%���rL���r ���r ���r���r;�������s���� zUpdateMessage.addc�������������� ���G���sH��t�|t�rtj�|d�}t|�dkrP|��|�j|tjj tj j tj jtjj dd��n�t�|d�tjj �r�|D�]"}|D�]}|��|d|tjj��qnqfn�t|�}t�|d�tjj�r�|D�]}|��|d|tjj��q�n~tj j�|�d��}t|�dk�r|��|�j||�j|tj jtjj dd��n6|D�]0}tj�|�j|||�j�}|��|d|tjj���qdS�)z�Delete records. The first argument is always a name. The other arguments can be: - *empty* - rdataset... - rdata... - rdtype, [string...] Nr���T)r#���r$���r"���r%���r&����lenr,���r8���r(����ANYr-����NONErB���rC���rA���rE���rH���rI���rJ���r*���rG���r+���r'���)r/���r%���rL���rM���r=����largsr:���rN���r ���r ���r���rD�������sR���� � ��zUpdateMessage.deletec�����������������G���s���|�j�d|�j|g|�R����dS�)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. TNrP���rQ���r ���r ���r���rK�������s����zUpdateMessage.replacec�������������� ���G���s��t�|t�rtj�|d�}t|�dkrL|��|�j|tjj tj j tj jddd��n�t�|d�tjj �s|t�|d�tjj�s|t|�dkr�t�|d�tjj �s�t|�}|�dd��|�jd|�j|g|�R����n|�jd|�j|g|�R����n4tj j�|d��}|��|�j|tjj |tj jddd��dS�)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%���r&���rR���r,���r7���r(���rS���r-���rT���rB���rC���rH���rI���rE����insertrO���rJ���r*���)r/���r%���rL���rU���r:���r ���r ���r����present��sF���� ��� ��zUpdateMessage.present)r%���r:���r2���c�������������� ���C���s|���t�|t�rtj�|d�}|du�rH|��|�j|tjjtj j tj jddd��n0tj 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&���r,���r7���r(���rT���r-���rS���rJ���r*���)r/���r%���r:���r ���r ���r����absent<��s0���� ��zUpdateMessage.absentc�����������������C���s���dS�)NTr ���)r/����valuer ���r ���r����_get_one_rr_per_rrset^��s����z#UpdateMessage._get_one_rr_per_rrsetc�����������������C���s����d�}d}|t�jkr:tj�|�s0|tjjks0|�jr�tjj �nH|�jsHtjj �|tjj tjjfv�r�|}|�jd�j}|tjj kp�|t�j k}||||fS�)NFr���)r���r���r"���r(���Zis_metaclassr-���r.���r���� exceptionZ FormErrorrS���rT���r���r���)r/���r?���r%���r���r:���r>����emptyr ���r ���r����_parse_rr_headerb��s$���� � �� �zUpdateMessage._parse_rr_header)NN)N)'r���r���r���r���Z _section_enumr"���r(����INZtsigZdefault_algorithmr���r���r%����Namer$���r)���r���rF���r ����propertyr���r@���ZRRsetr����setterr7���r8���rA���rO���r;���rD���rK���rW���r-���rJ���rX���rZ���r]���� __classcell__r ���r ���r0���r���r���-���sR���� �+ (<8���"r���)r����typingr���r���r���r���Zdns.messager"���Zdns.nameZ dns.opcodeZ dns.rdataZdns.rdataclassZdns.rdatasetZ dns.rdatatypeZdns.tsig�enum�IntEnumr����messageZMessager���ZUpdater���r���r���r���r ���r ���r ���r����<module>���s$��� ��N