File: //usr/local/ssl/lib/python2.4/site-packages/dns/ipv6.pyc
mņ
zkzQc @ ss d Z d k Z d k Z d k Z e i d Z d Z e i d Z e i d Z e i d Z
d Z d S( s IPv6 helper functions.Ns
0+([0-9a-f]+)c C sJ t | d j o t d n | i d } g } d } t | }
xi | |
j o[ | | | d !} t i
| } | d j o | i
d } n | i | | d 7} qM Wd } d } d } t } x~ t d D]p } | | d j oB | o7 | } | | }
|
| j o | } |
} n t } qKqŪ | p | } t } qŪ qŪ W| o1 d } | | }
|
| j o | } |
} qn | d j o£ | d j of | d
j p | d j oL | d d j o; | d
j o
d
} n d } | t i i | d } qFd i | | d
d i | | | } n d i | } | 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
i s IPv6 addresses are 16 bytes longt hex_codeci i i i’’’’i t 0i i t ffffs ::s ::ffff:i t :N( t lent addresst
ValueErrort encodet hext chunkst it lt chunkt
_leading_zerot matcht mt Nonet groupt appendt
best_startt best_lent startt Falset
last_was_zerot xranget endt current_lent Truet prefixt dnst ipv4t inet_ntoat join( R R R R R R R R R R R R
R R ( ( t, /usr/lib/python2.4/site-packages/dns/ipv6.pyR s^
8
0s (.*):(\d+\.\d+\.\d+\.\d+)$s ::.*s .*::$c
C sf | d j o
d } n t i | } | d j oi t i i | i d } d | i d t
| d t
| d t
| d t
| d f } n t i | } | d j o | d } n+ t i | } | d j o | d } n | i
d } t | } | d
j o t i i n t } g } xÄ | D]¼ } | d j oP | o t i i n t } x t d d
| d D] } | i d qWq;t | } | d
j o t i i n | d
j o d d
| | } n | i | q;W| d
j o | o t i i n d i | } y | i d SWn t j
o t i i n Xd S( 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 ::s 0::i s %s:%02x%02x:%02x%02xi i i i’’’’R i t t 0000i R R N( t textt
_v4_endingR R R R R t inet_atonR t bt ordt _colon_colon_startt _colon_colon_endt splitR R R t exceptiont SyntaxErrorR t
seen_emptyt canonicalt cR R R
R t lcR t decodet TypeError(
R$ R1 R
R0 R R R' R R. R/ ( ( R! R&