ó ®$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ÿÿÿÿsRi(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 cStringIOtStringIOR0Rtgetvalue(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 isinstanceRtFalseR R!RB(R"RA((s//usr/lib64/python2.7/site-packages/dns/rdata.pyt__eq__Õs cCsNt|tƒstS|j|jks7|j|jkr;tS|j|ƒdkS(Ni(RCRtTrueR R!RB(R"RA((s//usr/lib64/python2.7/site-packages/dns/rdata.pyt__ne__Ýs cCsKt|tƒ s4|j|jks4|j|jkr8tS|j|ƒdkS(Ni(RCRR R!tNotImplementedRB(R"RA((s//usr/lib64/python2.7/site-packages/dns/rdata.pyt__lt__ås cCsKt|tƒ s4|j|jks4|j|jkr8tS|j|ƒdkS(Ni(RCRR R!RHRB(R"RA((s//usr/lib64/python2.7/site-packages/dns/rdata.pyt__le__ìs cCsKt|tƒ s4|j|jks4|j|jkr8tS|j|ƒdkS(Ni(RCRR R!RHRB(R"RA((s//usr/lib64/python2.7/site-packages/dns/rdata.pyt__ge__ós cCsKt|tƒ s4|j|jks4|j|jkr8tS|j|ƒdkS(Ni(RCRR R!RHRB(R"RA((s//usr/lib64/python2.7/site-packages/dns/rdata.pyt__gt__ús cCst|jtjjƒƒS(N(thashR5R$tnametroot(R"((s//usr/lib64/python2.7/site-packages/dns/rdata.pyt__hash__scCsctjƒ}|j|dtjjƒtjƒ}|j|dtjjƒt|jƒ|jƒƒS(N( R1R2R0RR$RNROtcmpR3(R"RAtb1tb2((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.pyR7scCs 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)(RUR 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(RRFR-R0R5R8R?R@RBRERGRIRJRKRLRPRTR7t classmethodRZR[(((s//usr/lib64/python2.7/site-packages/dns/rdata.pyRs2                 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(tsuperRaR#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}x0|jƒ}|jƒrnPn|j|jƒqRWdj |ƒ} | 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( RUR R!RVR*R+ttokentlengthR R R((s//usr/lib64/python2.7/site-packages/dns/rdata.pyR7Ss    cCs|j|jƒdS(N(twriteR(R"R.R/R*((s//usr/lib64/python2.7/site-packages/dns/rdata.pyR0fscCs|||||||!ƒS(N((RUR R!RWRXRYR*((s//usr/lib64/python2.7/site-packages/dns/rdata.pyRZiscCst|j|jƒS(N(RQR(R"RA((s//usr/lib64/python2.7/site-packages/dns/rdata.pyRBnsN( R\R]R^R_R#RRFR-R7R`R0RZRB(((s//usr/lib64/python2.7/site-packages/dns/rdata.pyRaCs     s dns.rdtypescCs;d„}tj||fƒ}tjj|ƒ}tjj|ƒ}|jddƒ}|stjtjj|fƒ}|sy2|djt ||gƒƒ}|t||fs.            Ä. !.