\x89\x50\x4E\x47\x0D\x0A\x1A\x0A PNG  \x89\x50\x4E\x47\x0D\x0A\x1A\x0A  13\c@@sddlmZmZdZdZdZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZdddgZded d/Z?d!Z@id0e&6d1e'6d2e(6d3e)6d4e*6d5e+6ZAid6e.6d7e/6d8e06d9e16d:e26d;e36d<e46d=e56d>e66d?e76d@e86dAe96dBe:6dCe;6dDe<6dEe=6dFe>6dGe?6d5e@6ZBdHZCdIeDfdJYZEdKeDfdLYZFdMeDfdNYZGdOeDfdPYZHdQeDfdRYZIdSeDfdTYZJdUeJfdVYZKdWeLfdXYZMdYeMfdZYZNd[eMfd\YZOd]eOfd^YZPd_eOfd`YZQdaeOfdbYZRdceOfddYZSdeeOfdfYZTdgeLfdhYZUdieLfdjYZVdkeLfdlYZWdme jXfdnYZYdoeLfdpYZZdqe jXfdrYZ[de jXfdsYZ\deLfdtYZ]deLfduYZ^e_dvkre`dwee^Zae`dxidydz6d{d66d|d}6Zbe]d~de jcddddebZde`deajeede`de`de`defeajgd~de`de`de`defeajgd~de`de`deajhede`deajindS(i(tabsolute_importtprint_functionsPaul Scott-Murphys!paul at scott dash murphy dot coms0.12NtZeroconft ServiceInfotServiceBrowsert _GLOBAL_DONEi}iiiis 224.0.0.251ii5i<ii #iiiii@i iiiiiiiiiiiii i i i i iiii!tintcstchthstnonetanytatnstmdtmftcnametsoatmbtmgtmrtnulltwkstptrthinfotminfotmxttxttquadatsrvcC@stjdS(s#Current system time in millisecondsi(ttime(((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytcurrentTimeMillisstNonLocalNameExceptioncB@seZRS((t__name__t __module__(((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR stNonUniqueNameExceptioncB@seZRS((R!R"(((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR#stNamePartTooLongExceptioncB@seZRS((R!R"(((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR$stAbstractMethodExceptioncB@seZRS((R!R"(((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR%stBadTypeInNameExceptioncB@seZRS((R!R"(((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR&st BadDomainNamecB@seZdZRS(cC@stj|d|dS(Nsat position %s(t Exceptiont__init__(tselftpos((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR)s(R!R"R)(((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR'stBadDomainNameCircularcB@seZRS((R!R"(((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR,stDNSEntrycB@sDeZdZdZdZdZdZdZdZRS(s A DNS entrycC@sHtj||_||_||_|t@|_|t@dk|_dS(Ni( tstringtlowertkeytnamettypet _CLASS_MASKtclazzt _CLASS_UNIQUEtunique(R*R1R2R4((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR)s    cC@sGt|trC|j|jkoB|j|jkoB|j|jkSdS(s&Equality test on name, type, and classi(t isinstanceR-R1R2R4(R*tother((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyt__eq__s$cC@s|j| S(sNon-equality test(R9(R*R8((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyt__ne__scC@s)y t|SWntk r$d|SXdS(sClass accessors?(%s)N(t_CLASSEStKeyError(R*R4((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytgetClazzs  cC@s)y t|SWntk r$d|SXdS(s Type accessors?(%s)N(t_TYPESR<(R*R2((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytgetTypes  cC@sd||j|j|j|jf}|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?R2R=R4R6R1tNone(R*thdrR8tresult((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyttoStrings(      ( R!R"t__doc__R)R9R:R=R?RE(((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR-s     t DNSQuestioncB@s)eZdZdZdZdZRS(sA DNS question entrycC@s8|jdst|ntj||||dS(Ns.local.(tendswithR R-R)(R*R1R2R4((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR)scC@sC|j|jkoB|j|jks3|jtkoB|j|jkS(s6Returns true if the question is answered by the record(R4R2t _TYPE_ANYR1(R*trec((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyt answeredBys!cC@stj|ddS(sString representationtquestionN(R-RERB(R*((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyt__repr__s(R!R"RFR)RKRM(((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRGs  t DNSRecordcB@sqeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z RS( s.A DNS record - like a DNS entry, but has a TTLcC@s/tj||||||_t|_dS(N(R-R)tttlRtcreated(R*R1R2R4RO((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR)$s cC@s#t|trtj||SdS(sTests equality as per DNSRecordi(R7RNR-R9(R*R8((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR9)scC@s+x$|jD]}|j|r dSq WdS(sdReturns true if any answer in a message can suffice for the information held in this record.ii(tanswerstsuppressedByAnswer(R*tmsgtrecord((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyt suppressedBy/scC@s*||kr&|j|jdkr&dSdS(swReturns true if another record has same name, type and class, and if its TTL is at least half of this record's.iii(RO(R*R8((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRR7s"cC@s|j||jdS(sXReturns the time at which this record will have expired by a certain percentage.i (RPRO(R*tpercent((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytgetExpirationTime>scC@std|jd|dS(s%Returns the remaining TTL in seconds.iidi(tmaxRW(R*tnow((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytgetRemainingTTLCscC@s|jd|kS(s(Returns true if this record has expired.id(RW(R*RY((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyt isExpiredGscC@s|jd|kS(s9Returns true if this record is at least half way expired.i2(RW(R*RY((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytisStaleKscC@s|j|_|j|_dS(sJSets this record's TTL and created time to that of another record.N(RPRO(R*R8((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytresetTTLOs cC@s tdS(sAbstract methodN(R%(R*tout((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytwriteUscC@s5d|j|jt|f}tj|d|S(s1String representation with additional informations%s/%s,%sRT(RORZRR-RE(R*R8targ((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyREYs(R!R"RFR)R9RURRRWRZR[R\R]R_RE(((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRN!s          t DNSAddresscB@s2eZdZdZdZdZdZRS(sA DNS address recordcC@s&tj|||||||_dS(N(RNR)taddress(R*R1R2R4RORb((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR)bscC@s |j|jt|jdS(s'Used in constructing an outgoing packetN(t writeStringRbtlen(R*R^((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR_fscC@s#t|tr|j|jkSdS(sTests equality on addressi(R7RaRb(R*R8((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR9jscC@s0ytj|jSWntk r+|jSXdS(sString representationN(tsockett inet_ntoaRbR((R*((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRMps (R!R"RFR)R_R9RM(((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRa_s    tDNSHinfocB@s2eZdZdZdZdZdZRS(sA DNS host information recordcC@s/tj|||||||_||_dS(N(RNR)tcputos(R*R1R2R4RORhRi((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR)zs cC@s<|j|jt|j|j|jt|jdS(s'Used in constructing an outgoing packetN(RcRhRdRi(R*R^((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR_scC@s5t|tr1|j|jko0|j|jkSdS(sTests equality on cpu and osi(R7RgRhRi(R*R8((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR9s"cC@s|jd|jS(sString representationt (RhRi(R*((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRMs(R!R"RFR)R_R9RM(((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRgws    t DNSPointercB@s2eZdZdZdZdZdZRS(sA DNS pointer recordcC@s&tj|||||||_dS(N(RNR)talias(R*R1R2R4RORl((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR)scC@s|j|jdS(s'Used in constructing an outgoing packetN(t writeNameRl(R*R^((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR_scC@s#t|tr|j|jkSdS(sTests equality on aliasi(R7RkRl(R*R8((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR9scC@s|j|jS(sString representation(RERl(R*((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRMs(R!R"RFR)R_R9RM(((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRks    tDNSTextcB@s2eZdZdZdZdZdZRS(sA DNS text recordcC@s&tj|||||||_dS(N(RNR)ttext(R*R1R2R4RORo((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR)scC@s |j|jt|jdS(s'Used in constructing an outgoing packetN(RcRoRd(R*R^((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR_scC@s#t|tr|j|jkSdS(sTests equality on texti(R7RnRo(R*R8((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR9scC@sAt|jdkr-|j|jd dS|j|jSdS(sString representationi is...N(RdRoRE(R*((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRMs(R!R"RFR)R_R9RM(((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRns    t DNSServicecB@s2eZdZdZdZdZdZRS(sA DNS service recordc C@sAtj|||||||_||_||_||_dS(N(RNR)tprioritytweighttporttserver( R*R1R2R4RORqRrRsRt((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR)s    cC@sD|j|j|j|j|j|j|j|jdS(s'Used in constructing an outgoing packetN(t writeShortRqRrRsRmRt(R*R^((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR_scC@sYt|trU|j|jkoT|j|jkoT|j|jkoT|j|jkSdS(s3Tests equality on priority, weight, port and serveri(R7RpRqRrRsRt(R*R8((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR9s cC@s|jd|j|jfS(sString representations%s:%s(RERtRs(R*((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRMs(R!R"RFR)R_R9RM(((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRps    t DNSIncomingcB@szeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d ZRS( s/Object representation of an incoming DNS packetcC@sjd|_||_g|_g|_d|_d|_d|_d|_|j|j |j dS(s/Constructor from string holding bytes of packetiN( toffsettdatat questionsRQt numquestionst numanswerstnumauthoritiestnumadditionalst readHeadert readQuestionst readOthers(R*Rx((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR)s          cC@sd}tj|}tj||j|j|j|!}|j|7_|d|_|d|_|d|_|d|_|d|_ |d|_ dS( sReads header portion of packets!HHHHHHiiiiiiN( tstructtcalcsizetunpackRxRwtidtflagsRzR{R|R}(R*tformattlengthtinfo((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR~s      cC@sd}tj|}xtd|jD]}|j}tj||j|j|j|!}|j|7_y.t||d|d}|j j |Wq(t k rq(Xq(WdS(s!Reads questions section of packets!HHiiN( RRtrangeRztreadNameRRxRwRGRytappendR (R*RRtiR1RRL((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRs   cC@sRd}tj|}tj||j|j|j|!}|j|7_|dS(s Reads an integer from the packets!Ii(RRRRxRw(R*RRR((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytreadInt s  cC@s2t|j|j}|jd7_|j|S(s(Reads a character string from the packeti(tordRxRwt readString(R*R((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytreadCharacterStringscC@s`dt|d}tj|}tj||j|j|j|!}|j|7_|dS(s0Reads a string of a given length from the packett!tsi(tstrRRRRxRw(R*RdRRR((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRs  cC@sRd}tj|}tj||j|j|j|!}|j|7_|dS(s'Reads an unsigned short from the packets!Hi(RRRRxRw(R*RRR((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytreadUnsignedShort"s  c C@srd}tj|}|j|j|j}x?td|D].}|j}tj||j|j |j |!}|j |7_ d}|dt krt ||d|d|d|j d}n|dtks|dtkrt||d|d|d|j}n5|dtkrZt||d|d|d|j |d}n|dtkrt||d|d|d|j|j|j|j}n|dtkrt||d|d|d|j|j}nS|dtkr8t ||d|d|d|j d}n|j |d7_ |dk r<|jj|q<q<WdS( s@Reads answers, authorities and additionals section of the packets!HHiHiiiiiiN(RRR{R|R}RRRRxRwRBt_TYPE_ARaRt _TYPE_CNAMEt _TYPE_PTRRkt _TYPE_TXTRnt _TYPE_SRVRpRt _TYPE_HINFORgRt _TYPE_AAAARQR(R*RRtnRtdomainRRJ((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR+sD         cC@s|jt@tkS(sReturns true if this is a query(Rt_FLAGS_QR_MASKt_FLAGS_QR_QUERY(R*((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytisQuery[scC@s|jt@tkS(s"Returns true if this is a response(RRt_FLAGS_QR_RESPONSE(R*((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyt isResponse_scC@s|j|||!jdS(s6Reads a UTF-8 string of a given length from the packetsutf-8(Rxtdecode(R*RwRd((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytreadUTFcscC@s6d}|j}d}|}xtrt|j|}|d7}|dkrQPn|d@}|dkrdj||j||df}||7}q|dkr|dkr|d}n|d@d>t|j|B}||krt|n|}qt|qW|dkr)||_n ||_|S( s#Reads a domain name from the packettiiiit.i?i(RwtTrueRRxtjoinRR,R'(R*RDtofftnexttfirstRdtt((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRgs2      %         (R!R"RFR)R~RRRRRRRRRR(((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRvs     0   t DNSOutgoingcB@seZdZddZdZdZdZdZdZdZ d Z d Z d Z d Z d ZdZdZdZdZRS(s+Object representation of an outgoing packeticC@sgd|_d|_||_||_i|_g|_d|_g|_g|_g|_ g|_ dS(Nii ( tfinishedRt multicastRtnamesRxtsizeRyRQt authoritiest additionals(R*RR((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR)s          cC@s|jj|dS(sAdds a questionN(RyR(R*RT((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyt addQuestionscC@s&|j|s"|j|dndS(sAdds an answeriN(RUtaddAnswerAtTime(R*tinpRT((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyt addAnswerscC@sH|dk rD|dks(|j| rD|jj||fqDndS(s6Adds an answer if if does not expire by a certain timeiN(RBR[RQR(R*RTRY((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRs cC@s|jj|dS(sAdds an authoritative answerN(RR(R*RT((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytaddAuthoritativeAnswerscC@s|jj|dS(sAdds an additional answerN(RR(R*RT((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytaddAdditionalAnswerscC@s;d}|jjtj|t||jd7_dS(s"Writes a single byte to the packets!ciN(RxRRtpacktchrR(R*tvalueR((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyt writeBytes"cC@s8d}|jj|tj|||jd7_dS(s=Inserts an unsigned short in a certain position in the packets!HiN(RxtinsertRRR(R*tindexRR((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyt insertShortscC@s5d}|jjtj|||jd7_dS(s&Writes an unsigned short to the packets!HiN(RxRRRR(R*RR((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRuscC@s;d}|jjtj|t||jd7_dS(s(Writes an unsigned integer to the packets!IiN(RxRRRtintR(R*RR((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytwriteInts"cC@sCdt|d}|jjtj|||j|7_dS(sWrites a string to the packetRRN(RRxRRRR(R*RRR((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRcscC@sQ|jd}t|}|dkr0tn|j||j||dS(s5Writes a UTF-8 string of a given length to the packetsutf-8i@N(tencodeRdR$RRc(R*RtutfstrR((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytwriteUTFs     cC@sy|j|}Wnytk r|j|j|<|jd}|ddkr]|d }nx|D]}|j|qdW|jddSX|j|d?dB|j|dS(s"Writes a domain name to the packetRiRiNii(RR<RtsplitRR(R*R1Rtpartstpart((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRms    cC@s4|j|j|j|j|j|jdS(sWrites a question to the packetN(RmR1RuR2R4(R*RL((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyt writeQuestionscC@s|j|j|j|j|jrI|jrI|j|jtBn|j|j|dkrx|j|j n|j|j |t |j }|j d7_ |j||j d8_ t dj|j |}|j||dS(sPWrites a record (answer, authoritative answer, additional) to the packetiiRN(RmR1RuR2R6RR4R5RRORZRdRxRR_RR(R*RTRYRR((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyt writeRecords  cC@s^|jsNd|_x|jD]}|j|qWx'|jD]\}}|j||q=Wx!|jD]}|j|dqgWx!|jD]}|j|dqW|jdt|j|jdt|j|jdt|j|jdt|j|jd|j |j r8|jddqN|jd|j ndj |j S(sReturns a string containing the packet's bytes No further parts should be added to the packet once this is done.iiR(RRyRRQRRRRRdRRRRRx(R*RLtanswerttime_t authorityt additional((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytpackets&   (R!R"RFR)RRRRRRRRuRRcRRmRRR(((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRs"              tDNSCachecB@sMeZdZdZdZdZdZdZdZdZ RS(sA cache of DNS entriescC@s i|_dS(N(tcache(R*((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR).scC@sMy|j|j}Wn%tk r;g}|j|j}|j|rF|jj|||jjj |qFqFWqWdS(Ni iRi'( RRRRRRRR[t updateRecordR(R*RYRT((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRs   (R!R"RFR)R(((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR s cB@s2eZdZdZdZdZdZRS(sUsed 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.cC@stjj|||_||_||_i|_t|_t |_ g|_ d|_ |jj |t|jtt|jdS(s%Creates a browser for a specific typeiN(RRR)RR2tlistenertservicesRtnexttimet _BROWSER_TIMEtdelayRtdonet addListenerRGRt _CLASS_INR(R*RR2R ((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR)s         c@sjtkrjjkrj|}yijjj}|s_|jn9jjj=fd}jj |dSWnRt k r|sjjj<fd}jj |qnXj d}|j kr|_ qndS(sCallback invoked by Zeroconf when new information arrives. Updates information required by browser in the Zeroconf cache.c@sjj|jjS(N(R t removeServiceR2Rl(tx(RTR*(s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytsNc@sjj|jjS(N(R t addServiceR2Rl(R(RTR*(s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRsiK( R2RR1R[R RlR/R]RRR(RWR(R*RRYRTtexpiredt oldrecordtcallbacktexpires((RTR*s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR s$! cC@sd|_|jjdS(Ni(RRt notifyAll(R*((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytcancels cC@svxotrqd}t}t|jdkrV|j|krV|jj|j|ntdsl|j rpdSt}|j|kr(t t }|j t |jttx9|jjD](}|j|s|j||qqW|jj|||j|_td|jd|_nt|jdkrR|jjd}n|dk r||jqqWdS(NiRiiii N(RRBRRdRRRRRRRRRRGR2RRR RR[RtsendRtmintpop(R*teventRYR^RT((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRs*  $   (R!R"RFR)R RR(((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRs    cB@seZdZdddddddZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZRS(sService informationic C@sz|j|stn||_||_||_||_||_||_|r`||_n ||_|j |dS(sCreate 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( RHR&R2R1RbRsRrRqRtt setProperties( R*R2R1RbRsRrRqt propertiesRt((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR)2s         cC@st|tr||_g}d}x|D]}||}|dkrPd}nEt|trh|}n-t|tr|rd}qd}nd}|jdj||fq+Wx>|D]6}dj|tj dt t ||f}qW||_ n ||_ dS(s7Sets properties and text of this info from a dictionaryRttruetfalset=s!cN( R7tdictR#RBRRRRRRRRdRo(R*R#RRDR0Rtsuffixtitem((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR"Ns*          $ c C@sZ||_y&i}t|}d}g}xL||krxt||}|d7}|j||||!||7}q-Wx|D]}|jd}|dkr|} d} nI|| } ||d} | dkrd} n| dks| rd} n| r|j| dkr| ||          c C@syS|j|jj=|j|jdkrE|j|jcd8    "     c C@syt|jdkrut}|}d}xH|dkrq||kre|j||t}q-ntttB}x|jjD]}|jt |j t t d|j d|jt|j tt d|j|j|j|jd|jt|j tt d|jd|jr|jt|jtt d|jdqqW|j||d7}|t7}q-WndS(s#Unregister all registered services.iiiN(RdR RRRRRXRRRkR2RRR1RpRRqRrRsRtRnRRoRbRaRRR[(R*RYRRR^R((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytunregisterAllServicess4       cC@s{t}|}d}x_|dkrvx|jj|jD]}|jtkr:|j| r:|j|jkr:|jjddkrd|j|j |j |jf|_|j |dSt q:q:W||kr|j ||t}qntttB}||_|jt|jtt|jt|jttt|j|j||d7}|t7}qWdS(snChecks the network for a unique service name, modifying the ServiceInfo passed in if it is not unique.iiRs %w.[%s:%d].%sNi(RRRR2RR[RlR1R*RbRsRWR#RRRRXtdebugRRGRRRkt_DNS_TTLRt _CHECK_TIME(R*RRYRRRTR^((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRWs2 "       cC@st}|jj||dk r}xU|jj|jD];}|j|r;|j| r;|j |||q;q;Wn|j dS(sAdds a listener for a given question. The listener will have its updateRecord method called when information is available to answer the question.N( RRKRRBRRR1RKR[R R(R*R RLRYRT((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRs  cC@s6y|jj||jWntk r1nXdS(sRemoves a listener.N(RKRRR((R*R ((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR8s  cC@s5x$|jD]}|j|||q W|jdS(sNUsed to notify listeners of new information that has updated a record.N(RKR R(R*RYRJR ((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR  scC@st}x|jD]}|j|}||jjkr|rV|jj|q|jj|}|dk r|j||}qn|jj ||j ||qWdS(slDeal with incoming response packets. All answers are held in the cache, and listeners are notified.N( RRQR[RRRRRBR]RR (R*RSRYRTRR((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRs    c C@sad}|tkrItttBd}x!|jD]}|j|q/Wnx|jD]}|jtkrN|j dkrx[|j j D]G}|dkrtttB}n|j |t dttt|qWnxJ|jjD]b}|j |jkr|dkrtttB}n|j |t |jttt|j qqWqSy|dkrptttB}n|jtks|jtkrxa|jjD]M}|j|j jkr|j |t|j tttBt|jqqWn|jj|j jd}|swSn|jtks:|jtkr{|j |t|j tttBt|j|j|j|jn|jtks|jtkr|j |t |j tttBt|j!n|jtkr|j"t|jtttBt|jnWqSt#k r!t$j%qSXqSW|dk r]|j&r]|j'|_'|j(|||ndS(sKDeal with incoming query packets. Provides a response if possible.is_services._dns-sd._udp.local.N()RBRRRRXRyRR2RR1RMRRRkRR_R RRRIRtR/RaR5RbRRRpRqRrRsRRnRoRR(RRRQRR(R*RSRRsR^RLtstypetservice((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyR$sr              cC@s>y&|jj|jd||fWntk r9nXdS(sSends an outgoing packet.iN(RetsendtoRR((R*R^RRs((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRks& cC@stddkrdtd<|j|jj|j|jjtjtjtj t tj d|jj ndS(s^Ends the background threads, and prevent this instance from servicing further queries.Riis0.0.0.0N( RRRRR]ReRAREtIP_DROP_MEMBERSHIPRJRtclose(R*((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyReus    N(R!R"RFRBR)RQRRRRRSRURTR_RZR\R]RWRR8R RRRRRRe(((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pyRs( 0       & #      G 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.1is 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.(jt __future__RRt __author__t __email__t __version__RRRReR.RRRRt__all__RR[R`RYR7RRRRR_t_MAX_MSG_TYPICALRRRRRXt _FLAGS_TCt _FLAGS_RDt _FLAGS_RAt_FLAGS_Zt _FLAGS_ADt _FLAGS_CDRt _CLASS_CSt _CLASS_CHt _CLASS_HSt _CLASS_NONEt _CLASS_ANYR3R5Rt_TYPE_NSt_TYPE_MDt_TYPE_MFRt _TYPE_SOAt_TYPE_MBt_TYPE_MGt_TYPE_MRt _TYPE_NULLt _TYPE_WKSRRt _TYPE_MINFOt_TYPE_MXRRRRIR;R>RR(R R#R$R%R&R'R,tobjectR-RGRNRaRgRkRnRpRvRRRRRR RRRR!tprinttrtdescRJRRZRRSR\Re(((s=/usr/lib64/python2.7/site-packages/hgext/zeroconf/Zeroconf.pytsN                2>4A(Rq