grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026a àMÒeÓ/ã@s¤dZddlmZmZmZmZddlZddlZddl Zddl Zddl Zddl Zddl ZddlZGdd„dejjƒZGdd„dejjƒZeZejZejZejZejZdS)zDNS Dynamic Update Supporté)ÚAnyÚListÚOptionalÚUnionNc@s,eZdZdZdZdZdZdZedd„ƒZ dS) Ú UpdateSectionzUpdate sectionsrééécCsdS)Nr ©)Úclsr r ú./usr/lib/python3.9/site-packages/dns/update.pyÚ_maximum(szUpdateSection._maximumN) Ú__name__Ú __module__Ú __qualname__Ú__doc__ÚZONEÚPREREQÚUPDATEÚ ADDITIONALÚ classmethodr r r r r r srcs¸eZdZeZdejjddejj dfe e ej j efejje ee ej j e ej j efe edœ‡fdd„ Zeeejjdœdd„ƒZejdd„ƒZeeejjdœd d „ƒZejd d „ƒZeeejjdœd d „ƒZejdd „ƒZd#dd„Zdd„Ze ej j efeddœdd„Ze ej j efeddœdd„Ze ej j efeddœdd„Ze ej j efeddœdd„Z d$e ej j efe e ej!j"efddœdd„Z#dd „Z$d!d"„Z%‡Z&S)%Ú UpdateMessageN)ÚzoneÚrdclassÚkeyringÚkeynameÚ keyalgorithmÚidcs˜tƒj|d�|jtj tjj¡O_t|tƒr>tj   |¡}||_ tj j  |¡}||_|j r||j|j|j |tjjddd�|dur”|j|||d�dS)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)ZcreateZ force_uniqueN)Ú algorithm)ÚsuperÚ__init__ÚflagsÚdnsZopcodeZto_flagsrÚ isinstanceÚstrÚnameÚ from_textÚoriginÚ rdataclassÚ RdataClassÚmakeÚ zone_rdclassÚ find_rrsetrÚ rdatatypeÚSOAZuse_tsig)Úselfrrrrrr©Ú __class__r r r 1s$  úzUpdateMessage.__init__)ÚreturncCs |jdS)zThe zone section.r©Zsections©r/r r r r\szUpdateMessage.zonecCs||jd<dS)Nrr3©r/Úvr r r rascCs |jdS)zThe prerequisite section.rr3r4r r r Ú prerequisiteeszUpdateMessage.prerequisitecCs||jd<dS)Nrr3r5r r r r7jscCs |jdS)zThe update section.rr3r4r r r ÚupdatenszUpdateMessage.updatecCs||jd<dS)Nrr3r5r r r r8ssc CsB|dur|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_rrwsÿzUpdateMessage._add_rrc Gst|tƒrtj |d¡}t|dtjjƒrf|D]4}|rD| ||j¡|D]}|j ||j ||d�qHq.n²t |ƒ}t |  d¡ƒ}t|dtjjƒrÂ|r¤| ||dj¡|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:rAr<ÚlistÚintÚpopÚrdataÚRdatar-Ú RdataTyper*r+r') r/Úreplacer?r%ÚargsÚrdsr=r<r:Úsr r r Ú_add‚s*  zUpdateMessage._add)r%rLr2cGs|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©rOr8©r/r%rLr r r r;ªs zUpdateMessage.addc GsHt|tƒrtj |d¡}t|ƒdkrP| |j|tjj tj j tj j tjj dd¡nôt|dtj j ƒrŒ|D]"}|D]}| |d|tjj ¡qnqfn¸t|ƒ}t|dtjjƒrÆ|D]}| |d|tjj ¡qªn~tj j | d¡¡}t|ƒdk�r| |j||j|tj j tjj 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...] NrT)r#r$r"r%r&Úlenr,r8r(ÚANYr-ÚNONErBrCrArErHrIrJr*rGr+r')r/r%rLrMr=Úlargsr:rNr r r rD¹sR  ø ø üzUpdateMessage.deletecGs|jd|j|g|¢RŽdS)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. TNrPrQr r r rKõszUpdateMessage.replacec Gst|tƒrtj |d¡}t|ƒdkrL| |j|tjj tj j tj j ddd¡n¾t|dtj j ƒs|t|dtjjƒs|t|ƒdkrÖt|dtj j ƒs¼t|ƒ}| dd¡|jd|j|g|¢RŽn|jd|j|g|¢RŽn4tj j |d¡}| |j|tjj |tj j ddd¡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&rRr,r7r(rSr-rTrBrCrHrIrEÚinsertrOrJr*)r/r%rLrUr:r r r ÚpresentsF  ø ÿþ ý øzUpdateMessage.present)r%r:r2c Cs|t|tƒrtj |d¡}|durH| |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,r7r(rTr-rSrJr*)r/r%r:r r r Úabsent<s0 ø øzUpdateMessage.absentcCsdS)NTr )r/Úvaluer r r Ú_get_one_rr_per_rrset^sz#UpdateMessage._get_one_rr_per_rrsetcCsŽd}d}|tjkr:tj |¡s0|tjjks0|jr‚tjj ‚nH|jsHtjj ‚|tjj tjj fvr‚|}|jdj }|tjj kp€|tj k}||||fS)NFr)rrr"r(Z is_metaclassr-r.rÚ exceptionZ FormErrorrSrTrr)r/r?r%rr:r>Úemptyr r r Ú_parse_rr_headerbs$  ÿ þý  ÿzUpdateMessage._parse_rr_header)NN)N)'rrrrZ _section_enumr"r(ÚINZtsigZdefault_algorithmrrr%ÚNamer$r)rrFr Úpropertyrr@ZRRsetrÚsetterr7r8rArOr;rDrKrWr-rJrXrZr]Ú __classcell__r r r0r r-sRù ù+    (<8ýü "r)rÚtypingrrrrZ dns.messager"Zdns.nameZ dns.opcodeZ dns.rdataZdns.rdataclassZ dns.rdatasetZ dns.rdatatypeZdns.tsigÚenumÚIntEnumrÚmessageZMessagerZUpdaterrrrr r r r Ús$ N