Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�t�c@swdZdZdZdZddlZddlZddlZddlZddlZddl	Z	ddl
Z
dddgZd	e�d
<dZ
dZd
ZdZdZdZdZdZddZdZdZdZd	ZdZdZdZdZdZdZdZ dZ!dZ"dZ#dZ$d Z%d!Z&d"Z'd#Z(dZ)dZ*dZ+dZ,d Z-d$Z.d%Z/d&Z0d'Z1d(Z2d)Z3d*Z4d+Z5d,Z6d-Z7d.Z8dZ9d/Z:d0Z;d"Z<id1e"6d2e#6d3e$6d4e%6d5e&6d6e'6Z=id7e*6d8e+6d9e,6d:e-6d;e.6d<e/6d=e06d>e16d?e26d@e36dAe46dBe56dCe66dDe76dEe86dFe96dGe:6dHe;6d6e<6Z>dI�Z?dJe@fdK��YZAdLe@fdM��YZBdNe@fdO��YZCdPe@fdQ��YZDdRe@fdS��YZEdTe@fdU��YZFdVeFfdW��YZGdXeHfdY��YZIdZeIfd[��YZJd\eIfd]��YZKd^eKfd_��YZLd`eKfda��YZMdbeKfdc��YZNddeKfde��YZOdfeKfdg��YZPdheHfdi��YZQdjeHfdk��YZRdleHfdm��YZSdnejTfdo��YZUdpeHfdq��YZVdrejTfds��YZWdejTfdt��YZXdeHfdu��YZYdeHfdv��YZZe[dwkrsdxGeGHeZ�Z\dyGHidzd{6d|d76d}d~6Z]eYdd�ej^d��d�d	d	e]�Z_d�GHe\j`e_�d�GHd�GHd�Geae\jbdd���GHd�GHd�GHd�Geae\jbdd���GHd�GHd�GHe\jce_�d�GHe\jd�ndS(�s Multicast DNS Service Discovery for Python, v0.12
    Copyright (C) 2003, Paul Scott-Murphy

    This module provides a framework for the use of DNS Service Discovery
    using IP multicast.  It has been tested against the JRendezvous
    implementation from <a href="http://strangeberry.com">StrangeBerry</a>,
    and against the mDNSResponder from Mac OS X 10.3.8.

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, see
    <http://www.gnu.org/licenses/>.

sPaul Scott-Murphys!paul at scott dash murphy dot coms0.12i�NtZeroconftServiceInfotServiceBrowserit_GLOBAL_DONEi}i�i�i�i�s224.0.0.251i�i5i<i�i#i�iiii@i iiiiii�i�i�iiiii	i
iii
iiii!tintcstchthstnonetanytatnstmdtmftcnametsoatmbtmgtmrtnulltwkstptrthinfotminfotmxttxttquadatsrvcCstj�dS(s#Current system time in millisecondsi�(ttime(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytcurrentTimeMillis�stNonLocalNameExceptioncBseZRS((t__name__t
__module__(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR�stNonUniqueNameExceptioncBseZRS((RR (((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR!�stNamePartTooLongExceptioncBseZRS((RR (((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR"�stAbstractMethodExceptioncBseZRS((RR (((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR#�stBadTypeInNameExceptioncBseZRS((RR (((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR$�st
BadDomainNamecBseZd�ZRS(cCstj|d|�dS(Nsat position %s(t	Exceptiont__init__(tselftpos((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR'�s(RR R'(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR%�stBadDomainNameCircularcBseZRS((RR (((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR*�stDNSEntrycBsDeZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(sA DNS entrycCsHtj|�|_||_||_|t@|_|t@dk|_dS(Ni(	tstringtlowertkeytnamettypet_CLASS_MASKtclazzt
_CLASS_UNIQUEtunique(R(R/R0R2((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR'�s
		
cCsGt|t�rC|j|jkoB|j|jkoB|j|jkSdS(s&Equality test on name, type, and classi(t
isinstanceR+R/R0R2(R(tother((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyt__eq__�s4cCs|j|�S(sNon-equality test(R7(R(R6((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyt__ne__�scCs)yt|SWntk
r$d|SXdS(sClass accessors?(%s)N(t_CLASSEStKeyError(R(R2((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytgetClazz�s
cCs)yt|SWntk
r$d|SXdS(s
Type accessors?(%s)N(t_TYPESR:(R(R0((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytgetType�s
cCs�d||j|j�|j|j�f}|jrA|d7}n
|d7}||j7}|dk	ru|d|7}n
|d7}|S(s1String representation with additional informations%s[%s,%ss-unique,t,s,%s]t]N(R=R0R;R2R4R/tNone(R(thdrR6tresult((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyttoString�s+	



(	RR t__doc__R'R7R8R;R=RC(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR+�s					tDNSQuestioncBs)eZdZd�Zd�Zd�ZRS(sA DNS question entrycCs8|jd�st|��ntj||||�dS(Ns.local.(tendswithRR+R'(R(R/R0R2((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR'scCsC|j|jkoB|j|jks3|jtkoB|j|jkS(s6Returns true if the question is answered by the record(R2R0t	_TYPE_ANYR/(R(trec((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyt
answeredByscCstj|dd�S(sString representationtquestionN(R+RCR@(R(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyt__repr__s(RR RDR'RIRK(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyREs		t	DNSRecordcBsqeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
RS(s.A DNS record - like a DNS entry, but has a TTLcCs/tj||||�||_t�|_dS(N(R+R'tttlRtcreated(R(R/R0R2RM((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR's	cCs#t|t�rtj||�SdS(sTests equality as per DNSRecordi(R5RLR+R7(R(R6((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR7!scCs+x$|jD]}|j|�r
dSq
WdS(s^Returns true if any answer in a message can suffice for the
		information held in this record.ii(tanswerstsuppressedByAnswer(R(tmsgtrecord((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytsuppressedBy'scCs*||kr&|j|jdkr&dSdS(sqReturns true if another record has same name, type and class,
		and if its TTL is at least half of this record's.iii(RM(R(R6((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRP/s"cCs|j||jdS(sRReturns the time at which this record will have expired
		by a certain percentage.i
(RNRM(R(tpercent((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytgetExpirationTime6scCstd|jd�|d�S(s%Returns the remaining TTL in seconds.iidi�(tmaxRU(R(tnow((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytgetRemainingTTL;scCs|jd�|kS(s(Returns true if this record has expired.id(RU(R(RW((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyt	isExpired?scCs|jd�|kS(s9Returns true if this record is at least half way expired.i2(RU(R(RW((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytisStaleCscCs|j|_|j|_dS(sDSets this record's TTL and created time to that of
		another record.N(RNRM(R(R6((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytresetTTLGscCs
t�dS(sAbstract methodN(R#(R(tout((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytwriteMscCs5d|j|jt��|f}tj|d|�S(s1String representation with additional informations%s/%s,%sRR(RMRXRR+RC(R(R6targ((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRCQs"(RR RDR'R7RSRPRURXRYRZR[R]RC(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRLs										t
DNSAddresscBs2eZdZd�Zd�Zd�Zd�ZRS(sA DNS address recordcCs&tj|||||�||_dS(N(RLR'taddress(R(R/R0R2RMR`((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR'YscCs |j|jt|j��dS(s'Used in constructing an outgoing packetN(twriteStringR`tlen(R(R\((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR]]scCs#t|t�r|j|jkSdS(sTests equality on addressi(R5R_R`(R(R6((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR7ascCs0ytj|j�SWntk
r+|jSXdS(sString representationN(tsockett	inet_ntoaR`R&(R(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRKgs
(RR RDR'R]R7RK(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR_Vs
			tDNSHinfocBs2eZdZd�Zd�Zd�Zd�ZRS(sA DNS host information recordcCs/tj|||||�||_||_dS(N(RLR'tcputos(R(R/R0R2RMRfRg((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR'qs	cCs<|j|jt|j��|j|jt|j��dS(s'Used in constructing an outgoing packetN(RaRfRbRg(R(R\((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR]vscCs5t|t�r1|j|jko0|j|jkSdS(sTests equality on cpu and osi(R5ReRfRg(R(R6((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR7{s"cCs|jd|jS(sString representationt (RfRg(R(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRK�s(RR RDR'R]R7RK(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRens
			t
DNSPointercBs2eZdZd�Zd�Zd�Zd�ZRS(sA DNS pointer recordcCs&tj|||||�||_dS(N(RLR'talias(R(R/R0R2RMRj((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR'�scCs|j|j�dS(s'Used in constructing an outgoing packetN(t	writeNameRj(R(R\((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR]�scCs#t|t�r|j|jkSdS(sTests equality on aliasi(R5RiRj(R(R6((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR7�scCs|j|j�S(sString representation(RCRj(R(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRK�s(RR RDR'R]R7RK(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRi�s
			tDNSTextcBs2eZdZd�Zd�Zd�Zd�ZRS(sA DNS text recordcCs&tj|||||�||_dS(N(RLR'ttext(R(R/R0R2RMRm((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR'�scCs |j|jt|j��dS(s'Used in constructing an outgoing packetN(RaRmRb(R(R\((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR]�scCs#t|t�r|j|jkSdS(sTests equality on texti(R5RlRm(R(R6((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR7�scCsAt|j�dkr-|j|jd d�S|j|j�SdS(sString representationi
is...N(RbRmRC(R(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRK�s(RR RDR'R]R7RK(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRl�s
			t
DNSServicecBs2eZdZd�Zd�Zd�Zd�ZRS(sA DNS service recordc		CsAtj|||||�||_||_||_||_dS(N(RLR'tprioritytweighttporttserver(	R(R/R0R2RMRoRpRqRr((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR'�s
			cCsD|j|j�|j|j�|j|j�|j|j�dS(s'Used in constructing an outgoing packetN(t
writeShortRoRpRqRkRr(R(R\((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR]�scCsYt|t�rU|j|jkoT|j|jkoT|j|jkoT|j|jkSdS(s3Tests equality on priority, weight, port and serveri(R5RnRoRpRqRr(R(R6((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR7�sFcCs|jd|j|jf�S(sString representations%s:%s(RCRrRq(R(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRK�s(RR RDR'R]R7RK(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRn�s
			tDNSIncomingcBszeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�ZRS(
s/Object representation of an incoming DNS packetcCsjd|_||_g|_g|_d|_d|_d|_d|_|j�|j	�|j
�dS(s/Constructor from string holding bytes of packetiN(toffsettdatat	questionsROtnumQuestionst
numAnswerstnumAuthoritiestnumAdditionalst
readHeadert
readQuestionst
readOthers(R(Rv((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR'�s								

cCs�d}tj|�}tj||j|j|j|!�}|j|7_|d|_|d|_|d|_|d|_|d|_	|d|_
dS(	sReads header portion of packets!HHHHHHiiiiiiN(tstructtcalcsizetunpackRvRutidtflagsRxRyRzR{(R(tformattlengthtinfo((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR|�s&




cCs�d}tj|�}x�td|j�D]�}|j�}tj||j|j|j|!�}|j|7_y.t||d|d�}|j	j
|�Wq(tk
r�q(Xq(WdS(s!Reads questions section of packets!HHiiN(RR�trangeRxtreadNameR�RvRuRERwtappendR(R(R�R�tiR/R�RJ((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR}�s&
cCsRd}tj|�}tj||j|j|j|!�}|j|7_|dS(s Reads an integer from the packets!Ii(RR�R�RvRu(R(R�R�R�((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytreadInt�s
&cCs2t|j|j�}|jd7_|j|�S(s(Reads a character string from the packeti(tordRvRut
readString(R(R�((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytreadCharacterStringscCs`dt|�d}tj|�}tj||j|j|j|!�}|j|7_|dS(s0Reads a string of a given length from the packett!tsi(tstrRR�R�RvRu(R(RbR�R�R�((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR�
s
&cCsRd}tj|�}tj||j|j|j|!�}|j|7_|dS(s'Reads an unsigned short from the packets!Hi(RR�R�RvRu(R(R�R�R�((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytreadUnsignedShorts
&cCsrd}tj|�}|j|j|j}x?td|�D].}|j�}tj||j|j	|j	|!�}|j	|7_	d}|dtkr�t||d|d|d|j
d��}n�|dtks�dtkrt||d|d|d|j��}n5|dtkrZt||d|d|d|j
|d��}n�dtkr�t||d|d|d|j�|j�|j�|j��}n�|dtkr�||d|d|d|j�|j��}nS|dtkr8t||d|d|d|j
d��}n|j	|d7_	|dk	r<|jj|�q<q<WdS(	sDReads the answers, authorities and additionals section of the packets!HHiHiiiiiiN(RR�RyRzR{R�R�R�RvRuR@t_TYPE_AR_R�t_TYPE_CNAMEt	_TYPE_PTRRit	_TYPE_TXTRlt	_TYPE_SRVRnR�t_TYPE_HINFOReR�t
_TYPE_AAAAROR�(R(R�R�tnR�tdomainR�RH((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR~s.&0 -4H60
cCs|jt@tkS(sReturns true if this is a query(R�t_FLAGS_QR_MASKt_FLAGS_QR_QUERY(R(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytisQuery?scCs|jt@tkS(s"Returns true if this is a response(R�R�t_FLAGS_QR_RESPONSE(R(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyt
isResponseCscCs|j|||!jd�S(s6Reads a UTF-8 string of a given length from the packetsutf-8(Rvtdecode(R(RuRb((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytreadUTFGscCs6d}|j}d}|}x�rt|j|�}|d7}|dkrQPn|d@}|dkr�dj||j||�df�}||7}q|dkr|dkr�|d}n|d@d>t|j|�B}||kr�|��n|}qt|��qW|dkr)||_n	||_|S(	s#Reads a domain name from the packetti�iii�t.i?i(RutTrueR�RvtjoinR�R*R%(R(RBtofftnexttfirstRbtt((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR�Ks2		

%

		(RR RDR'R|R}R�R�R�R�R~R�R�R�R�(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRt�s								%			tDNSOutgoingcBs�eZdZdd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
d
�Zd�Zd�Zd�Zd�ZRS(s+Object representation of an outgoing packeticCsgd|_d|_||_||_i|_g|_d|_g|_g|_g|_	g|_
dS(Nii(tfinishedR�t	multicastR�tnamesRvtsizeRwROtauthoritiestadditionals(R(R�R�((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR'ps										cCs|jj|�dS(sAdds a questionN(RwR�(R(RR((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytaddQuestion~scCs&|j|�s"|j|d�ndS(sAdds an answeriN(RStaddAnswerAtTime(R(tinpRR((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyt	addAnswer�scCsH|dk	rD|dks(|j|�rD|jj||f�qDndS(s6Adds an answer if if does not expire by a certain timeiN(R@RYROR�(R(RRRW((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR��scCs|jj|�dS(sAdds an authoritative answerN(R�R�(R(RR((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytaddAuthoritativeAnswer�scCs|jj|�dS(sAdds an additional answerN(R�R�(R(RR((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytaddAdditionalAnswer�scCs;d}|jjtj|t|���|jd7_dS(s"Writes a single byte to the packets!ciN(RvR�RtpacktchrR�(R(tvalueR�((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyt	writeByte�s"cCs8d}|jj|tj||��|jd7_dS(s=Inserts an unsigned short in a certain position in the packets!HiN(RvtinsertRR�R�(R(tindexR�R�((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytinsertShort�scCs5d}|jjtj||��|jd7_dS(s&Writes an unsigned short to the packets!HiN(RvR�RR�R�(R(R�R�((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRs�scCs;d}|jjtj|t|���|jd7_dS(s(Writes an unsigned integer to the packets!IiN(RvR�RR�tintR�(R(R�R�((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytwriteInt�s"cCsCdt|�d}|jjtj||��|j|7_dS(sWrites a string to the packetR�R�N(R�RvR�RR�R�(R(R�R�R�((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRa�scCsQ|jd�}t|�}|dkr0t�n|j|�|j||�dS(s5Writes a UTF-8 string of a given length to the packetsutf-8i@N(tencodeRbR"R�Ra(R(R�tutfstrR�((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytwriteUTF�s	
cCs�y|j|}Wnytk
r�|j|j|<|jd�}|ddkr]|d }nx|D]}|j|�qdW|jd�dSX|j|d?dB�|j|�dS(s"Writes a domain name to the packetR�i�R�iNii�(R�R:R�tsplitR�R�(R(R/R�tpartstpart((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRk�s



cCs4|j|j�|j|j�|j|j�dS(sWrites a question to the packetN(RkR/RsR0R2(R(RJ((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyt
writeQuestion�scCs�|j|j�|j|j�|jrI|jrI|j|jtB�n|j|j�|dkrx|j|j	�n|j|j
|��t|j�}|j
d7_
|j|�|j
d8_
tdj|j|��}|j||�dS(sJWrites a record (answer, authoritative answer, additional) to
		the packetiiR�N(RkR/RsR0R4R�R2R3R�RMRXRbRvR�R]R�R�(R(RRRWR�R�((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytwriteRecord�s
cCs^|jsNd|_x|jD]}|j|�qWx'|jD]\}}|j||�q=Wx!|jD]}|j|d�qgWx!|jD]}|j|d�q�W|jdt|j��|jdt|j��|jdt|j��|jdt|j��|jd|j	�|j
r8|jdd�qN|jd|j�ndj|j
�S(suReturns a string containing the packet's bytes

		No further parts should be added to the packet once this
		is done.iiR�(R�RwR�ROR�R�R�R�RbR�R�R�R�Rv(R(RJtanswerRt	authorityt
additional((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytpacket�s&			(RR RDR'R�R�R�R�R�R�R�RsR�RaR�RkR�R�R�(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR�ms"															tDNSCachecBsMeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(sA cache of DNS entriescCs
i|_dS(N(tcache(R(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR'scCsMy|j|j}Wn%tk
r;g}|j|j<nX|j|�dS(s
Adds an entryN(R�R.R:R�(R(tentrytlist((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytadds

cCs9y!|j|j}|j|�Wntk
r4nXdS(sRemoves an entryN(R�R.tremoveR:(R(R�R�((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR�s

cCsDy%|j|j}||j|�SWnttfk
r?dSXdS(sHGets an entry by key.  Will return None if there is no
		matching entry.N(R�R.R�R:t
ValueErrorR@(R(R�R�((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytget%s
cCst|||�}|j|�S(sLGets an entry by details.  Will return None if there is
		no matching entry.(R+R�(R(R/R0R2R�((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytgetByDetails.scCs(y|j|SWntk
r#gSXdS(s5Returns a list of entries whose key matches the name.N(R�R:(R(R/((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytentriesWithName4s
cCs<d�}yt||jj��SWntk
r7gSXdS(sReturns a list of all entriescSs||S(N((txty((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR�=sN(treduceR�tvaluesR&(R(R�((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytentries;s
	
(
RR RDR'R�R�R�R�R�R�(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR�s							tEnginecBsDeZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(sNAn engine wraps read access to sockets, allowing objects that
	need to receive data from sockets to be called back when the
	sockets are ready.

	A reader needs a handle_read() method, which is called when the socket
	it is interested in is ready for reading.

	Writers are not implemented here, because we only send short
	packets.
	cCsHtjj|�||_i|_d|_tj�|_|j�dS(Ni(	t	threadingtThreadR'tzeroconftreadersttimeoutt	Conditiont	conditiontstart(R(R�((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR'Ps			cCs�x��ds�j�}t|�dkr^|jj�|jj|j�|jj�qy|tj|gg|j�\}}}xQ|D]I}y|j	|j
�Wq�tk
r�t�ds�tj
�q�q�Xq�WWqtk
r�qXqWdS(NRi(tglobalst
getReadersRbR�tacquiretwaitR�treleasetselectR�thandle_readR&t	tracebackt	print_exc(R(trstrrtwrterRc((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytrunXs 
$



cCs-|jj�|jj�}|jj�|S(N(R�R�R�tkeysR�(R(RB((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR�ns

cCs8|jj�||j|<|jj�|jj�dS(N(R�R�R�tnotifyR�(R(treaderRc((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyt	addReaderts


cCs5|jj�|j|=|jj�|jj�dS(N(R�R�R�R�R�(R(Rc((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyt	delReaderzs


cCs+|jj�|jj�|jj�dS(N(R�R�R�R�(R(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR��s

(	RR RDR'R�R�R�R�R�(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR�Ds
					tListenercBs eZdZd�Zd�ZRS(s(A Listener is used by this module to listen on the multicast
	group to which DNS messages are sent, allowing the implementation
	to cache information as it arrives.

	It requires registration with an Engine object in order to have
	the read() method called when a socket is available for reading.cCs)||_|jjj||jj�dS(N(R�tengineR�Rc(R(R�((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR'�s	cCs�|jjjt�\}\}}||_t|�}|j�r�|tkrg|jj|t	t�q�|t
kr�|jj|||�|jj|t	t�q�n|jj|�dS(N(R�Rctrecvfromt_MAX_MSG_ABSOLUTERvRtR�t
_MDNS_PORTthandleQueryt
_MDNS_ADDRt	_DNS_PORTthandleResponse(R(RvtaddrRqRQ((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR��s!	(RR RDR'R�(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR��s	tReapercBs eZdZd�Zd�ZRS(sKA Reaper is used by this module to remove cache entries that
	have expired.cCs'tjj|�||_|j�dS(N(R�R�R'R�R�(R(R�((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR'�s	cCs�x�tr�|jjd�t�dr*dSt�}xR|jjj�D]>}|j|�rF|jj||�|jjj	|�qFqFWqWdS(Ni
i�Ri'(
R�R�R�R�RR�R�RYtupdateRecordR�(R(RWRR((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR��s	
	(RR RDR'R�(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR�s	cBs2eZdZd�Zd�Zd�Zd�ZRS(s�Used to browse for a service of a specific type.

	The listener object will have its addService() and
	removeService() methods called when this browser
	discovers changes in the services availability.cCs�tjj|�||_||_||_i|_t�|_t	|_
g|_d|_|jj
|t|jtt��|j�dS(s%Creates a browser for a specific typeiN(R�R�R'R�R0tlistenertservicesRtnextTimet
_BROWSER_TIMEtdelayR�tdonetaddListenerRER�t	_CLASS_INR�(R(R�R0R((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR'�s							"cs�jtkr�j�jkr�j|�}yi�j�jj�}|s_|j��n9�j�jj�=��fd�}�jj	|�dSWnRt
k
r�|s��j�jj�<��fd�}�jj	|�q�X�jd�}|�jkr|�_qndS(s|Callback invoked by Zeroconf when new information arrives.

		Updates information required by browser in the Zeroconf cache.cs�jj|�j�j�S(N(Rt
removeServiceR0Rj(R�(RRR((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyt<lambda>�sNcs�jj|�j�j�S(N(Rt
addServiceR0Rj(R�(RRR((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR
�siK(
R0R�R/RYRRjR-R[R�R�R&RUR(R(R�RWRRtexpiredt	oldrecordtcallbacktexpires((RRR(s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR�s$!
cCsd|_|jj�dS(Ni(R	R�t	notifyAll(R(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytcancel�s	cCsvxotrqd}t�}t|j�dkrV|j|krV|jj|j|�nt�dsl|j	rpdSt�}|j|kr(t
t�}|jt
|jtt��x9|jj�D](}|j|�s�|j||�q�q�W|jj|�||j|_td|jd�|_nt|j�dkrR|jjd�}n|dk	r||j�qqWdS(NiRii�ii N(R�R@RRbR�RR�R�R�R	R�R�R�RER0R�RRR�RYR�tsendRtmintpop(R(teventRWR\RR((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR��s*		$	(RR RDR'RRR�(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR�s
			cBs�eZdZddddddd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�ZRS(sService informationic		Csz|j|�st�n||_||_||_||_||_||_|r`||_n	||_|j	|�dS(s�Create a service description.

		type: fully qualified service type name
		name: fully qualified service name
		address: IP address as unsigned short, network byte order
		port: port that the service runs on
		weight: weight of the service
		priority: priority of the service
		properties: dictionary of properties (or a string holding the bytes for the text field)
		server: fully qualified name for service host (defaults to name)N(
RFR$R0R/R`RqRpRoRrt
setProperties(	R(R0R/R`RqRpRot
propertiesRr((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR's								cCst|t�r||_g}d}x�|D]�}||}|dkrPd}nEt|t�rh|}n-t|t�r�|r�d}q�d}nd}|jdj||f��q+Wx>|D]6}dj|tj	dt
t|���|f�}q�W||_n	||_dS(s7Sets properties and text of this info from a dictionaryR�ttruetfalset=s!cN(
R5tdictRR@R�R�R�R�RR�R�RbRm(R(RR�RBR.R�tsuffixtitem((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR%s(	

				 
4cCsZ||_y&i}t|�}d}g}xL||krxt||�}|d7}|j||||!�||7}q-Wx�|D]�}|jd�}|dkr�|}	d}
nI|| }	||d}
|
dkr�d}
n|
dks�r�}
n|	r�|j|	�dkr�|
||	<q�q�W||_Wn$tk
rUt	j
�d|_nXdS(s+Sets properties and text given a text fieldiiRi�RRN(RmRbR�R�tfindR�R@RR&R�R�(R(RmRBtendR�tstrsR�R�teindexR.R�((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytsetText?s8	

	
		


cCs|jS(s
Type accessor(R0(R(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR=dscCsT|jdk	rM|jjd|j�rM|jt|j�t|j�d S|jS(s
Name accessorR�iN(R0R@R/RFRb(R(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytgetNamehs(%cCs|jS(sAddress accessor(R`(R(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyt
getAddressnscCs|jS(s
Port accessor(Rq(R(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytgetPortrscCs|jS(sPriority accessor(Ro(R(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytgetPriorityvscCs|jS(sWeight accessor(Rp(R(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyt	getWeightzscCs|jS(sProperties accessor(R(R(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyt
getProperties~scCs|jS(s
Text accessor(Rm(R(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytgetText�scCs|jS(sServer accessor(Rr(R(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyt	getServer�scCs|dk	r|j|�r|jtkrO|j|jkr|j|_qq|jtkr�|j|jkr|j|_|j|_|j	|_	|j
|_
|j|||jj
|jtt��qq|jtkr|j|jkr|j|j�qqndS(s-Updates service information from a DNS recordN(R@RYR0R�R/RrR`R�RqRpRoRR�R�RR�R%Rm(R(R�RWRR((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR�s.c	Cs�t�}t}||}||}d}z�|j|t|jtt��xu|jdks{|j	dks{|j
dkr�||kr�dS||kr�tt�}|j
t|jtt��|j|jj|jtt�|�|j
t|jtt��|j|jj|jtt�|�|jdk	rx|j
t|jtt��|j|jj|jtt�|�n|j|�||}|d}n|jt||�|�t�}qNWd}Wd|j|�X|S(suReturns true if the service could be discovered on the
		network, and updates this object with details discovered.
		iiiN(Rt_LISTENER_TIMER
RER/RGRRrR@R`RmR�R�R�R�R�R�R�R�R�RR�RtremoveListener(	R(R�R�RWRR�tlastRBR\((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytrequest�s6	

0%%(




cCs#t|t�r|j|jkSdS(sTests equality of service namei(R5RR/(R(R6((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR7�scCs|j|�S(sNon-equality test(R7(R(R6((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR8�scCs�d|jtj|j��|jf}|jdkrD|d7}n:t|j�dkri||j7}n||jd d7}|d7}|S(sString representationsservice[%s,%s:%s,R@iis...R?N(R/RcRdR'RqRmR@Rb(R(RB((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRK�s(

N(RR RDR@R'RR%R=R&R'R(R)R*R+R,R-RR1R7R8RK(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRs$		%											#		cBs�eZdZdd�Zd�Zd�Zd�Zd�Zdd�Z	d�Z
d	�Zed
�Z
d�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zeed�Zd�ZRS(s{Implementation of Zeroconf Multicast DNS Service Discovery

	Supports registration, unregistration, queries and browsing.
	cCs�dt�d<|dkr4tjtj��|_n	||_dtf|_tjtjtj	�|_y<|jj
tjtjd�|jj
tjtj
d�Wntk
r�nX|jj
tjtjd�|jj
tjtjd�y|jj|j�Wntk
rnX|jj
tjtjtjt�tjd��g|_g|_i|_i|_t�|_tj�|_t|�|_ t!|�|_"t#|�|_$dS(srCreates an instance of the Zeroconf class, establishing
		multicast communications, listening and reaping threads.iRR�ii�s0.0.0.0N(%R�R@Rct
gethostbynametgethostnametintfR�tgrouptAF_INETt
SOCK_DGRAMt
setsockoptt
SOL_SOCKETtSO_REUSEADDRtSO_REUSEPORTR&tSOL_IPtIP_MULTICAST_TTLtIP_MULTICAST_LOOPtbindtIP_ADD_MEMBERSHIPt	inet_atonR�t	listenerstbrowsersRtservicetypesR�R�R�R�R�R�R�R�RRtreaper(R(tbindaddress((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR'�s6
	 

2				cCs|jjd�S(Ns	127.0.0.1(R4t
startswith(R(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyt
isLoopbackscCs|jjd�S(Ns169.254.(R4RG(R(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytisLinklocalscCs2|jj�|jj|d�|jj�dS(sLCalling thread waits for a given number of milliseconds or
		until notified.i�N(R�R�R�R�(R(R�((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR�s
cCs+|jj�|jj�|jj�dS(sNotifies all waiting threadsN(R�R�RR�(R(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRs

i�cCs)t||�}|j||�r%|SdS(s�Returns network's service information for a particular
		name and type, or None if no service matches by the timeout,
		which defaults to 3 seconds.N(RR1R@(R(R0R/R�R�((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytgetServiceInfoscCs-|j|�|jjt|||��dS(s�Adds a listener for a particular service type.  This object
		will then have its updateRecord method called when information
		arrives for that type.N(tremoveServiceListenerRCR�R(R(R0R((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytaddServiceListener(s
cCs7x0|jD]%}|j|kr
|j�~q
q
WdS(s<Removes a listener from the set that is currently listening.N(RCRR(R(Rtbrowser((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRK/s
c
Cs�|j|�||j|jj�<|jj|j�rQ|j|jcd7<nd|j|j<t�}|}d}x+|dkr�||kr�|j||�t�}qynt	t
tB�}|jt
|jtt||j�d�|jt|jtt||j|j|j|j�d�|jt|jtt||j�d�|jr|jt|jtt||j�d�n|j|�|d7}|t7}qyWdS(s�Registers service information to the network with a default TTL
		of 60 seconds.  Zeroconf will then respond to requests for
		information for that service.  The name of the service may be
		changed if needed to make it unique on the network.iiiN(tcheckServiceRR/R-RDthas_keyR0RR�R�R�t	_FLAGS_AAR�RiR�RRnR�RoRpRqRrRlR�RmR`R_R�Rt_REGISTER_TIME(R(R�RMRWRR�R\((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytregisterService6s,
		(:(	+

c
Cs�yS|j|jj�=|j|jdkrE|j|jcd8<n
|j|j=Wntk
rfnXt�}|}d}x+|dkr�||kr�|j||�t�}qntt	t
B�}|jt|jt
td|j�d�|jt|jttd|j|j|j|j�d�|jt|jttd|j�d�|jr�|jt|jttd|j�d�n|j|�|d7}|t7}qWdS(sUnregister a service.iiiN(RR/R-RDR0R:RR�R�R�RPR�RiR�RRnR�RoRpRqRlR�RmR`R_RrR�Rt_UNREGISTER_TIME(R(R�RWRR�R\((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytunregisterServiceSs0
		(:(	+

cCsyt|j�dkrut�}|}d}xH|dkrq||kre|j||�t�}q-ntttB�}x�|jj�D]�}|jt	|j
ttd|j
�d�|jt|j
ttd|j|j|j|j�d�|jt|j
ttd|j�d�|jr�|jt|jttd|j�d�q�q�W|j|�|d7}|t7}q-WndS(s#Unregister all registered services.iiiN(RbRRR�R�R�RPR�R�RiR0R�RR/RnR�RoRpRqRrRlR�RmR`R_R�RRS(R(RWRR�R\R�((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytunregisterAllServicesos&		(:(	/

cCs�t�}|}d}xg|dkr~x�|jj|j�D]�}|jtkr:|j|�r:|j|jkr:|jjd�dkr�|jd|j	d|j
d|j|_|j|�dSt�q:q:W||kr|j
||�t�}qntttB�}||_|jt|jtt��|jt|jttt|j��|j|�|d7}|t7}qWdS(	shChecks the network for a unique service name, modifying the
		ServiceInfo passed in if it is not unique.iiR�s.[t:s].Ni(RR�R�R0R�RYRjR/R!R`RqRNR!R�R�R�RPtdebugR�RERR�Rit_DNS_TTLRt_CHECK_TIME(R(R�RWRR�RRR\((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRN�s,	1-

		%

cCs�t�}|jj|�|dk	r}xU|jj|j�D];}|j|�r;|j|�r;|j	|||�q;q;Wn|j
�dS(s�Adds a listener for a given question.  The listener will have
		its updateRecord method called when information is available to
		answer the question.N(RRBR�R@R�R�R/RIRYRR(R(RRJRWRR((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR
�s	cCs6y|jj|�|j�Wntk
r1nXdS(sRemoves a listener.N(RBR�RR&(R(R((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR/�s

cCs5x$|jD]}|j|||�q
W|j�dS(sHUsed to notify listeners of new information that has updated
		a record.N(RBRR(R(RWRHR((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR�scCs�t�}x�|jD]�}|j|�}||jj�kr�|rV|jj|�q�|jj|�}|dk	r�|j|�|}q�n|jj	|�|j
||�qWdS(sfDeal with incoming response packets.  All answers
		are held in the cache, and listeners are notified.N(RRORYR�R�R�R�R@R[R�R(R(RQRWRRRR�((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR�s	
cCsad}|tkrItttBd�}x!|jD]}|j|�q/Wnx�|jD]�}|jtkrN|j	dkr�x[|j
j�D]G}|dkr�tttB�}n|j|t
dttt|��q�WnxJ|jj�D]b}|j	|jkr�dkrtttB�}n|j|t
|jttt|j	��q��qSy�|dkrptttB�}n|jtks�|jtkr�|jj�D]M}|j|j	j�kr�|j|t|j	tttBt|j��q�q�Wn|jj|j	j�d�}|swSn|jtks:|jtkr{|j|t|j	tttBt|j|j|j|j��n|jtks�|jtkr�|j|t |j	tttBt|j!��n|jtkr|j"t|jtttBt|j��nWqSt#k
r!t$j%�qSXqSW|dk	r]|j&r]|j'|_'|j(|||�ndS(sEDeal with incoming query packets.  Provides a response if
		possible.is_services._dns-sd._udp.local.N()R@R�R�R�RPRwR�R0R�R/RDR�R�RiRRXRR�R�RGRrR-R_R3R`R�R�RnRoRpRqR�RlRmR�R&R�R�ROR�R(R(RQRRqR\RJtstypetservice((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR��sL)26A/0
cCs>y&|jj|j�d||f�Wntk
r9nXdS(sSends an outgoing packet.iN(RctsendtoR�R&(R(R\RRq((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRs&
cCs�t�ddkr�dt�d<|j�|jj�|j�|jjtjtjtj	t
�tj	d��|jj�ndS(sXEnds the background threads, and prevent this instance from
		servicing further queries.Riis0.0.0.0N(R�RR�R�RURcR8R<tIP_DROP_MEMBERSHIPRAR�tclose(R(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR^
s



2N(RR RDR@R'RHRIR�RRJRLRKRXRRRTRURNR
R/RRR�R�R�RR^(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR�s(/															3
t__main__s3Multicast DNS Service Discovery for Python, versions'1. Testing registration of a service...s0.10tversions
test values
another valuetbs_http._tcp.local.s!My Service Name._http._tcp.local.s	127.0.0.1i�s   Registering service...s   Registration done.s*2. Testing query of service information...s   Getting ZOE service:sZOE._http._tcp.local.s   Query done.s"3. Testing query of own service...s   Getting self:s/4. Testing unregister of service information...s   Unregister done.(eRDt
__author__t	__email__t__version__R,RRRcR�R�R�t__all__R�RSRYRQR.RR�R�R�RXt_MAX_MSG_TYPICALR�R�R�R�RPt	_FLAGS_TCt	_FLAGS_RDt	_FLAGS_RAt_FLAGS_Zt	_FLAGS_ADt	_FLAGS_CDRt	_CLASS_CSt	_CLASS_CHt	_CLASS_HSt_CLASS_NONEt
_CLASS_ANYR1R3R�t_TYPE_NSt_TYPE_MDt_TYPE_MFR�t	_TYPE_SOAt_TYPE_MBt_TYPE_MGt_TYPE_MRt
_TYPE_NULLt	_TYPE_WKSR�R�t_TYPE_MINFOt_TYPE_MXR�R�R�RGR9R<RR&RR!R"R#R$R%R*tobjectR+RERLR_ReRiRlRnRtR�R�R�R�R�RRRRRtrtdescRAR�RRR�RJRTR^(((s;/sys/lib/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyt<module>s6





	0=��5AO��		'



Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.