�
!`Nc@shddlZddlZddlZddlZddlZddlZdejjfd��YZ dS(i����NtHIPcBs�eZdZddddgZd�Zded�Zded�Ze e�Zddd�Z
dd �Ze e�Zded
�Zd�Z
RS(
s=HIP record
@ivar hit: the host identity tag
@type hit: string
@ivar algorithm: the public key cryptographic algorithm
@type algorithm: int
@ivar key: the public key
@type key: string
@ivar servers: the rendezvous servers
@type servers: list of dns.name.Name objects
@see: RFC 5205thitt algorithmtkeytserverscCsAtt|�j||�||_||_||_||_dS(N(tsuperRt__init__RRRR(tselftrdclasstrdtypeRRRR((s9/usr/lib64/python2.7/site-packages/dns/rdtypes/ANY/HIP.pyR's
c Ks�|jjd�}|jjd�jdd�}d}g}x0|jD]%}|jt|j||���qFWt|�dkr�|ddj |�7}nd|j
|||fS(Ns hex-codecsbase64-codecs
tit s
%u %s %s%s(RtencodeRtreplaceRtappendtstrtchoose_relativitytlentjoinR( Rtorigint
relativizetkwRRttextRtserver((s9/usr/lib64/python2.7/site-packages/dns/rdtypes/ANY/HIP.pytto_text.s#cCs�|j�}|j�jd�}t|�dkrHtjjd��n|j�jd�}g} xT|j�}
|
j�r�Pntj j
|
j|�}|j||�| j
|�qf||||||| �S(Ns hex-codeci�sHIT too longsbase64-codec(t get_uint8t
get_stringtdecodeRtdnst exceptiontSyntaxErrortgett
is_eol_or_eoftnamet from_texttvalueRR(tclsRR ttokRRRRRRttokenR((s9/usr/lib64/python2.7/site-packages/dns/rdtypes/ANY/HIP.pyR"9scCs�t|j�}t|j�}|jtjd||j|��|j|j�|j|j�x$|jD]}|j|d|�qjWdS(Ns!BBH(
RRRtwritetstructtpackRRtto_wiretNone(RtfiletcompressRtlhtlkR((s9/usr/lib64/python2.7/site-packages/dns/rdtypes/ANY/HIP.pyR*Ks"cCs$tjd|||d!�\}}} |d7}|d8}||||!j�}
||7}||8}|||| !j�}|| 7}|| 8}g}xr|dkr
tjj||| |�\}
}||7}||8}|dk r�|
j|�}
n|j|
�q�W||||
|||�S(Ns!BBHii( R(tunpacktunwrapRR!t from_wireR+RR(R$RR twiretcurrenttrdlenRR.RR/RRRRtcused((s9/usr/lib64/python2.7/site-packages/dns/rdtypes/ANY/HIP.pyR2Ts(
cCsFg}x0|jD]%}|j||�}|j|�qW||_dS(N(RRR(RRRRR((s9/usr/lib64/python2.7/site-packages/dns/rdtypes/ANY/HIP.pyRls
cCs�tj�}t|j�}t|j�}|jtjd||j|��|j|j�|j|j�tj�}t|j�}t|j�}|jtjd||j|��|j|j�|j|j�t |j
�|j
��}|dkr|St|j�}t|j�}t||�} d}
xG|
| krt |j|
|j|
�}|dkrr|S|
d7}
q9W||S(Ns!BBHii(
t cStringIOtStringIORRRR'R(R)RtcmptgetvalueRtmin(Rtothertb1R.R/tb2tvtlstlotcountti((s9/usr/lib64/python2.7/site-packages/dns/rdtypes/ANY/HIP.pyt_cmpss2""N(t__name__t
__module__t__doc__t __slots__RR+tTrueRR"tclassmethodR*R2RRD(((s9/usr/lib64/python2.7/site-packages/dns/rdtypes/ANY/HIP.pyRs (
R7tstringR(t
dns.exceptionRt dns.rdatat
dns.rdatatypetrdatatRdataR(((s9/usr/lib64/python2.7/site-packages/dns/rdtypes/ANY/HIP.pyts