Edit File: query.pyc
� ť�Sc�����������@���s���d��Z��d�d�l�m�Z�d�d�l�Z�d�d�l�Z�d�d�l�Z�d�d�l�Z�d�d�l�Z�d�d�l�Z�d�d�l �Z �d�d�l�Z �d�d�l�Z �d�d�l �Z �d�d�l�Z �d�d�l�Z �d�e �j�j�f�d�������YZ�d�e �j�j�f�d�������YZ�d����Z�d ����Z�d ����Z�d����Z�d����Z�e�e�d ���r#e�a�n�e�a�d����Z�d����Z�d����Z�d����Z�d�d�d�d�d�e!�e!�d���Z"�d����Z#�d����Z$�d����Z%�d�d�d�d�d�e!�d���Z&�e �j'�j(�e �j)�j*�d�d�d�d�e+�d�d�d�d�d�e!�e �j,�j-�d���Z.�d�S(���s���Talk to a DNS server.i����(���t ���generatorsNt���UnexpectedSourcec�����������B���s���e��Z�d��Z�RS(���sD���Raised 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���"���s���t���BadResponsec�����������B���s���e��Z�d��Z�RS(���sB���Raised if a query response does not respond to the question asked.(���R���R���R���(����(����(����s/���/usr/lib64/python2.7/site-packages/dns/query.pyR���&���s���c���������C���s"���|��d��k�r�d��St�j����|��Sd��S(���N(���t���Nonet���time(���t���timeout(����(����s/���/usr/lib64/python2.7/site-packages/dns/query.pyt���_compute_expiration*���s����c���������C���s����d�}�|�r�|�t��j�O}�n��|�r2�|�t��j�O}�n��|�rH�|�t��j�O}�n��t��j����}�|�j�|��|���|�r��|�j�t�|�d�����}�n�|�j����}�t�|���S(���sq��Poll 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 i����i���(���t���selectt���POLLINt���POLLOUTt���POLLERRt���pollt���registert���longt���bool(���t���fdt���readablet���writablet���errorR���t ���event_maskt���pollablet ���event_list(����(����s/���/usr/lib64/python2.7/site-packages/dns/query.pyt ���_poll_for0���s����c���������C���s����g��g��g��}�}�}�|�r&�|��g�}�n��|�r8�|��g�}�n��|�rJ�|��g�}�n��|�d�k�rw�t�j�|�|�|���\�}�} �} �n!�t�j�|�|�|�|���\�}�} �} �t�|�p��| �p��| ���S(���ss��Select 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(���R���R ���R���(���R���R���R���R���R���t���rsett���wsett���xsett���rcountt���wcountt���xcount(����(����s/���/usr/lib64/python2.7/site-packages/dns/query.pyt���_select_forN���s����!!c���������C���s����t��}�x��|�s��|�d��k�r$�d��}�n+�|�t�j����}�|�d�k�rO�t�j�j���n��y+�t�|��|�|�|�|���sy�t�j�j���n��Wn5�t�j�k �r��}�|�j �d�t �j�k�r��|���q��n�Xt�}�q �Wd��S(���Ng��������i����( ���t���FalseR���R���t���dnst ���exceptiont���Timeoutt���_polling_backendR ���R���t���argst���errnot���EINTRt���True(���R���R���R���R���t ���expirationt���doneR���t���e(����(����s/���/usr/lib64/python2.7/site-packages/dns/query.pyt ���_wait_forj���s���� c���������C���s ���|��a��d�S(���s#��� Internal API. Do not use. N(���R%���(���t���fn(����(����s/���/usr/lib64/python2.7/site-packages/dns/query.pyt���_set_polling_backend{���s����R���c���������C���s���t��|��t�t�t�|���d��S(���N(���R-���R)���R!���(���t���sR*���(����(����s/���/usr/lib64/python2.7/site-packages/dns/query.pyt���_wait_for_readable����s����c���������C���s���t��|��t�t�t�|���d��S(���N(���R-���R!���R)���(���R0���R*���(����(����s/���/usr/lib64/python2.7/site-packages/dns/query.pyt���_wait_for_writable����s����c���������C���sP���t��j�j�|��|�d���}�t��j�j�|��|�d���}�|�|�k�oO�|�d�|�d�k�S(���Ni����i���(���R"���t���inett ���inet_pton(���t���aft���a1t���a2t���n1t���n2(����(����s/���/usr/lib64/python2.7/site-packages/dns/query.pyt���_addresses_equal����s����c���������C���s��|��d��k�r;�y�t�j�j�|���}��Wq;�t�j�j�}��q;�Xn��|��t�j�j�k�r��|�|�f�}�|�d��k �sq�|�d�k�r|�d��k�r��d�}�n��|�|�f�}�qni�|��t�j�j�k�r|�|�d�d�f�}�|�d��k �s��|�d�k�r|�d��k�r��d�}�n��|�|�d�d�f�}�qn��|��|�|�f�S(���Ni����s���0.0.0.0s���::(���R���R"���R3���t���af_for_addresst���AF_INETt���AF_INET6(���R5���t���wheret���portt���sourcet���source_portt���destination(����(����s/���/usr/lib64/python2.7/site-packages/dns/query.pyt���_destination_and_source����s$���� i5���i����c ���������C���ss��|��j�����} �t�|�|�|�|�|���\�}�} �}�t�j�|�t�j�d���}�z��t�|���}�|�j�d���|�d�k �r}�|�j�|���n��t�|�|���|�j �| �| ���x��t �|�|���|�j�d���\�} �} �t�|�| �| ���s��t �j�j�|���r��| �d�| �d�k�r��Pn��|�s��t�d�| �| �f�����q��q��WWd�|�j����Xt �j�j�| �d�|��j�d�|��j�d�|��}�|��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 i����i����i���s$���got a response from %s instead of %sNt���keyringt���request_mact���one_rr_per_rrset(���t���to_wireRC���t���sockett ���SOCK_DGRAMR ���t���setblockingR���t���bindR2���t���sendtoR1���t���recvfromR:���R"���R3���t���is_multicastR���t���closet���messaget ���from_wireRD���t���mact���is_responseR���(���t���qR>���R���R?���R5���R@���RA���t���ignore_unexpectedRF���t���wireRB���R0���R*���t���from_addresst���r(����(����s/���/usr/lib64/python2.7/site-packages/dns/query.pyt���udp����s8���� ! c���������C���sh���d�}�x[�|�d�k�rc�t��|��|���|��j�|���}�|�d�k�rF�t���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. t����i����(���R1���t���recvt���EOFErrort���len(���t���sockt���countR*���R0���t���n(����(����s/���/usr/lib64/python2.7/site-packages/dns/query.pyt ���_net_read����s���� c���������C���sM���d�}�t��|���}�x4�|�|�k��rH�t�|��|���|�|��j�|�|���7}�q�Wd�S(���s����Write the specified data to the socket. A Timeout exception will be raised if the operation is not completed by the expiration time. i����N(���R]���R2���t���send(���R^���t���dataR*���t���currentt���l(����(����s/���/usr/lib64/python2.7/site-packages/dns/query.pyt ���_net_write����s ���� c���������C���s����y�|��j��|���Wnl�t�j�k �r�t�j����d� \�}�}�|�d�t�j�k�r��|�d�t�j�k�r��|�d�t�j�k�r��|���q��n�Xd��S(���Ni���i����( ���t���connectRH���R���t���syst���exc_infoR'���t���EINPROGRESSt���EWOULDBLOCKt���EALREADY(���R0���t���addresst���tyt���v(����(����s/���/usr/lib64/python2.7/site-packages/dns/query.pyt���_connect��s����c���������C���sJ��|��j�����}�t�|�|�|�|�|���\�}�} �}�t�j�|�t�j�d���} �z��t�|���}�| �j�d���|�d�k �r}�| �j�|���n��t�| �| ���t �|���}�t �j�d�|���|�} �t�| �| �|���t �| �d�|���}�t �j�d�|���\�}�t �| �|�|���}�Wd�| �j����Xt�j�j�|�d�|��j�d�|��j�d�|��}�|��j�|���sFt���n��|�S(���s��Return 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 i����s���!Hi���NRD���RE���RF���(���RG���RC���RH���t���SOCK_STREAMR ���RJ���R���RK���Rp���R]���t���structt���packRf���Ra���t���unpackRO���R"���RP���RQ���RD���RR���RS���R���(���RT���R>���R���R?���R5���R@���RA���RF���RV���RB���R0���R*���Re���t���tcpmsgt���ldataRX���(����(����s/���/usr/lib64/python2.7/site-packages/dns/query.pyt���tcp��s,���� ! c���&������c���sZ��t��|�t�t�f���r*�t�j�j�|���}�n��t��|�t�t�f���rT�t�j�j�|���}�n��t�j�j�|�|�|���}�|�t�j�j �k�r��t�j �j�|�d�d�d�d�| ���}�|�j�j�|���n��|�d�k �r��|�j�|�|�d�|��n��|�j����}�t�| �|��|�|�|���\�} �}�}�|�rG|�t�j�j �k�r,t�d�����n��t�j�| �t�j�d���}�n�t�j�| �t�j�d���}�|�j�d���|�d�k �r�|�j�|���n��t�| ���}�t�|�|���t�|���}�|�r�t�|�|���|�j�|���n&�t�j�d�|���|�}�t�|�|�|���t�}�t �}�t�}�d�}�d�}�|�r/|�}�t�j�j!�}�n�d�}�|�}�d�}�t �} �x|�sKt�|���}!�|!�d�k�st|!�|�k�r}|�}!�n��|�r�t"�|�|���|�j#�d���\�}�}"�n9�t$�|�d �|!���}#�t�j%�d�|#���\�}�t$�|�|�|!���}�t�j�j&�|�d �|�j'�d�|�j(�d�t �d �|�d�|�d�t �d�| �d�|�t�j�j �k��}$�|$�j)�}�t�} �d�}%�|�d�k�r|$�j*�sv|$�j*�d�j�|�k�r�t�j+�j,�d�����n��|$�j*�d�}�|�j-�t�j�j.�k�r�t�j+�j,�d�����n��d�}%�|�j/����}�|�t�j�j �k�r|�d�j0�| �k�rt �}�qt �}�qn��x|$�j*�|%�D]��}�|�r=t�j+�j,�d�����n��|�j-�t�j�j.�k�r�|�j�|�k�r�|�r�|�d�j0�| �k�r�t�j+�j,�d�����n��t�}�n�|�t�j�j �k�r�|�}�n��|�|�k�r|�t�j�j1�k�s�|�t�j�j �k�r|�rt �}�qq|�rt�j�j1�}�t�}�qqW|�rC|�j'�rC|$�j2�rCt�j+�j,�d�����n��|$�VqJW|�j3����d�S(���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 i����t���INt���SOAs���. . %u 0 0 0 0t ���algorithms���cannot do a UDP AXFRs���!Hi����i���RD���RE���t���xfrt���origint���tsig_ctxt���multit���firstRF���s ���No answer or RRset not for qnames���first RRset is not an SOAi���s���answers after final SOAs���IXFR base serial mismatchs���missing TSIGN(4���t ���isinstancet���strt���unicodeR"���t���namet ���from_textt ���rdatatypeRP���t ���make_queryt���IXFRt���rrsett ���authorityt���appendR���t���use_tsigRG���RC���t ���ValueErrorRH���RI���Rq���RJ���RK���R ���Rp���R]���R2���Rb���Rr���Rs���Rf���R!���R)���t���emptyR1���RM���Ra���Rt���RQ���RD���RR���R}���t���answerR#���t ���FormErrort���rdtypeRy���t���copyt���serialt���AXFRt���had_tsigRO���(&���R>���t���zoneR����t���rdclassR���R?���RD���t���keynamet ���relativizeR5���t���lifetimeR@���RA���R����t���use_udpt���keyalgorithmRT���R����RV���RB���R0���R*���Re���Ru���R+���t���delete_modet ���expecting_SOAt ���soa_rrsett ���soa_countR|���t���onameR}���R���t���mexpirationRW���Rv���RX���t���answer_index(����(����s/���/usr/lib64/python2.7/site-packages/dns/query.pyR{���H��s�����5 ! $ (/���R���t ���__future__R����R'���R ���RH���Rr���Rh���R���t ���dns.exceptionR"���t���dns.inett���dns.namet���dns.messaget���dns.rdataclasst ���dns.rdatatypeR#���t���DNSExceptionR���R����R���R ���R���R ���R-���R/���t���hasattrR%���R1���R2���R:���RC���R���R!���RY���Ra���Rf���Rp���Rw���R����R����t ���rdataclassRx���R)���t���tsigt���default_algorithmR{���(����(����(����s/���/usr/lib64/python2.7/site-packages/dns/query.pyt���<module>���sL��� ; 7