
    1                         S r SSKrSSKrSSKrSSKJr  \R                  r \R                  rS r
S rS rS	 rg! \	 a    Sr Nf = f)
z*Generic Internet address helper functions.    N   )	maybe_ordi'  c                     U [         :X  a  [        R                  R                  U5      $ U [        :X  a  [        R
                  R                  U5      $ [        e)a  Convert the textual form of a network address into its binary form.

*family* is an ``int``, the address family.

*text* is a ``text``, the textual address.

Raises ``NotImplementedError`` if the address family specified is not
implemented.

Returns a ``binary``.
)AF_INETdnsipv4	inet_atonAF_INET6ipv6NotImplementedError)familytexts     lib/third_party/dns/inet.py	inet_ptonr   )   sD     xx!!$''	8	xx!!$''!!    c                     U [         :X  a  [        R                  R                  U5      $ U [        :X  a  [        R
                  R                  U5      $ [        e)a  Convert the binary form of a network address into its textual form.

*family* is an ``int``, the address family.

*address* is a ``binary``, the network address in binary form.

Raises ``NotImplementedError`` if the address family specified is not
implemented.

Returns a ``text``.
)r   r   r   	inet_ntoar
   r   r   )r   addresss     r   	inet_ntopr   >   sD     xx!!'**	8	xx!!'**!!r   c                      [         R                  R                  U 5        [        $ ! [         a4     [         R
                  R                  U 5        [        s $ !   [        e= ff = f)zDetermine the address family of a textual-form network address.

*text*, a ``text``, the textual address.

Raises ``ValueError`` if the address family cannot be determined
from the input.

Returns an ``int``.
)r   r   r	   r   	Exceptionr   r
   
ValueError)r   s    r   af_for_addressr   S   sV    4  	HHt$O	s    $' 
A%$AA%A!!A%c                 &    [        [        R                  R                  U 5      S   5      nUS:  =(       a    US:*  $ ! [         aH     [        [        R
                  R                  U 5      S   5      nUS:H  s $ ! [         a    [        ef = ff = f)zIs the textual-form network address a multicast address?

*text*, a ``text``, the textual address.

Raises ``ValueError`` if the address family cannot be determined
from the input.

Returns a ``bool``.
r            )r   r   r   r	   r   r   r   )r   firsts     r   is_multicastr   i   s    #((,,T2156|,, 	chh006q9:EC< 			s!   ;> 
B	/A;8B;BB)__doc__socketdns.ipv4r   dns.ipv6_compatr   r   r
   AttributeErrorr   r   r   r    r   r   <module>r'      sZ   $ 1     ..H
"*"*,I  Hs   ; AA