ftAdZddlZddlZddlZddlmZmZmZmZm Z m Z m Z ddl Z ddlZ ddlZ ddlZ ddlZ ddlZ ddlZ ddlZ ddlZ e j,j.ZGdde j2j4ZGdde j2j4ZGdd e j,j.Ze j<j<Gd d eZ dd e e j@jBe"fd e e jFjHe"fde%dee"de e jLjNde e jLjPde)de e jLjPdefdZ*d e e j@jBe"fd e e jFjHe"fde%dedef dZ+de%dee jXjZdefdZ.de%dedefdZ/y)zHDNS rdatasets (an rdataset is a set of rdatas of a given type and class)N)Any CollectionDictListOptionalUnioncastceZdZdZy)DifferingCoversz~An attempt was made to add a DNS SIG/RRSIG whose covered type is not the same as that of the other rdatas in the rdataset.N__name__ __module__ __qualname____doc__U/var/lib/jenkins/workspace/mettalog/venv/lib/python3.12/site-packages/dns/rdataset.pyr r 'sDrr ceZdZdZy)IncompatibleTypesz?An attempt was made to add DNS RR data of an incompatible type.Nr rrrrr,sIrrceZdZdZgdZej jdfdejjdej jdej jde ffd Z fd Z de d d fd Z d$d ejj dee d d ffd ZfdZfdZfdZdZdZdZfdZdZ d%deej6j8deej6j8dedeejjdedeee fd efdZ! d&dej6j8de deej6jDdeej6j8deejjd ed e fd!Z#dejjdej jdej jd efd"Z$d e%ejj fd#Z&xZ'S)'RdatasetzA DNS rdataset.)rdclassrdtypecoversttlrrrrrcZt|||_||_||_||_y)a5Create a new rdataset of the specified class and type. *rdclass*, a ``dns.rdataclass.RdataClass``, the rdataclass. *rdtype*, an ``dns.rdatatype.RdataType``, the rdatatype. *covers*, an ``dns.rdatatype.RdataType``, the covered rdatatype. *ttl*, an ``int``, the TTL. N)super__init__rrrr)selfrrrr __class__s rrzRdataset.__init__5s,$  /5 /5 rct|}|j|_|j|_|j|_|j |_|SN)r_clonerrrr)robjr s rr#zRdataset._cloneMs@gnll [[ [[ (( rreturnNctjj|}t|dk(r||_y||jkr||_yy)aPerform TTL minimization. Set the TTL of the rdataset to be the lesser of the set's current TTL or the specified TTL. If the set contains no rdatas, set the TTL to the specified TTL. *ttl*, an ``int`` or ``str``. rN)dnsrmakelenrrs r update_ttlzRdataset.update_ttlUs?ggll3 t9>DH 488^DHrrdc|j|jk7s|j|jk7rt||j||jtj j k(s'|jtj jk(rb|j}t|dk(r/|jtj jk(r||_n|j|k7rttj j|jrt|dkDr|jt|=|y)a!Add the specified rdata to the rdataset. If the optional *ttl* parameter is supplied, then ``self.update_ttl(ttl)`` will be called prior to adding the rdata. *rd*, a ``dns.rdata.Rdata``, the rdata *ttl*, an ``int``, the TTL. Raises ``dns.rdataset.IncompatibleTypes`` if the type and class do not match the type and class of the rdataset. Raises ``dns.rdataset.DifferingCovers`` if the type is a signature type and the covered type does not match that of the rdataset. Nr)rrrr+r' rdatatypeRRSIGSIGrr)NONEr is_singletonclearradd)rr,rrr s rr4z Rdataset.addds2 <<2:: % )A# # ? OOC ;;#---- - @Q@Q1QYY[F4yA~$++1C1C"C$ &%% == % %bii 0SY] JJL  BrcZ|j|jt| |yr")r+rr union_updaterotherr s rr6zRdataset.union_updates   " U#rcZ|j|jt| |yr")r+rrintersection_updater7s rr:zRdataset.intersection_updates   " #E*rcZ|j|jt| |y)zAdd all rdatas in other to self. *other*, a ``dns.rdataset.Rdataset``, the rdataset from which to update. N)r+rrupdater7s rr<zRdataset.updates!  " urcDdddjfd|DzS)Nc2t|dkDr|dddzS|S)Ndz...)r))ss rmaybe_truncatez,Rdataset._rdata_repr..maybe_truncates"1v|#w&Hrz[%s]z, c3FK|]}dt|zyw)z<%s>N)str).0rrrAs r z'Rdataset._rdata_repr..s!Rr&>#b'+B"B!Rs!)join)rrAs @r _rdata_reprzRdataset._rdata_reprs$   !RT!RRRRrcj|jdk(rd}n/dtjj|jzdz}dtjj|j zdztjj|j z|zdz|jzdzS) Nr()z)rr'r.to_text rdataclassrrrH)rctexts r__repr__zRdataset.__repr__s ;;! E#--// < GG$$NN**73MM))$++6   ||"$R\\N 3)..w7 --dkk:" N&ZN2N   (zz|CR  rfilecompress want_shufflec j||}d}n |j}t|dk(rF|j||||jt j d|j |ddy|r!t|}tj|n|}|D]} |j||||jt j d|j ||jtjj|d5| j|||dddt|S#1swYxYw)atConvert the rdataset to wire format. *name*, a ``dns.name.Name`` is the owner name to use. *file* is the file where the name is emitted (typically a BytesIO file). *compress*, a ``dict``, is the compression table to use. If ``None`` (the default), names will not be compressed. *origin* is a ``dns.name.Name`` or ``None``. If the name is relative and origin is not ``None``, then *origin* will be appended to it. *override_rdclass*, an ``int``, is used as the class instead of the class of the rdataset. This is useful when rendering rdatasets associated with dynamic updates. *want_shuffle*, a ``bool``. If ``True``, then the order of the Rdatas within the Rdataset will be shuffled before rendering. Returns an ``int``, the number of records emitted. NFrz!HHIHz!HHI)rr)to_wirergstructpackrlistrandomshufflerr'rendererprefixed_length) rr\rnror]r_rprlr,s rrtzRdataset.to_wiresB  '&G LllG t9> LLx 0 JJv{{7DKK!QG HJq! T8V4 6;;vt{{GTXXNO\\11$:7JJtXv677 t9 77s D))D2 c`|j|k(r|j|k(r|j|k(ryy)zaReturns ``True`` if this rdataset matches the specified class, type, and covers. TF)rrr)rrrrs rmatchzRdataset.matchQs- <<7 "t{{f'<PVAVrc\t|dk(rgS|djt|S)aTReturn rdatas in a valid processing order according to the type's specification. For example, MX records are in preference order from lowest to highest preferences, with items of the same preference shuffled. For types that do not define a processing order, the rdatas are simply shuffled. r)r)_processing_orderiterrTs rprocessing_orderzRdataset.processing_order^s- t9>I7,,T$Z8 8rr")NNTNF)NNNT)(r rrr __slots__r'r.r1rP RdataClass RdataTypeintrr#r+rdataRdatarr4r6r:r<rHrRrUrXr[r\NameboolrrCrrO CompressTypertr~rr __classcell__r s@rrr0sW6I +.--*<*< ** '' ''   0 c d  9=%))//%(0 % %N$+S  %& )-*.@D# Q!sxx}}%Q!'Q! Q! #3>>#<#<= Q!  Q!38nQ! Q!n59*.@D!6hhmm66388001 6 ' 6 #3>>#<#<= 66 6p **  ''  ''    9$syy"7 9rrceZdZdZeZdeffd ZdZddZdZ dZ dZ d Z d Z d Zd Zd ZdZfdZfdZfdZfdZfdZfdZxZS)ImmutableRdatasetzAn immutable DNS rdataset.rdatasetct||j|j|j|j t jj|j|_ y)z9Create an immutable rdataset from the specified rdataset.N) rrrrrrr' immutableritems)rrr s rrzImmutableRdataset.__init__ssI    hoox  ]]''7 rctdNr TypeErrorr*s rr+zImmutableRdataset.update_ttl{  $$rctdrr)rr,rs rr4zImmutableRdataset.add~rrctdrrrZs rr6zImmutableRdataset.union_updaterrctdrrrZs rr:z%ImmutableRdataset.intersection_updaterrctdrrrZs rr<zImmutableRdataset.updaterrctdrr)ris r __delitem__zImmutableRdataset.__delitem__rrctdrrrZs r__ior__zImmutableRdataset.__ior__rrctdrrrZs r__iand__zImmutableRdataset.__iand__rrctdrrrZs r__iadd__zImmutableRdataset.__iadd__rrctdrrrZs r__isub__zImmutableRdataset.__isub__rrctdrrrTs rr3zImmutableRdataset.clearrrc2tt| Sr"rrcopyrr s r__copy__zImmutableRdataset.__copy__ 00rc2tt| Sr"rrs rrzImmutableRdataset.copyrrc4tt| |Sr")rrunionr7s rrzImmutableRdataset.unions u!566rc4tt| |Sr")rr intersectionr7s rrzImmutableRdataset.intersections !5e!<==rc4tt| |Sr")rr differencer7s rrzImmutableRdataset.differences !3E!:;;rc4tt| |Sr")rrsymmetric_differencer7s rrz&ImmutableRdataset.symmetric_differences !=e!DEErr")r rrrr _clone_classrr+r4r6r:r<rrrrrr3rrrrrrrrs@rrrmss$L88%%%%%%%%%%%117><FFrrrrr text_rdatas idna_codecr]r^ relativize_tor%c tjjj|}tjj j|}t ||}|j||D]L} tjj|j|j| ||||} |j| N|S)a|Create an rdataset with the specified class, type, and TTL, and with the specified list of rdatas in text format. *idna_codec*, a ``dns.name.IDNACodec``, specifies the IDNA encoder/decoder to use; if ``None``, the default IDNA 2003 encoder/decoder is used. *origin*, a ``dns.name.Name`` (or ``None``), the origin to use for relative names. *relativize*, a ``bool``. If true, name will be relativized. *relativize_to*, a ``dns.name.Name`` (or ``None``), the origin to use when relativizing names. If not set, the *origin* value will be used. Returns a ``dns.rdataset.Rdataset`` object. ) r'rPrr(r.rrr+r from_textrrr4) rrrrrr]r^rrtr,s rfrom_text_listrs8nn'',,W5G ]] $ $ ) )& 1F&!ALL  YY IIqxxFJ z  b  Hrc Ht|||ttt|S)zCreate an rdataset with the specified class, type, and TTL, and with the specified rdatas in text format. Returns a ``dns.rdataset.Rdataset`` object. )rr rrC)rrrrs rrrs  '63Z_k0R SSrrdatasct|dk(r tdd}|D]F}|1t|j|j}|j ||j |H|J|S)zCreate an rdataset with the specified TTL, and with the specified list of rdata objects. Returns a ``dns.rdataset.Rdataset`` object. rzrdata list must not be emptyN)r) ValueErrorrrrr+r4)rrrr,s rfrom_rdata_listrsl 6{a788 A 9RYY/A LL  b  == Hrclt|tttjj |S)zCreate an rdataset with the specified TTL, and with the specified rdata objects. Returns a ``dns.rdataset.Rdataset`` object. )rr rr'rr)rrs r from_rdatars% 3Z %@& I JJr)NNTN)0rrerxrutypingrrrrrrr dns.exceptionr' dns.immutabledns.name dns.rdatadns.rdataclass dns.rdatatype dns.rendererdns.setdns.ttlsetSet SimpleSet exception DNSExceptionr rrrrrPrrCr.rrr\ IDNACodecrrrrrrrrrrrrs$O EEE GGKK Dcmm00D J 22Jz9sww{{z9z BFBFBFT04&*-1% 3>>,,c1 2% #--))3. /%  % C % ++, % SXX]] # % % CHHMM*% % P T 3>>,,c1 2 T #--))3. / T  T T  T  j&A h &KCK#K(Kr