Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
idna / lib / python2.7 / site-packages / eventlet / support / dns / rdata.pyc
Size: Mime:
ó
 ‹EYc@s4dZddlmZddlZddlZddlZddlZddlZddl	Zddl
ZddlZddlm
Z
mZmZdZed„ZdZed„Zed	ƒZd
„Zd„Zdefd
„ƒYZdefd„ƒYZiZdZd„Zded„Z dd„Z!dS(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ÿÿÿÿ(tBytesIONi(txrangetstring_typest	text_typei cCsRtj|ƒ}djgtdt|ƒ|ƒD]}||||!^q.ƒjƒ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 i(tbinasciithexlifytjointrangetlentdecode(tdatat	chunksizetlineti((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pyt_hexify+s
	cCsRtj|ƒ}djgtdt|ƒ|ƒD]}||||!^q.ƒjƒ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
    Ri(tbase64t	b64encodeRRR	R
(RRR
R((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pyt
_base64ify=s	s"\cCs³t|tƒr|jƒ}nt|tƒs<t|ƒ}nd}xj|D]b}|tkrr|dt|ƒ7}qI|dkr|dkr|t|ƒ7}qI|d|7}qIW|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
    ts\i is\%03d(t
isinstanceRtencodet	bytearrayt	__escapedtchr(tqstringttexttc((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pyt	_escapifyOs	
cCsQxCtt|ƒdddƒD]%}||dkr|d|d!SqW|dd!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ÿÿÿÿi(RR	(twhatR((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pyt_truncate_bitmaphs	#tRdatacBsøeZdZddgZd„Zd„Zd„Zded„Z	ddd„Z
dd„Zd	„Zd
„Z
d„Zd„Zd
„Zd„Zd„Zd„Zd„Zd„Zd„Zeded„ƒZedd„ƒ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!((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/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"((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pytcovers‰s	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"((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pytextended_rdatatype”scKs
t‚dS(s@Convert an rdata to text format.
        @rtype: string
        N(tNotImplementedError(R"torigint
relativizetkw((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pytto_textscCs
t‚dS(s@Convert an rdata to wire format.
        @rtype: string
        N(R)(R"tfiletcompressR*((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pytto_wire£scCs&tƒ}|j|d|ƒ|jƒS(slConvert rdata to a format suitable for digesting in hashes.  This
        is also the DNSSEC canonical form.N(RR0tNonetgetvalue(R"R*tf((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/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"((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pytvalidate±scCs…|jƒ}|tjjkr'd}ndtjj|ƒd}dtjj|jƒdtjj|jƒ|dt|ƒdS(NRt(t)s<DNS Rs rdata: t>(	R'R$R%R&R-t
rdataclassR R!tstr(R"R'tctext((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pyt__repr__¹s
	cCs
|jƒS(N(R-(R"((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pyt__str__ÃscCsN|jtjjƒ}|jtjjƒ}||kr:dS||krJdSdS(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.
        iiiÿÿÿÿ(R4R$tnametroot(R"tothertourttheir((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pyt_cmpÆscCsNt|tƒstS|j|jks7|j|jkr;tS|j|ƒdkS(Ni(RRtFalseR R!RE(R"RB((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pyt__eq__Ôs
$cCsNt|tƒstS|j|jks7|j|jkr;tS|j|ƒdkS(Ni(RRtTrueR R!RE(R"RB((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pyt__ne__Ûs
$cCsKt|tƒs4|j|jks4|j|jkr8tS|j|ƒdkS(Ni(RRR R!tNotImplementedRE(R"RB((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pyt__lt__âs$cCsKt|tƒs4|j|jks4|j|jkr8tS|j|ƒdkS(Ni(RRR R!RJRE(R"RB((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pyt__le__és$cCsKt|tƒs4|j|jks4|j|jkr8tS|j|ƒdkS(Ni(RRR R!RJRE(R"RB((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pyt__ge__ïs$cCsKt|tƒs4|j|jks4|j|jkr8tS|j|ƒdkS(Ni(RRR R!RJRE(R"RB((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pyt__gt__õs$cCst|jtjjƒƒS(N(thashR4R$R@RA(R"((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pyt__hash__ûscCs
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+((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pyR6þscCs
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 offset 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)(RQR R!twiretcurrenttrdlenR*((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pyt	from_wirescCsdS(sWConvert any domain names in the rdata to the specified
        relativization.
        N((R"R*R+((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pytchoose_relativity&sN(t__name__t
__module__t__doc__t	__slots__R#R'R(R1RHR-R0R4R7R>R?RERGRIRKRLRMRNRPtclassmethodR6RVRW(((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pyRws0						
									tGenericRdatacBseeZdZdgZd„Zded„Zeded„ƒZ	ddd„Z
edd„ƒZRS(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(tsuperR]R#R(R"R R!R((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pyR#8scKsdt|jƒt|jƒS(Ns\# %d (R	RR(R"R*R+R,((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pyR-<scCsÝ|jƒ}|jƒs(|jdkr=tjjdƒ‚n|jƒ}g}x6|jƒ}|jƒrnPn|j|jj	ƒƒqRWdj
|ƒ}	tj|	ƒ}
t
|
ƒ|krÍtjjdƒ‚n||||
ƒS(Ns\#s$generic rdata does not start with \#Rs'generic rdata hex data has wrong length(tgett
is_identifiertvalueR$t	exceptiontSyntaxErrortget_intt
is_eol_or_eoftappendRRRt	unhexlifyR	(RQR R!RRR*R+ttokentlengthtchunksthexR((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pyR6?s"		cCs|j|jƒdS(N(twriteR(R"R.R/R*((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pyR0SscCs|||||||!ƒS(N((RQR R!RSRTRUR*((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pyRVVsN(RXRYRZR[R#R1RHR-R\R6R0RV(((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pyR].s		sdns.rdtypescCs;d„}tj||fƒ}tjj|ƒ}tjj|ƒ}|jddƒ}|stjtjj|fƒ}|sy2|djt	||gƒƒ}|t||f<Wqt
k
ry8|djt	d|gƒƒ}|ttjj|f<Wqt
k
rd}qXqXqn|r1t||ƒ}nt
}|S(NcSsCt|ƒ}|jdƒ}x!|dD]}t||ƒ}q&W|S(Nt.i(t
__import__tsplittgetattr(R@tmodt
componentstcomp((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pyt
import_module`s
t-t_RmtANY(t_rdata_modulesR_R$R;R-R%treplaceRwRt_module_prefixtImportErrorR1RpR](R R!RtRqtrdclass_texttrdtype_textRQ((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pytget_rdata_class^s.	

cCsÏt|tƒr$tjj|ƒ}nt||ƒ}|tkr¶|jƒ}|j|ƒ|j	ƒr¶|j
dkr¶tj|||||ƒ}t|||j
dt|j
ƒ|ƒSn|j|||||ƒS(sdBuild an rdata object from text 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_text() class method is called
    with the parameters to this function.

    If I{tok} is a string, then a tokenizer is created and the string
    is used as its input.

    @param rdclass: The rdata class
    @type rdclass: int
    @param rdtype: The rdata type
    @type rdtype: int
    @param tok: The tokenizer or input text
    @type tok: dns.tokenizer.Tokenizer or string
    @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 instances\#i(RRR$t	tokenizert	TokenizerR~R]R_tungetR`RaR6RVRR	(R R!RRR*R+RQRhR5((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pyR6€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 offset 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_wrapR~RV(R R!RSRTRUR*RQ((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pyRV¯s("RZtioRRRt
dns.exceptionR$tdns.nametdns.rdataclasst
dns.rdatatypet
dns.tokenizertdns.wiredatat_compatRRRt_hex_chunksizeRt_base64_chunksizeRRRRRtobjectRR]RxRzR~R1RHR6RV(((sO/home/tvault/.virtenv/lib/python2.7/site-packages/eventlet/support/dns/rdata.pyt<module>s0		·,	"/