AlkantarClanX12

Your IP : 18.116.43.109


Current Path : /usr/lib64/python2.7/site-packages/dns/
Upload File :
Current File : //usr/lib64/python2.7/site-packages/dns/rdata.pyc

�
�$Nc@sdZddlZddlZddlZddlZddlZddlZddlZdZ	dd�ZdZ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|�}||kr�g}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	tb64RR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�Zd	�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.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"((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<DNS Rs rdata: t>(	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@RBRERGRIRJRKRLRPRTR7tclassmethodRZR[(((s//usr/lib64/python2.7/site-packages/dns/rdata.pyRs2						
										
tGenericRdatacBszeZdZdgZd�Zded�Zded�Ze	e�Zddd�Z
dd�Ze	e�Zd�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-PscCs�|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	exceptiontSyntaxErrortget_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		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(RNtmodt
componentstcomp((s//usr/lib64/python2.7/site-packages/dns/rdata.pyt
import_modulevs
t-t_RntANY(t_rdata_modulesRcR$R<R-R%RRxRt_module_prefixtImportErrorRRqRa(R R!RuRrtrdclass_texttrdtype_textRU((s//usr/lib64/python2.7/site-packages/dns/rdata.pytget_rdata_classts.	

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(RCR=R$t	tokenizert	TokenizerR~RaRctungetRdReR7RZRR(R R!RVR*R+RURkR6((s//usr/lib64/python2.7/site-packages/dns/rdata.pyR7�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_wrapR~RZ(R R!RWRXRYR*RU((s//usr/lib64/python2.7/site-packages/dns/rdata.pyRZ�s(R^R1t
dns.exceptionR$tdns.nametdns.rdataclasst
dns.rdatatypet
dns.tokenizertdns.wiredataRRRRRRFRRRtobjectRRaRyRzR~R7RZ(((s//usr/lib64/python2.7/site-packages/dns/rdata.pyt<module>s.
		�.	!.