ó ®$Nc@sdZddlZddlZddlZddlZddlZddlZddlZdZ dd„Z dZ dd„Z ied6ed6Zd„Zd „Zd efd „ƒYZd efd „ƒYZiZdZd„Zded„Zdd„ZdS(sæDNS rdata. @var _rdata_modules: A dictionary mapping a (rdclass, rdtype) tuple to the module which implements that type. @type _rdata_modules: dict @var _module_prefix: The prefix to use when forming modules names. The default is 'dns.rdtypes'. Changing this value will break the library. @type _module_prefix: string @var _hex_chunk: At most this many octets that will be represented in each chunk of hexstring that _hexify() produces before whitespace occurs. @type _hex_chunk: intiÿÿÿÿNi cCs“|dkrt}n|jdƒ}t|ƒ}||krg}d}x2||kr||j||||!ƒ||7}qKWdj|ƒ}n|S(sConvert a binary string into its hex encoding, broken up into chunks of I{chunksize} characters separated by a space. @param data: the binary string @type data: string @param chunksize: the chunk size. Default is L{dns.rdata._hex_chunksize} @rtype: string t hex_codecit N(tNonet_hex_chunksizetencodetlentappendtjoin(tdatat chunksizethextltchunksti((s//usr/lib64/python2.7/site-packages/dns/rdata.pyt_hexify's    cCs¥|dkrt}n|jdƒ}|jddƒ}t|ƒ}||kr¡g}d}x2||krŽ|j||||!ƒ||7}q]Wdj|ƒ}n|S(s$Convert a binary string into its base64 encoding, broken up into chunks of I{chunksize} characters separated by a space. @param data: the binary string @type data: string @param chunksize: the chunk size. Default is L{dns.rdata._base64_chunksize} @rtype: string t base64_codecs tiRN(Rt_base64_chunksizeRtreplaceRRR(RR tb64R R R ((s//usr/lib64/python2.7/site-packages/dns/rdata.pyt _base64ify@s    t"s\cCs}d}xp|D]h}|tkr0|d|7}q t|ƒdkrat|ƒdkra||7}q |dt|ƒ7}q W|S(sªEscape the characters in a quoted string which need it. @param qstring: the string @type qstring: string @returns: the escaped string @rtype: string Rs\i is\%03d(t __escapedtord(tqstringttexttc((s//usr/lib64/python2.7/site-packages/dns/rdata.pyt _escapify^s   $ cCsSx8tt|ƒdddƒD]}||dkrPqqWdj|d|d!ƒS(sñDetermine the index of greatest byte that isn't all zeros, and return the bitmap that contains all the bytes less than that index. @param what: a string of octets representing a bitmap. @type what: string @rtype: string iiÿÿÿÿtRi(txrangeRR(twhatR ((s//usr/lib64/python2.7/site-packages/dns/rdata.pyt_truncate_bitmapqs #tRdatacBs eZdZddgZd„Zd„Zd„Zded„Z ddd„Z dd„Z d „Z d „Z d „Zd „Zd „Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zded„ZeeƒZdd„ZeeƒZded„ZRS(s(Base class for all DNS rdata types. trdclasstrdtypecCs||_||_dS(s Initialize an rdata. @param rdclass: The rdata class @type rdclass: int @param rdtype: The rdata type @type rdtype: int N(R!R"(tselfR!R"((s//usr/lib64/python2.7/site-packages/dns/rdata.pyt__init__…s cCs tjjS(s_DNS SIG/RRSIG rdatas apply to a specific type; this type is returned by the covers() function. If the rdata type is not SIG or RRSIG, dns.rdatatype.NONE is returned. This is useful when creating rdatasets, allowing the rdataset to contain only RRSIGs of a particular type, e.g. RRSIG(NS). @rtype: int (tdnst rdatatypetNONE(R#((s//usr/lib64/python2.7/site-packages/dns/rdata.pytcoverss cCs|jƒd>|jBS(sÉReturn a 32-bit type value, the least significant 16 bits of which are the ordinary DNS type, and the upper 16 bits of which are the "covered" type, if any. @rtype: int i(R(R"(R#((s//usr/lib64/python2.7/site-packages/dns/rdata.pytextended_rdatatype›scKs t‚dS(s@Convert an rdata to text format. @rtype: string N(tNotImplementedError(R#torigint relativizetkw((s//usr/lib64/python2.7/site-packages/dns/rdata.pytto_text¤scCs t‚dS(s@Convert an rdata to wire format. @rtype: string N(R*(R#tfiletcompressR+((s//usr/lib64/python2.7/site-packages/dns/rdata.pytto_wireªscCs)tjƒ}|j|d|ƒ|jƒS(slConvert rdata to a format suitable for digesting in hashes. This is also the DNSSEC canonical form.N(t cStringIOtStringIOR1Rtgetvalue(R#R+tf((s//usr/lib64/python2.7/site-packages/dns/rdata.pyt to_digestable±s cCs&tjj|j|j|jƒƒdS(sÜCheck that the current contents of the rdata's fields are valid. If you change an rdata by assigning to its fields, it is a good idea to call validate() when you are done making changes. N(R%trdatat from_textR!R"R.(R#((s//usr/lib64/python2.7/site-packages/dns/rdata.pytvalidate¸scCs…|jƒ}|tjjkr'd}ndtjj|ƒd}dtjj|jƒdtjj|jƒ|dt|ƒdS(NRt(t)s( R(R%R&R'R.t rdataclassR!R"tstr(R#R(tctext((s//usr/lib64/python2.7/site-packages/dns/rdata.pyt__repr__Às   cCs |jƒS(N(R.(R#((s//usr/lib64/python2.7/site-packages/dns/rdata.pyt__str__ÊscCs t‚dS(s½Compare an rdata with another rdata of the same rdtype and rdclass. Return < 0 if self < other in the DNSSEC ordering, 0 if self == other, and > 0 if self > other. N(R*(R#tother((s//usr/lib64/python2.7/site-packages/dns/rdata.pyt_cmpÍscCsNt|tƒstS|j|jks7|j|jkr;tS|j|ƒdkS(Ni(t isinstanceR tFalseR!R"RC(R#RB((s//usr/lib64/python2.7/site-packages/dns/rdata.pyt__eq__Õs cCsNt|tƒstS|j|jks7|j|jkr;tS|j|ƒdkS(Ni(RDR tTrueR!R"RC(R#RB((s//usr/lib64/python2.7/site-packages/dns/rdata.pyt__ne__Ýs cCsKt|tƒ s4|j|jks4|j|jkr8tS|j|ƒdkS(Ni(RDR R!R"tNotImplementedRC(R#RB((s//usr/lib64/python2.7/site-packages/dns/rdata.pyt__lt__ås cCsKt|tƒ s4|j|jks4|j|jkr8tS|j|ƒdkS(Ni(RDR R!R"RIRC(R#RB((s//usr/lib64/python2.7/site-packages/dns/rdata.pyt__le__ìs cCsKt|tƒ s4|j|jks4|j|jkr8tS|j|ƒdkS(Ni(RDR R!R"RIRC(R#RB((s//usr/lib64/python2.7/site-packages/dns/rdata.pyt__ge__ós cCsKt|tƒ s4|j|jks4|j|jkr8tS|j|ƒdkS(Ni(RDR R!R"RIRC(R#RB((s//usr/lib64/python2.7/site-packages/dns/rdata.pyt__gt__ús cCst|jtjjƒƒS(N(thashR6R%tnametroot(R#((s//usr/lib64/python2.7/site-packages/dns/rdata.pyt__hash__scCsctjƒ}|j|dtjjƒtjƒ}|j|dtjjƒt|jƒ|jƒƒS(N( R2R3R1RR%RORPtcmpR4(R#RBtb1tb2((s//usr/lib64/python2.7/site-packages/dns/rdata.pyt _wire_cmps   cCs t‚dS(sáBuild an rdata object from text format. @param rdclass: The rdata class @type rdclass: int @param rdtype: The rdata type @type rdtype: int @param tok: The tokenizer @type tok: dns.tokenizer.Tokenizer @param origin: The origin to use for relative names @type origin: dns.name.Name @param relativize: should names be relativized? @type relativize: bool @rtype: dns.rdata.Rdata instance N(R*(tclsR!R"ttokR+R,((s//usr/lib64/python2.7/site-packages/dns/rdata.pyR8scCs t‚dS(s;Build an rdata object from wire format @param rdclass: The rdata class @type rdclass: int @param rdtype: The rdata type @type rdtype: int @param wire: The wire-format message @type wire: string @param current: The offet in wire of the beginning of the rdata. @type current: int @param rdlen: The length of the wire-format rdata @type rdlen: int @param origin: The origin to use for relative names @type origin: dns.name.Name @rtype: dns.rdata.Rdata instance N(R*(RVR!R"twiretcurrenttrdlenR+((s//usr/lib64/python2.7/site-packages/dns/rdata.pyt from_wire%scCsdS(sWConvert any domain names in the rdata to the specified relativization. N((R#R+R,((s//usr/lib64/python2.7/site-packages/dns/rdata.pytchoose_relativity;sN(t__name__t __module__t__doc__t __slots__R$R(R)RRGR.R1R6R9R@RARCRFRHRJRKRLRMRQRUR8t classmethodR[R\(((s//usr/lib64/python2.7/site-packages/dns/rdata.pyR s2                 t GenericRdatacBszeZdZdgZd„Zded„Zded„Ze eƒZddd„Z dd„Z e e ƒZ d„Z RS( sžGenerate Rdata Class This class is used for rdata types for which we have no better implementation. It implements the DNS "unknown RRs" scheme. RcCs&tt|ƒj||ƒ||_dS(N(tsuperRbR$R(R#R!R"R((s//usr/lib64/python2.7/site-packages/dns/rdata.pyR$LscKsdt|jƒt|jƒS(Ns\# %d (RRR(R#R+R,R-((s//usr/lib64/python2.7/site-packages/dns/rdata.pyR.Psc CsÖ|jƒ}|jƒ s(|jdkr=tjjdƒ‚n|jƒ}g}x/|jƒ}|jƒrnPn|j|jƒqRdj |ƒ} | j dƒ} t | ƒ|krÆtjjdƒ‚n|||| ƒS(Ns\#s$generic rdata does not start with \#RRs'generic rdata hex data has wrong length( tgett is_identifiertvalueR%t exceptiont SyntaxErrortget_intt is_eol_or_eofRRtdecodeR( RVR!R"RWR+R,ttokentlengthR R R((s//usr/lib64/python2.7/site-packages/dns/rdata.pyR8Ss    cCs|j|jƒdS(N(twriteR(R#R/R0R+((s//usr/lib64/python2.7/site-packages/dns/rdata.pyR1fscCs|||||||!ƒS(N((RVR!R"RXRYRZR+((s//usr/lib64/python2.7/site-packages/dns/rdata.pyR[iscCst|j|jƒS(N(RRR(R#RB((s//usr/lib64/python2.7/site-packages/dns/rdata.pyRCnsN( R]R^R_R`R$RRGR.R8RaR1R[RC(((s//usr/lib64/python2.7/site-packages/dns/rdata.pyRbCs     s dns.rdtypescCs;d„}tj||fƒ}tjj|ƒ}tjj|ƒ}|jddƒ}|stjtjj|fƒ}|sy2|djt ||gƒƒ}|t||fR%t tokenizert TokenizerRRbRdtungetReRfR8R[RR(R!R"RWR+R,RVRlR7((s//usr/lib64/python2.7/site-packages/dns/rdata.pyR8•s      cCs=tjj|ƒ}t||ƒ}|j||||||ƒS(s=Build an rdata object from wire format This function attempts to dynamically load a class which implements the specified rdata class and type. If there is no class-and-type-specific implementation, the GenericRdata class is used. Once a class is chosen, its from_wire() class method is called with the parameters to this function. @param rdclass: The rdata class @type rdclass: int @param rdtype: The rdata type @type rdtype: int @param wire: The wire-format message @type wire: string @param current: The offet in wire of the beginning of the rdata. @type current: int @param rdlen: The length of the wire-format rdata @type rdlen: int @param origin: The origin to use for relative names @type origin: dns.name.Name @rtype: dns.rdata.Rdata instance(R%twiredatat maybe_wrapRR[(R!R"RXRYRZR+RV((s//usr/lib64/python2.7/site-packages/dns/rdata.pyR[Ãs(R_R2t dns.exceptionR%tdns.nametdns.rdataclasst dns.rdatatypet dns.tokenizert dns.wiredataRRRRRRGRRRtobjectR RbRzR{RR8R[(((s//usr/lib64/python2.7/site-packages/dns/rdata.pyts.            Ä. !.