AlkantarClanX12

Your IP : 18.118.193.223


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

�
��Sc@s`dZddlZddlZddlZddlZyddlZWnek
reddlZnXddl	Z
ddlZ
ddlZ
ddl
Z
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ddlZ
ejdkrddlZnde
jjfd��YZde
jjfd��YZe
jjZde
jjfd	��YZd
e
jjfd��YZde
jjfd
��YZde
jjfd��YZde
jjfd��YZ de!fd��YZ"de!fd��YZ#de!fd��YZ$de!fd��YZ%de!fd��YZ&e'a(d�Z)e
j*j+e
j,j-e.e'e/dd�Z0e
j,j-e.e'd�Z1iej2gej36ej4gej56Z6e'a7ej8Z9ej:Z;ej<Z=ej>Z?ej@ZAejBZCe'e'ejDdddd �ZEdd!�ZFe'd"�ZGd#�ZHd$�ZId%�ZJe'd&�ZKd'�ZLdS((s{DNS stub resolver.

@var default_resolver: The default resolver object
@type default_resolver: dns.resolver.Resolver objecti����Ntwin32tNXDOMAINcBseZdZRS(sThe query name does not exist.(t__name__t
__module__t__doc__(((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR.stYXDOMAINcBseZdZRS(s4The query name is too long after DNAME substitution.(RRR(((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR2stNoAnswercBseZdZRS(s7The response did not contain an answer to the question.(RRR(((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR<st
NoNameserverscBseZdZRS(s<No non-broken nameservers are available to answer the query.(RRR(((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR@stNotAbsolutecBseZdZRS(sSRaised if an absolute domain name is required but a relative name
    was provided.(RRR(((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyRDst	NoRootSOAcBseZdZRS(sYRaised if for some reason there is no SOA at the root name.
    This should never happen!(RRR(((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR	Ist
NoMetaqueriescBseZdZRS(sMetaqueries are not allowed.(RRR(((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR
NstAnswercBsYeZdZed�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�ZRS(	s9DNS stub resolver answer

    Instances of this class bundle up the result of a successful DNS
    resolution.

    For convenience, the answer object implements much of the sequence
    protocol, forwarding to its rrset.  E.g. "for a in answer" is
    equivalent to "for a in answer.rrset", "answer[i]" is equivalent
    to "answer.rrset[i]", and "answer[i:j]" is equivalent to
    "answer.rrset[i:j]".

    Note that CNAMEs or DNAMEs in the response may mean that answer
    node's name might not be the query name.

    @ivar qname: The query name
    @type qname: dns.name.Name object
    @ivar rdtype: The query type
    @type rdtype: int
    @ivar rdclass: The query class
    @type rdclass: int
    @ivar response: The response message
    @type response: dns.message.Message object
    @ivar rrset: The answer
    @type rrset: dns.rrset.RRset object
    @ivar expiration: The time when the answer expires
    @type expiration: float (seconds since the epoch)
    @ivar canonical_name: The canonical name of the query name
    @type canonical_name: dns.name.Name object
    cCs_||_||_||_||_d}d}x#tdd�D]}yG|j|j|||�}|dks|j|kr�|j}nPWq@t	k
rQ|t
jjkr?yj|j|j||t
jj�}	|dks�|	j|kr�|	j}nx|	D]}
|
j
}PqWw@Wq?t	k
r;|r<t�q<q?Xn|rRt�qRq@Xq@W|dkrq|rqt�n||_||_|dkrHx�yp|j|j||t
jj�}|dks�|j|kr�|j}n|dj|kr|dj}nPWq�t	k
r@y|j�}WqAt
jjk
r<PqAXq�Xq�Wntj�||_dS(Ni����ii(tqnametrdtypetrdclasstresponsetNonetxranget
find_rrsettanswertttltKeyErrortdnst	rdatatypetCNAMEttargetRtcanonical_nametrrsett	authoritytSOAtminimumtparenttnametNoParentttimet
expiration(tselfRR
RRtraise_on_no_answertmin_ttlRtcounttcrrsettrdtsrrset((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt__init__qsf				

	
			
cCs~|dkr|jjS|dkr,|jjS|dkrB|jjS|dkrX|jjS|dkrn|jjSt|��dS(NR RtcoversRR
(RR RR,RR
tAttributeError(R$tattr((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt__getattr__�s




cCs
t|j�S(N(tlenR(R$((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt__len__�scCs
t|j�S(N(titerR(R$((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt__iter__�scCs|j|S(N(R(R$ti((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt__getitem__�scCs|j|=dS(N(R(R$R4((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt__delitem__�scCs|j||!S(N(R(R$R4tj((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt__getslice__�scCs|j||5dS(N(R(R$R4R7((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt__delslice__�s(RRRtTrueR+R/R1R3R5R6R8R9(((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyRSs7						tCachecBsAeZdZdd�Zd�Zd�Zd�Zdd�ZRS(sqSimple DNS answer cache.

    @ivar data: A dictionary of cached data
    @type data: dict
    @ivar cleaning_interval: The number of seconds between cleanings.  The
    default is 300 (5 minutes).
    @type cleaning_interval: float
    @ivar next_cleaning: The time the cache should next be cleaned (in seconds
    since the epoch.)
    @type next_cleaning: float
    g�r@cCs;i|_||_tj�|j|_tj�|_dS(s�Initialize a DNS cache.

        @param cleaning_interval: the number of seconds between periodic
        cleanings.  The default is 300.0
        @type cleaning_interval: float.
        N(tdatatcleaning_intervalR"t
next_cleaningt
_threadingtLocktlock(R$R=((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR+�s		cCs�tj�}|j|kr�g}x<|jj�D]+\}}|j|kr1|j|�q1q1Wx|D]}|j|=qgWtj�}||j|_ndS(s&Clean the cache if it's time to do so.N(R"R>R<t	iteritemsR#tappendR=(R$tnowtkeys_to_deletetktv((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt_maybe_clean�s
cCskzV|jj�|j�|jj|�}|dksM|jtj�krQdS|SWd|jj�XdS(s)Get the answer associated with I{key}.  Returns None if
        no answer is cached for the key.
        @param key: the key
        @type key: (dns.name.Name, int, int) tuple whose values are the
        query name, rdtype, and rdclass.
        @rtype: dns.resolver.Answer object or None
        N(	RAtacquireRHR<tgetRR#R"trelease(R$tkeyRG((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyRJ�s	

!cCs=z(|jj�|j�||j|<Wd|jj�XdS(sAssociate key and value in the cache.
        @param key: the key
        @type key: (dns.name.Name, int, int) tuple whose values are the
        query name, rdtype, and rdclass.
        @param value: The answer being cached
        @type value: dns.resolver.Answer object
        N(RARIRHR<RK(R$RLtvalue((s2/usr/lib64/python2.7/site-packages/dns/resolver.pytputs
	

cCssz^|jj�|dk	r>|jj|�r]|j|=q]ni|_tj�|j|_Wd|jj�XdS(s�Flush the cache.

        If I{key} is specified, only that item is flushed.  Otherwise
        the entire cache is flushed.

        @param key: the key to flush
        @type key: (dns.name.Name, int, int) tuple or None
        N(	RARIRR<thas_keyR"R=R>RK(R$RL((s2/usr/lib64/python2.7/site-packages/dns/resolver.pytflushs

	N(	RRRR+RHRJRNRRP(((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR;�s
			tLRUCacheNodecBs2eZdZd�Zd�Zd�Zd�ZRS(sLRUCache node.
    cCs(||_||_||_||_dS(N(RLRMtprevtnext(R$RLRM((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR+,s			cCs.|j|_||_||j_||_dS(N(RRRS(R$tnode((s2/usr/lib64/python2.7/site-packages/dns/resolver.pytlink_before2s	cCs.||_|j|_||j_||_dS(N(RRRS(R$RT((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt
link_after8s	cCs"|j|j_|j|j_dS(N(RRRS(R$((s2/usr/lib64/python2.7/site-packages/dns/resolver.pytunlink>s(RRRR+RURVRW(((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyRQ)s
			tLRUCachecBsAeZdZdd�Zd�Zd�Zd�Zdd�ZRS(sOBounded least-recently-used DNS answer cache.

    This cache is better than the simple cache (above) if you're
    running a web crawler or other process that does a lot of
    resolutions.  The LRUCache has a maximum number of nodes, and when
    it is full, the least-recently used node is removed to make space
    for a new one.

    @ivar data: A dictionary of cached data
    @type data: dict
    @ivar sentinel: sentinel node for circular doubly linked list of nodes
    @type sentinel: LRUCacheNode object
    @ivar max_size: The maximum number of nodes
    @type max_size: int
    i��cCs;i|_|j|�tdd�|_tj�|_dS(s�Initialize a DNS cache.

        @param max_size: The maximum number of nodes to cache; the default is 100000.  Must be > 1.
        @type max_size: int
        N(R<tset_max_sizeRQRtsentinelR?R@RA(R$tmax_size((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR+Ss	
cCs"|dkrd}n||_dS(Ni(R[(R$R[((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyRY^s	cCs�z}|jj�|jj|�}|dkr2dS|j�|jjtj�kre|j|j	=dS|j
|j�|jSWd|jj�XdS(s)Get the answer associated with I{key}.  Returns None if
        no answer is cached for the key.
        @param key: the key
        @type key: (dns.name.Name, int, int) tuple whose values are the
        query name, rdtype, and rdclass.
        @rtype: dns.resolver.Answer object or None
        N(
RARIR<RJRRWRMR#R"RLRVRZRK(R$RLRT((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyRJcs


cCs�z�|jj�|jj|�}|dk	rH|j�|j|j=nx?t|j�|jkr�|j	j
}|j�|j|j=qKWt||�}|j|j	�||j|<Wd|jj
�XdS(sAssociate key and value in the cache.
        @param key: the key
        @type key: (dns.name.Name, int, int) tuple whose values are the
        query name, rdtype, and rdclass.
        @param value: The answer being cached
        @type value: dns.resolver.Answer object
        N(RARIR<RJRRWRLR0R[RZRRRQRVRK(R$RLRMRT((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyRN{s


cCs�z�|jj�|dk	rW|jj|�}|dk	r�|j�|j|j=q�nL|jj}x4||jkr�|j}d|_	d|_|}qfWi|_Wd|jj
�XdS(s�Flush the cache.

        If I{key} is specified, only that item is flushed.  Otherwise
        the entire cache is flushed.

        @param key: the key to flush
        @type key: (dns.name.Name, int, int) tuple or None
        N(RARIRR<RJRWRLRZRSRRRK(R$RLRTRS((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyRP�s	

			

N(	RRRR+RYRJRNRRP(((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyRXBs			tResolvercBs�eZdZded�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zejjejjeded
d�Zdejjd�Zd�Zd�ZRS(s)DNS stub resolver

    @ivar domain: The domain of this host
    @type domain: dns.name.Name object
    @ivar nameservers: A list of nameservers to query.  Each nameserver is
    a string which contains the IP address of a nameserver.
    @type nameservers: list of strings
    @ivar search: The search list.  If the query name is a relative name,
    the resolver will construct an absolute query name by appending the search
    names one by one to the query name.
    @type search: list of dns.name.Name objects
    @ivar port: The port to which to send queries.  The default is 53.
    @type port: int
    @ivar timeout: The number of seconds to wait for a response from a
    server, before timing out.
    @type timeout: float
    @ivar lifetime: The total number of seconds to spend trying to get an
    answer to the question.  If the lifetime expires, a Timeout exception
    will occur.
    @type lifetime: float
    @ivar keyring: The TSIG keyring to use.  The default is None.
    @type keyring: dict
    @ivar keyname: The TSIG keyname to use.  The default is None.
    @type keyname: dns.name.Name object
    @ivar keyalgorithm: The TSIG key algorithm to use.  The default is
    dns.tsig.default_algorithm.
    @type keyalgorithm: string
    @ivar edns: The EDNS level to use.  The default is -1, no Edns.
    @type edns: int
    @ivar ednsflags: The EDNS flags
    @type ednsflags: int
    @ivar payload: The EDNS payload size.  The default is 0.
    @type payload: int
    @ivar flags: The message flags to use.  The default is None (i.e. not overwritten)
    @type flags: int
    @ivar cache: The cache to use.  The default is None.
    @type cache: dns.resolver.Cache object
    @ivar retry_servfail: should we retry a nameserver if it says SERVFAIL?
    The default is 'false'.
    @type retry_servfail: bool
    s/etc/resolv.confcCsI|j�|rEtjdkr,|j�qE|rE|j|�qEndS(sJInitialize a resolver instance.

        @param filename: The filename of a configuration file in
        standard /etc/resolv.conf format.  This parameter is meaningful
        only when I{configure} is true and the platform is POSIX.
        @type filename: string or file object
        @param configure: If True (the default), the resolver instance
        is configured in the normal fashion for the operating system
        the resolver is running on.  (I.e. a /etc/resolv.conf file on
        POSIX systems and from the registry on Windows systems.)
        @type configure: boolRN(tresettsystplatformt
read_registrytread_resolv_conf(R$tfilenamet	configure((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR+�s

cCs�tjjtjjtj��d�|_t|j�dkrRtjj|_ng|_	g|_
d|_d|_d|_
d|_d|_tjj|_d|_d|_d|_d|_d|_t|_t|_dS(s1Reset all resolver configuration to the defaults.iii5g@g>@i����N(RR tNamet	from_texttsockettgethostnametdomainR0troottnameserverstsearchtportttimeouttlifetimeRtkeyringtkeynamettsigtdefault_algorithmtkeyalgorithmtednst	ednsflagstpayloadtcachetflagstFalsetretry_servfailtrotate(R$((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR]�s$+													cCs�t|t�st|t�r[yt|d�}Wntk
rQdg|_dSXt}nt}z7x0|D](}t|�dksk|ddksk|ddkr�qkn|j	�}t|�dkr�qkn|ddkr�|jj
|d�qk|dd	kr tjj
|d�|_qk|dd
krdx`|dD]"}|jj
tjj
|��q;Wqk|ddkrkd|dkr�t|_q�qkqkWWd|r�|j�nXt|j�dkr�|jj
d�ndS(
s�Process f as a file in the /etc/resolv.conf format.  If f is
        a string, it is used as the name of the file to open; otherwise it
        is treated as the file itself.trs	127.0.0.1Nit#t;t
nameserveriRhRktoptionsR{(t
isinstancetstrtunicodetopentIOErrorRjR:RyR0tsplitRCRR ReRhRkR{tclose(R$tft
want_closetlttokenstsuffix((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyRas:
	
2#cCsF|jd�dkrd}n$|jd�dkr<d}nd}|S(Nt it,(tfind(R$tentryt
split_char((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt_determine_split_char(s		cCsat|�}|j|�}|j|�}x0|D](}||jkr1|jj|�q1q1WdS(s&Configure a NameServer registry entry.N(R�R�R�RjRC(R$RjR�tns_listtns((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt_config_win32_nameservers7s
cCstjjt|��|_dS(s"Configure a Domain registry entry.N(RR ReR�Rh(R$Rh((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt_config_win32_domainAscCsmt|�}|j|�}|j|�}x<|D]4}||jkr1|jjtjj|��q1q1WdS(s"Configure a Search registry entry.N(R�R�R�RkRCRR Re(R$RkR�tsearch_listts((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt_config_win32_searchFs
cCstytj|d�\}}Wntk
r5d}nX|r�|j|�y2tj|d�\}}|rz|j|�nWq$tk
r�q$Xn�ytj|d�\}}Wntk
r�d}nX|r$|j|�y2tj|d�\}}|r|j|�nWq$tk
r q$Xnytj|d�\}}Wntk
rYd}nX|rp|j|�ndS(s%Extract DNS info from a registry key.t
NameServertDomaintDhcpNameServert
DhcpDomaint
SearchListN(t_winregtQueryValueExtWindowsErrorRR�R�R�(R$RLtserverstrtypetdomRk((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt_config_win32_fromkeyPs<









cCsStjdtj�}t}z&ytj|d�}t}Wn#tk
r_tj|d�}nXz|j|�Wd|j	�X|r@tj|d�}z�d}x�tr-yltj
||�}|d7}tj||�}|j|||�s�w�nz|j|�Wd|j	�XWq�tk
r)Pq�Xq�WWd|j	�XnWd|j	�XdS(s9Extract resolver configuration from the Windows registry.s2SYSTEM\CurrentControlSet\Services\Tcpip\Parameterss+SYSTEM\CurrentControlSet\Services\VxD\MSTCPNs=SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfacesii(R�tConnectRegistryRtHKEY_LOCAL_MACHINERytOpenKeyR:tEnvironmentErrorR�tClosetEnumKeyt_win32_is_nic_enabled(R$tlmt	want_scant
tcp_paramst
interfacesR4tguidRL((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR`rs@		

	
			


c
Csy�tj|d|�}z�tj|d�\}}|tjkrLt�ntj|d|�}z=tj|d�\}}|tjkr�t�n|d@SWd|j�XWd|j�XWnRttfk
ry&tj|d�\}	}|	dk	SWqt	k
r
t
SXnXdS(Ns]SYSTEM\CurrentControlSet\Control\Network\{4D36E972-E325-11CE-BFC1-08002BE10318}\%s\Connectiont
PnpInstanceIDs SYSTEM\CurrentControlSet\Enum\%stConfigFlagsitNTEContextList(R�R�R�tREG_SZt
ValueErrort	REG_DWORDR�R�RR�Ry(
R$R�R�t
interface_keytconnection_keytpnp_idtttypet
device_keyRxtnte((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR��s6
		
	
cCsstj�}||kr:||dkr1t�q:|}n||}||jkr\t�nt|j||j�S(Ni(R"tTimeoutRntminRm(R$tstartRDtduration((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt_compute_timeout�s		
	icCsut|ttf�r-tjj|d�}nt|ttf�rWtjj|�}ntjj|�rrt	�nt|ttf�r�tj
j|�}ntj
j|�r�t	�ng}|j�r�|j
|�n�t|�dkr
|j
|jtjj��n|jr@xC|jD]}	|j
|j|	��qWn|j
|j|j��t}
tj�}x�|D]�}|jr�|jj|||f�}|dk	r�|jdkr�|r�t�q�|Sq�ntjj|||�}
|jdk	r|
j|j|jd|j�n|
j|j |j!|j"�|j#dk	rS|j#|
_#nd}|j$}|j%r|t&j'|�nd}xt|dkr�t|�dkr�t(�nx�|D]�}|j)|�}y�|r�tj*j+|
|||j,d|d|�}nytj*j-|
|||j,d|d|�}|j#tj#j.@rx|j)|�}tj*j+|
|||j,d|d|�}nWn�t/j0tj1j2fk
r�d}q�nrtj*j3k
r�d}q�nStj1j4k
r�|j5|�d}q�n't6k
r|j5|�d}q�nX|j7�}|tj7j8kr=t8�n|tj7j9ksa|tj7j:krePn|tj7j;ks�|j<r�|j5|�nd}q�W|dk	r�Pnt|�dkr�|j)|�}t=||�}|d9}tj>|�q�q�W|j7�tj7j:krqrnt?}
PqrW|
r1t:�nt@|||||�}|jrq|jjA|||f|�n|S(	sQuery nameservers to find the answer to the question.

        The I{qname}, I{rdtype}, and I{rdclass} parameters may be objects
        of the appropriate type, or strings that can be converted into objects
        of the appropriate type.  E.g. For I{rdtype} the integer 2 and the
        the string 'NS' both mean to query for records with DNS rdata type NS.

        @param qname: the query name
        @type qname: dns.name.Name object or string
        @param rdtype: the query type
        @type rdtype: int or string
        @param rdclass: the query class
        @type rdclass: int or string
        @param tcp: use TCP to make the query (default is False).
        @type tcp: bool
        @param source: bind to this IP address (defaults to machine default IP).
        @type source: IP address in dotted quad notation
        @param raise_on_no_answer: raise NoAnswer if there's no answer
        (defaults is True).
        @type raise_on_no_answer: bool
        @param source_port: The port from which to send the message.
        The default is 0.
        @type source_port: int
        @rtype: dns.resolver.Answer instance
        @raises Timeout: no answers could be found in the specified lifetime
        @raises NXDOMAIN: the query name does not exist
        @raises YXDOMAIN: the query name is too long after DNAME substitution
        @raises NoAnswer: the response did not contain an answer and
        raise_on_no_answer is True.
        @raises NoNameservers: no non-broken nameservers are available to
        answer the question.it	algorithmg�������?itsourcetsource_portiN(BR�R�R�RR ReRRtis_metatypeR
t
rdataclasstis_metaclasstis_absoluteRCR0tconcatenateRiRkRhR:R"RwRJRRtmessaget
make_queryRptuse_tsigRoRstuse_ednsRtRuRvRxRjR{trandomtshuffleRR�tqueryttcpRltudptTCRfterrort	exceptionR�tUnexpectedSourcet	FormErrortremovetEOFErrortrcodeRtNOERRORRtSERVFAILRzR�tsleepRyRRN(R$RR
RR�R�R%R�t
qnames_to_tryR�tall_nxdomainR�RtrequestRRjtbackoffRRmR�t
sleep_time((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR��s�"			
		


			


	

			cCsD||_|dkr.|jj�d|_n	||_||_dS(s�Add a TSIG signature to the query.

        @param keyring: The TSIG keyring to use; defaults to None.
        @type keyring: dict
        @param keyname: The name of the TSIG key to use; defaults to None.
        The key must be defined in the keyring.  If a keyring is specified
        but a keyname is not, then the key used will be the first key in the
        keyring.  Note that the order of keys in a dictionary is not defined,
        so applications should supply a keyname when a keyring is used, unless
        they know the keyring contains only one key.
        @param algorithm: The TSIG key algorithm to use.  The default
        is dns.tsig.default_algorithm.
        @type algorithm: stringiN(RoRtkeysRpRs(R$RoRpR�((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR��s
		cCs4|dkrd}n||_||_||_dS(sConfigure Edns.

        @param edns: The EDNS level to use.  The default is -1, no Edns.
        @type edns: int
        @param ednsflags: The EDNS flags
        @type ednsflags: int
        @param payload: The EDNS payload size.  The default is 0.
        @type payload: inti����N(RRtRuRv(R$RtRuRv((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR��s

			cCs
||_dS(s�Overrides the default flags with your own

        @param flags: The flags to overwrite the default with
        @type flags: intN(Rx(R$Rx((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt	set_flags�sN(RRRR:R+R]RaR�R�R�R�R�R`R�R�RRtAR�tINRyRR�RqRrR�R�R�(((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR\�s$)		&		
		
	"	-	7	�	cCstdkrt�antS(s7Get the default resolver, initializing it if necessary.N(tdefault_resolverRR\(((s2/usr/lib64/python2.7/site-packages/dns/resolver.pytget_default_resolver�sicCs"t�j|||||||�S(s�Query nameservers to find the answer to the question.

    This is a convenience function that uses the default resolver
    object to make the query.
    @see: L{dns.resolver.Resolver.query} for more information on the
    parameters.(R�R�(RR
RR�R�R%R�((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR��s	cCs�t|ttf�r3tjj|tjj�}n|dkrKt�}n|j	�sft
|��nx�y8|j|tjj
||�}|jj|kr�|SWn#tjjtjjfk
r�nXy|j�}Wqitjjk
r�t�qiXqiWdS(s�Find the name of the zone which contains the specified name.

    @param name: the query name
    @type name: absolute dns.name.Name object or string
    @param rdclass: The query class
    @type rdclass: int
    @param tcp: use TCP to make the query (default is False).
    @type tcp: bool
    @param resolver: the resolver to use
    @type resolver: dns.resolver.Resolver object or None
    @rtype: dns.name.NameN(R�R�R�RR ReRiRR�R�RR�RRRtresolverRRRR!R	(R RR�R�R((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt
zone_for_name�s"
cCs�|tjtjB@dkr#t�n|dkrP|dkrPtjtj��ng}g}d}y�|dkr�d}|tj@dkr�|jd�|jd�q|jd�|jd�nY|j	d�}	t
|	�dkr�|	d}
n|}
tjj
|
�}|j|�|}Wn�y)tjj
|�}|j|�|}Wq�|tj@dkr�y*d}|tjks�|tjkr�tj|tjjd	t�}
|
j}|
jjt�}|
jdk	r�x$|
jD]}|j|j�q�Wq�n|tjks|tjkr�tj|tjjd	t�}|j}|jjt�}|jdk	r�x$|jD]}|j|j�qoWq�nWq�tjj k
r�tjtj��q�tjtj!��q�Xq�q�XnXd}y%|dkr�d}nt"|�}Wn:|tj#@dkrGytj$|�}WqCqCXqGnX|dkrhtjtj��ng}|dkr�tj%tj&g}n	|g}|tj'@dkr�|}nd
}|tjks�|tjkr=xb|D]W}xN|D]F}x=t(|D]1}|jtj|||||ddff�q�Wq�Wq�Wn|tjks[|tjkr�x\|D]Q}xH|D]@}x7t(|D]+}|jtj|||||ff�q�WqoWqbWnt
|�dkr�tjtj��n|S(Nit	localhosts::s0.0.0.0s::1s	127.0.0.1t%iR%t()Rft
AI_ADDRCONFIGtAI_V4MAPPEDtNotImplementedErrorRtgaierrort
EAI_NONAMEt
AI_PASSIVERCR�R0Rtipv6t	inet_atontipv4tAI_NUMERICHOSTtAF_INET6t	AF_UNSPECt	_resolverR�RtAAAARyRRtto_textR:RtaddresstAF_INETR�R�Rt
EAI_SYSTEMtinttAI_NUMERICSERVt
getservbynamet
SOCK_DGRAMtSOCK_STREAMtAI_CANONNAMEt_protocols_for_socktype(thosttservicetfamilytsocktypetprotoRxtv6addrstv4addrsRtpartstahosttaddrRtv6trdatatv4Rlttuplest	socktypestcname((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt_getaddrinfo	s�	






				!			

(

"c
Cs�|d}|d}t|�dkr<|d}tj}nd}tj}t|||tjtjd�}t|�dkr�tjd��n|ddd}|tj	@r�d}nd}t
jj|�}	|tj
@dkr�y/tj|	d�}
|
jdjjt�}Wq�t
jjt
jjfk
r�|tj@rVtjtj��n|}|dk	r�|d	t|�7}q�q�Xn)|}|dk	r�|d	t|�7}n|tj@r�t|�}ntj||�}||fS(
Niiiis'sockaddr resolved to multiple addressesR�R�tPTRR�(R0RfR�RR�RRtSOL_TCPR�tNI_DGRAMRtreversenametfrom_addresstNI_NUMERICHOSTR�R�RRR�R:R�RRtNI_NAMEREQDR�R�R�tNI_NUMERICSERVt
getservbyport(
tsockaddrRxRRltscopeR
RRtpnameRRthostnameR	((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt_getnameinfomsB


	
	

cCs:|dkrtj�}ntt|d�dd�dS(NiPii(RRfRgR&R(R ((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt_getfqdn�scCst|�ddS(Nii(t_gethostbyname_ex(R ((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt_gethostbyname�scCstg}g}t|dtjtjtjtj�}|dd}x#|D]}|j|dd�qHW|||fS(Niii(RRfR�RRRRC(R taliasest	addressesRt	canonicaltitem((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyR(�s
cCs�y1tjj|�}|dddf}tj}Wn|df}tj}nXt|tj�\}}g}g}t|d|tj	tj
tj�}|dd}	x#|D]}
|j|
dd�q�W|	||fS(NiPiii(
RR�R�RfR�R�R&RRRRRRC(tipRR"R
R RlR*R+RR,R-((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt_gethostbyaddr�s 


cCsX|dkrt�}n|att_tt_tt_	t
t_tt_
tt_dS(s�Override the system resolver routines in the socket module with
    versions which use dnspython's resolver.

    This can be useful in testing situations where you want to control
    the resolution behavior of python code without having to change
    the system's resolver settings (e.g. /etc/resolv.conf).

    The resolver to use may be specified; if it's not, the default
    resolver will be used.

    @param resolver: the resolver to use
    @type resolver: dns.resolver.Resolver object or None
    N(RR�R�RRftgetaddrinfoR&tgetnameinfoR'tgetfqdnR)t
gethostbynameR(tgethostbyname_exR/t
gethostbyaddr(R�((s2/usr/lib64/python2.7/site-packages/dns/resolver.pytoverride_system_resolver�s					cCs@datt_tt_tt_t	t_
tt_t
t_dS(s4Undo the effects of override_system_resolver().
    N(RR�t_original_getaddrinfoRfR0t_original_getnameinfoR1t_original_getfqdnR2t_original_gethostbynameR3t_original_gethostbyname_exR4t_original_gethostbyaddrR5(((s2/usr/lib64/python2.7/site-packages/dns/resolver.pytrestore_system_resolver�s					(MRRfR^R"R�t	threadingR?tImportErrortdummy_threadingt
dns.exceptionRt	dns.flagstdns.ipv4tdns.ipv6tdns.messagetdns.namet	dns.queryt	dns.rcodetdns.rdataclasst
dns.rdatatypetdns.reversenameR_R�R�tDNSExceptionRRR�RRRR	R
tobjectRR;RQRXR\RR�R�RR�R�R�RyR:R�R�tSOL_UDPRRRRR�R0R7R1R8R2R9R3R:R4R;R5R<R�RR&R'R)R(R/R6R=(((s2/usr/lib64/python2.7/site-packages/dns/resolver.pyt<module>sz
v`l��		
%						c'