Your IP : 3.144.47.195


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

�
#�Sc@s�dZddlZddlZddlZejd�Zd�Zejd�Zejd�Z	ejd�Z
d�ZdZd�Z
dS(sIPv6 helper functions.i����Ns
0+([0-9a-f]+)cCs/t|�dkr!td��n|jd�}g}d}t|�}xe||kr�|||d!}tj|�}|dk	r�|jd�}n|j|�|d7}qKWd}d}d}	t}
xvt	d�D]h}||d	kr(|
r=|}||	}||kr|	}|}nt}
q=q�|
s�|}	t
}
q�q�W|
rud}||	}||kru|	}|}qun|dkr|dkr�|d
ks�|dkr�|ddkr�|d
kr�d
}
nd}
|
tjj
|d�}q+dj|| �d
dj|||�}ndj|�}|S(s�Convert a network format IPv6 address into text.

    @param address: the binary address
    @type address: string
    @rtype: string
    @raises ValueError: the address isn't 16 bytes long
    is IPv6 addresses are 16 bytes longt	hex_codeciiii����it0iitffffs::s::ffff:it:N(tlent
ValueErrortencodet
_leading_zerotmatchtNonetgrouptappendtFalsetxrangetTruetdnstipv4t	inet_ntoatjoin(taddressthextchunkstitltchunktmt
best_starttbest_lentstartt
last_was_zerotendtcurrent_lentprefix((s./usr/lib64/python2.7/site-packages/dns/ipv6.pyRs^	

	

	s(.*):(\d+\.\d+\.\d+\.\d+)$s::.*s.*::$c
CsO|dkrd}ntj|�}|dk	r�tjj|jd��}d|jd�t|d�t|d�t|d�t|d�f}ntj|�}|dk	r�|d}n(t	j|�}|dk	r�|d }n|j
d	�}t|�}|d
krtjj
�nt}g}x�|D]�}|dkr�|rXtjj
�nt}x�tdd
|d�D]}|jd�qvWq1t|�}	|	d
kr�tjj
�n|	d
kr�dd
|	|}n|j|�q1W|d
kr|rtjj
�ndj|�}y|jd�SWntk
rJtjj
�nXdS(s�Convert a text format IPv6 address into network format.

    @param text: the textual address
    @type text: string
    @rtype: string
    @raises dns.exception.SyntaxError: the text was not properly formatted
    s::s0::is%s:%02x%02x:%02x%02xiiii����Ritt0000iRRN(t
_v4_endingRR	RRt	inet_atonR
tordt_colon_colon_startt_colon_colon_endtsplitRt	exceptiontSyntaxErrorRRR
RRtdecodet	TypeError(
ttextRtbRRt
seen_emptyt	canonicaltcRtlc((s./usr/lib64/python2.7/site-packages/dns/ipv6.pyR$`sN
	)$



ti
s��cCs
|jt�S(N(t
startswitht_mapped_prefix(R((s./usr/lib64/python2.7/site-packages/dns/ipv6.pyt	is_mapped�st
t��(t__doc__tret
dns.exceptionRtdns.ipv4tcompileRRR#R&R'R$R5R6(((s./usr/lib64/python2.7/site-packages/dns/ipv6.pyt<module>s	C	E