AlkantarClanX12

Your IP : 3.149.23.124


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

�
ť�Sc@s�dZddlmZddlZddlZddlZddlZddlZddlZddl	Z
ddlZ
ddlZ
ddl
Z
ddlZ
ddlZ
de
jjfd��YZde
jjfd��YZd�Zd	�Zd
�Zd�Zd�Zeed
�r#eanead�Zd�Zd�Zd�Zddddde!e!d�Z"d�Z#d�Z$d�Z%ddddde!d�Z&e
j'j(e
j)j*dddde+ddddde!e
j,j-d�Z.dS(sTalk to a DNS server.i����(t
generatorsNtUnexpectedSourcecBseZdZRS(sDRaised if a query response comes from an unexpected address or port.(t__name__t
__module__t__doc__(((s//usr/lib64/python2.7/site-packages/dns/query.pyR"stBadResponsecBseZdZRS(sBRaised if a query response does not respond to the question asked.(RRR(((s//usr/lib64/python2.7/site-packages/dns/query.pyR&scCs"|dkrdStj�|SdS(N(tNonettime(ttimeout((s//usr/lib64/python2.7/site-packages/dns/query.pyt_compute_expiration*scCs�d}|r|tjO}n|r2|tjO}n|rH|tjO}ntj�}|j||�|r�|jt|d��}n|j�}t|�S(sqPoll polling backend.
    @param fd: File descriptor
    @type fd: int
    @param readable: Whether to wait for readability
    @type readable: bool
    @param writable: Whether to wait for writability
    @type writable: bool
    @param timeout: Deadline timeout (expiration time, in seconds)
    @type timeout: float
    @return True on success, False on timeout
    ii�(tselecttPOLLINtPOLLOUTtPOLLERRtpolltregistertlongtbool(tfdtreadabletwritableterrorRt
event_masktpollablet
event_list((s//usr/lib64/python2.7/site-packages/dns/query.pyt	_poll_for0scCs�ggg}}}|r&|g}n|r8|g}n|rJ|g}n|dkrwtj|||�\}}	}
n!tj||||�\}}	}
t|p�|	p�|
�S(ssSelect polling backend.
    @param fd: File descriptor
    @type fd: int
    @param readable: Whether to wait for readability
    @type readable: bool
    @param writable: Whether to wait for writability
    @type writable: bool
    @param timeout: Deadline timeout (expiration time, in seconds)
    @type timeout: float
    @return True on success, False on timeout
    N(RR
R(RRRRRtrsettwsettxsettrcounttwcounttxcount((s//usr/lib64/python2.7/site-packages/dns/query.pyt_select_forNs!!cCs�t}x�|s�|dkr$d}n+|tj�}|dkrOtjj�ny+t|||||�sytjj�nWn5tjk
r�}|j	dt
jkr�|�q�nXt}q	WdS(Ngi(
tFalseRRtdnst	exceptiontTimeoutt_polling_backendR
RtargsterrnotEINTRtTrue(RRRRt
expirationtdoneRte((s//usr/lib64/python2.7/site-packages/dns/query.pyt	_wait_forjs		
cCs
|adS(s#
    Internal API. Do not use.
    N(R%(tfn((s//usr/lib64/python2.7/site-packages/dns/query.pyt_set_polling_backend{sRcCst|ttt|�dS(N(R-R)R!(tsR*((s//usr/lib64/python2.7/site-packages/dns/query.pyt_wait_for_readable�scCst|ttt|�dS(N(R-R!R)(R0R*((s//usr/lib64/python2.7/site-packages/dns/query.pyt_wait_for_writable�scCsPtjj||d�}tjj||d�}||koO|d|dkS(Nii(R"tinett	inet_pton(tafta1ta2tn1tn2((s//usr/lib64/python2.7/site-packages/dns/query.pyt_addresses_equal�scCs|dkr;ytjj|�}Wq;tjj}q;Xn|tjjkr�||f}|dk	sq|dkr|dkr�d}n||f}qni|tjjkr||ddf}|dk	s�|dkr|dkr�d}n||ddf}qn|||fS(Nis0.0.0.0s::(RR"R3taf_for_addresstAF_INETtAF_INET6(R5twheretporttsourcetsource_porttdestination((s//usr/lib64/python2.7/site-packages/dns/query.pyt_destination_and_source�s$		i5ic	Css|j�}	t|||||�\}}
}tj|tjd�}z�t|�}|jd�|dk	r}|j|�nt||�|j	|	|
�x�t
||�|jd�\}	}
t||
|
�s�t
jj|�r�|
d|
dkr�Pn|s�td|
|
f��q�q�WWd|j�Xt
jj|	d|jd|jd|�}|j|�sot�n|S(	s�Return the response obtained after sending a query via UDP.

    @param q: the query
    @type q: dns.message.Message
    @param where: where to send the message
    @type where: string containing an IPv4 or IPv6 address
    @param timeout: The number of seconds to wait before the query times out.
    If None, the default, wait forever.
    @type timeout: float
    @param port: The port to which to send the message.  The default is 53.
    @type port: int
    @param af: the address family to use.  The default is None, which
    causes the address family to use to be inferred from the form of of where.
    If the inference attempt fails, AF_INET is used.
    @type af: int
    @rtype: dns.message.Message object
    @param source: source address.  The default is the wildcard address.
    @type source: string
    @param source_port: The port from which to send the message.
    The default is 0.
    @type source_port: int
    @param ignore_unexpected: If True, ignore responses from unexpected
    sources.  The default is False.
    @type ignore_unexpected: bool
    @param one_rr_per_rrset: Put each RR into its own RRset
    @type one_rr_per_rrset: bool
    ii��is$got a response from %s instead of %sNtkeyringtrequest_mactone_rr_per_rrset(tto_wireRCtsockett
SOCK_DGRAMR	tsetblockingRtbindR2tsendtoR1trecvfromR:R"R3tis_multicastRtclosetmessaget	from_wireRDtmactis_responseR(tqR>RR?R5R@RAtignore_unexpectedRFtwireRBR0R*tfrom_addresstr((s//usr/lib64/python2.7/site-packages/dns/query.pytudp�s8


!		cCshd}x[|dkrct||�|j|�}|dkrFt�n|t|�}||}q	W|S(s�Read the specified number of bytes from sock.  Keep trying until we
    either get the desired amount, or we hit EOF.
    A Timeout exception will be raised if the operation is not completed
    by the expiration time.
    ti(R1trecvtEOFErrortlen(tsocktcountR*R0tn((s//usr/lib64/python2.7/site-packages/dns/query.pyt	_net_read�s
	cCsMd}t|�}x4||krHt||�||j||�7}qWdS(s�Write the specified data to the socket.
    A Timeout exception will be raised if the operation is not completed
    by the expiration time.
    iN(R]R2tsend(R^tdataR*tcurrenttl((s//usr/lib64/python2.7/site-packages/dns/query.pyt
_net_write�s

cCs�y|j|�Wnltjk
rtj�d \}}|dtjkr�|dtjkr�|dtjkr�|�q�nXdS(Nii(	tconnectRHRtsystexc_infoR'tEINPROGRESStEWOULDBLOCKtEALREADY(R0taddressttytv((s//usr/lib64/python2.7/site-packages/dns/query.pyt_connectscCsJ|j�}t|||||�\}}	}tj|tjd�}
z�t|�}|
jd�|dk	r}|
j|�nt|
|	�t	|�}t
jd|�|}
t|
|
|�t
|
d|�}t
jd|�\}t
|
||�}Wd|
j�Xtjj|d|jd|jd|�}|j|�sFt�n|S(sReturn the response obtained after sending a query via TCP.

    @param q: the query
    @type q: dns.message.Message object
    @param where: where to send the message
    @type where: string containing an IPv4 or IPv6 address
    @param timeout: The number of seconds to wait before the query times out.
    If None, the default, wait forever.
    @type timeout: float
    @param port: The port to which to send the message.  The default is 53.
    @type port: int
    @param af: the address family to use.  The default is None, which
    causes the address family to use to be inferred from the form of of where.
    If the inference attempt fails, AF_INET is used.
    @type af: int
    @rtype: dns.message.Message object
    @param source: source address.  The default is the wildcard address.
    @type source: string
    @param source_port: The port from which to send the message.
    The default is 0.
    @type source_port: int
    @param one_rr_per_rrset: Put each RR into its own RRset
    @type one_rr_per_rrset: bool
    is!HiNRDRERF(RGRCRHtSOCK_STREAMR	RJRRKRpR]tstructtpackRfRatunpackROR"RPRQRDRRRSR(RTR>RR?R5R@RARFRVRBR0R*RettcpmsgtldataRX((s//usr/lib64/python2.7/site-packages/dns/query.pyttcps,

!		c&csZt|ttf�r*tjj|�}nt|ttf�rTtjj|�}ntjj|||�}|tjj	kr�tj
j|dddd|
�}|jj|�n|dk	r�|j||d|�n|j�}t|	||||�\}	}}|rG|tjj	kr,td��ntj|	tjd�}ntj|	tjd�}|jd�|dk	r�|j|�nt|
�}t||�t|�}|r�t||�|j|�n&tjd|�|}t|||�t}t }t}d}d}|r/|}tjj!}nd}|}d}t } x|sKt|�}!|!dkst|!|kr}|}!n|r�t"||�|j#d�\}}"n9t$|d	|!�}#tj%d|#�\}t$|||!�}tjj&|d
|j'd|j(dt d
|d|dt d| d|tjj	k�}$|$j)}t} d}%|dkr|$j*sv|$j*dj|kr�tj+j,d��n|$j*d}|j-tjj.kr�tj+j,d��nd}%|j/�}|tjj	kr|dj0|
krt }qt }qnx|$j*|%D]�}|r=tj+j,d��n|j-tjj.kr�|j|kr�|r�|dj0|
kr�tj+j,d��nt}n|tjj	kr�|}n||kr|tjj1ks�|tjj	kr|rt }qq|rtjj1}t}qqW|rC|j'rC|$j2rCtj+j,d��n|$VqJW|j3�dS(s�Return a generator for the responses to a zone transfer.

    @param where: where to send the message
    @type where: string containing an IPv4 or IPv6 address
    @param zone: The name of the zone to transfer
    @type zone: dns.name.Name object or string
    @param rdtype: The type of zone transfer.  The default is
    dns.rdatatype.AXFR.
    @type rdtype: int or string
    @param rdclass: The class of the zone transfer.  The default is
    dns.rdataclass.IN.
    @type rdclass: int or string
    @param timeout: The number of seconds to wait for each response message.
    If None, the default, wait forever.
    @type timeout: float
    @param port: The port to which to send the message.  The default is 53.
    @type port: int
    @param keyring: The TSIG keyring to use
    @type keyring: dict
    @param keyname: The name of the TSIG key to use
    @type keyname: dns.name.Name object or string
    @param relativize: If True, all names in the zone will be relativized to
    the zone origin.  It is essential that the relativize setting matches
    the one specified to dns.zone.from_xfr().
    @type relativize: bool
    @param af: the address family to use.  The default is None, which
    causes the address family to use to be inferred from the form of of where.
    If the inference attempt fails, AF_INET is used.
    @type af: int
    @param lifetime: The total number of seconds to spend doing the transfer.
    If None, the default, then there is no limit on the time the transfer may
    take.
    @type lifetime: float
    @rtype: generator of dns.message.Message objects.
    @param source: source address.  The default is the wildcard address.
    @type source: string
    @param source_port: The port from which to send the message.
    The default is 0.
    @type source_port: int
    @param serial: The SOA serial number to use as the base for an IXFR diff
    sequence (only meaningful if rdtype == dns.rdatatype.IXFR).
    @type serial: int
    @param use_udp: Use UDP (only meaningful for IXFR)
    @type use_udp: bool
    @param keyalgorithm: The TSIG algorithm to use; defaults to
    dns.tsig.default_algorithm
    @type keyalgorithm: string
    itINtSOAs. . %u 0 0 0 0t	algorithmscannot do a UDP AXFRs!Hi��iRDREtxfrtoriginttsig_ctxtmultitfirstRFs No answer or RRset not for qnamesfirst RRset is not an SOAisanswers after final SOAsIXFR base serial mismatchsmissing TSIGN(4t
isinstancetstrtunicodeR"tnamet	from_textt	rdatatypeRPt
make_querytIXFRtrrsett	authoritytappendRtuse_tsigRGRCt
ValueErrorRHRIRqRJRKR	RpR]R2RbRrRsRfR!R)temptyR1RMRaRtRQRDRRR}tanswerR#t	FormErrortrdtypeRytcopytserialtAXFRthad_tsigRO(&R>tzoneR�trdclassRR?RDtkeynamet
relativizeR5tlifetimeR@RAR�tuse_udptkeyalgorithmRTR�RVRBR0R*ReRuR+tdelete_modet
expecting_SOAt	soa_rrsett	soa_countR|tonameR}RtmexpirationRWRvRXtanswer_index((s//usr/lib64/python2.7/site-packages/dns/query.pyR{Hs�5



		
!	 
	$	

	(/Rt
__future__RR'R
RHRrRhRt
dns.exceptionR"tdns.inettdns.nametdns.messagetdns.rdataclasst
dns.rdatatypeR#tDNSExceptionRR�RR	RR R-R/thasattrR%R1R2R:RCRR!RYRaRfRpRwR�R�t
rdataclassRxR)ttsigtdefault_algorithmR{(((s//usr/lib64/python2.7/site-packages/dns/query.pyt<module>sL										;			
7