ҥOc@sdZddlZddlZddlZddlZddlZddlZddlZddl Zej j Z dej jfdYZdej jfdYZdej j fdYZd Zd Zd Zd ZdS( sHDNS rdatasets (an rdataset is a set of rdatas of a given type and class)iNtDifferingCoverscBseZdZRS(sRaised if an attempt is made to add a SIG/RRSIG whose covered type is not the same as that of the other rdatas in the rdataset.(t__name__t __module__t__doc__(((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyRstIncompatibleTypescBseZdZRS(sBRaised if an attempt is made to add rdata of an incompatible type.(RRR(((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyR$stRdatasetcBseZdZddddgZejjdZdZdZ ddZ d Z d Z d Zd Zd ZdZdZddeddZdddedZdZRS(sA DNS rdataset. @ivar rdclass: The class of the rdataset @type rdclass: int @ivar rdtype: The type of the rdataset @type rdtype: int @ivar covers: The covered type. Usually this value is dns.rdatatype.NONE, but if the rdtype is dns.rdatatype.SIG or dns.rdatatype.RRSIG, then the covers value will be the rdata type the SIG/RRSIG covers. The library treats the SIG and RRSIG types as if they were a family of types, e.g. RRSIG(A), RRSIG(NS), RRSIG(SOA). This makes RRSIGs much easier to work with than if RRSIGs covering different rdata types were aggregated into a single RRSIG rdataset. @type covers: int @ivar ttl: The DNS TTL (Time To Live) value @type ttl: int trdclasstrdtypetcoverstttlcCs;tt|j||_||_||_d|_dS(sCreate a new rdataset of the specified class and type. @see: the description of the class instance variables for the meaning of I{rdclass} and I{rdtype}iN(tsuperRt__init__RRRR (tselfRRR((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyR >s    cCsItt|j}|j|_|j|_|j|_|j|_|S(N(R Rt_cloneRRRR (R tobj((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyR Js     cCs=t|dkr||_n||jkr9||_ndS(sSet 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. @param ttl: The TTL @type ttl: intiN(tlenR (R R ((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyt update_ttlRs cCs|j|jks$|j|jkr-tn|dk rI|j|n|jtjjkss|jtjjkr|j }t |dkr|j tjj kr||_ q|j |krt qntjj |jrt |dkr|jntt|j|dS(s%Add the specified rdata to the rdataset. If the optional I{ttl} parameter is supplied, then self.update_ttl(ttl) will be called prior to adding the rdata. @param rd: The rdata @type rd: dns.rdata.Rdata object @param ttl: The TTL @type ttl: intiN(RRRtNoneRtdnst rdatatypetRRSIGtSIGRRtNONERt is_singletontclearR Rtadd(R trdR R((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyR^s$   '  ' cCs*|j|jtt|j|dS(N(RR R Rt union_update(R tother((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyR~scCs*|j|jtt|j|dS(N(RR R Rtintersection_update(R R((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyRscCs*|j|jtt|j|dS(sAdd all rdatas in other to self. @param other: The rdataset from which to update @type other: dns.rdataset.Rdataset objectN(RR R Rtupdate(R R((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyRscCsk|jdkrd}ndtjj|jd}dtjj|jdtjj|j|dS(Nitt(t)s(RRRtto_textt rdataclassRR(R tctext((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyt__repr__s cCs |jS(N(R#(R ((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyt__str__scCsct|tstS|j|jksI|j|jksI|j|jkrMtStt|j|S(sTwo rdatasets are equal if they have the same class, type, and covers, and contain the same rdata. @rtype: bool(t isinstanceRtFalseRRRR t__eq__(R R((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyR*scCs|j| S(N(R*(R R((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyt__ne__sc Ks%|d k r3|j||}t|}d}n d}d}tj}|d k r`|} n |j} t|dkr|d||tjj| tj j|j fIJndxa|D]Y} |d|||j tjj| tj j|j | jd|d||fIJqW|j d S( sConvert the rdataset into DNS master file format. @see: L{dns.name.Name.choose_relativity} for more information on how I{origin} and I{relativize} determine the way names are emitted. Any additional keyword arguments are passed on to the rdata to_text() method. @param name: If name is not None, emit a RRs with I{name} as the owner name. @type name: dns.name.Name object @param origin: The origin for relative names, or None. @type origin: dns.name.Name object @param relativize: True if names should names be relativized @type relativize: boolR"Ris %s%s%s %ss%s%s%d %s %s %storigint relativizeiN( Rtchoose_relativitytstrtStringIORRRR$R#RRR tgetvalue( R tnameR,R-toverride_rdclasstkwtntexttpadtsRR((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyR#s(         #c Cs|dk r|}t}n |j}|jddt|dkr|j|||tjd|j|dd}|j |dS|rt |} t j | n|} x| D]} |j|||tjd|j||j d}|j ||j} | j||||j} |j| dtjd| | }|j ||jddqWt|SdS(s,Convert the rdataset to wire format. @param name: The owner name of the RRset that will be emitted @type name: dns.name.Name object @param file: The file to which the wire format data will be appended @type file: file @param compress: The compression table to use; the default is None. @type compress: dict @param origin: The origin to be appended to any relative names when they are emitted. The default is None. @returns: the number of records emitted @rtype: int iis!HHIHis!HN(RR)RtseekRtto_wiretstructtpackRtwritetlisttrandomtshuffleR ttell( R R2tfiletcompressR,R3t want_shuffleRtstufftlRtstarttend((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyR9s6          cCs5|j|kr1|j|kr1|j|kr1tStS(sSReturns True if this rdataset matches the specified class, type, and covers(RRRtTrueR)(R RRR((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pytmatch s N(RRRt __slots__RRRR R RRRRRRR&R'R*R+RHR#R9RI(((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyR(s$        1/cCst|ttfr*tjj|}nt|ttfrTtjj|}nt||}|j|x9|D]1}tj j|j |j |}|j |qwW|S(sCreate an rdataset with the specified class, type, and TTL, and with the specified list of rdatas in text format. @rtype: dns.rdataset.Rdataset object ( R(R/tunicodeRR$t from_textRRRtrdataRRR(RRR t text_rdatastrttR((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pytfrom_text_lists  cGst||||S(sCreate an rdataset with the specified class, type, and TTL, and with the specified rdatas in text format. @rtype: dns.rdataset.Rdataset object (RQ(RRR RN((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyRL'scCst|dkr!tdnd}xR|D]J}|dkrkt|j|j}|j|t}n|j|q.W|S(sCreate an rdataset with the specified TTL, and with the specified list of rdata objects. @rtype: dns.rdataset.Rdataset object isrdata list must not be emptyN( Rt ValueErrorRRRRRR)R(R trdatasRORt first_time((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pytfrom_rdata_list0s    cGs t||S(sCreate an rdataset with the specified TTL, and with the specified rdata objects. @rtype: dns.rdataset.Rdataset object (RU(R RS((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyt from_rdataBs(RR>R0R:t dns.exceptionRt dns.rdatatypetdns.rdataclasst dns.rdatatdns.settsettSett SimpleSett exceptiont DNSExceptionRRRRQRLRURV(((s2/usr/lib64/python2.7/site-packages/dns/rdataset.pyts