???<!-- GIF89;a -->
123123123123
.....................................................................................................................................???<!-- GIF89;a -->
123123123123
.....................................................................................................................................3
¢báWª  ã               @   sj   d Z ddlZddlZddlZejZy
ejZW n ek
rD   dZY nX dd„ Zdd„ Z	dd	„ Z
d
d„ ZdS )z*Generic Internet address helper functions.é    Ni'  c             C   s0   | t krtjj|ƒS | tkr(tjj|ƒS t‚dS )a*  Convert the textual form of a network address into its binary form.

    @param family: the address family
    @type family: int
    @param text: the textual address
    @type text: string
    @raises NotImplementedError: the address family specified is not
    implemented.
    @rtype: string
    N)ÚAF_INETÚdnsÚipv4Ú	inet_atonÚAF_INET6Úipv6ÚNotImplementedError)ÚfamilyÚtext© r   ú/usr/lib/python3.6/inet.pyÚ	inet_pton&   s
    r   c             C   s0   | t krtjj|ƒS | tkr(tjj|ƒS t‚dS )a/  Convert the binary form of a network address into its textual form.

    @param family: the address family
    @type family: int
    @param address: the binary address
    @type address: string
    @raises NotImplementedError: the address family specified is not
    implemented.
    @rtype: string
    N)r   r   r   Z	inet_ntoar   r   r   )r	   Zaddressr   r   r   Ú	inet_ntop:   s
    r   c             C   sL   yt jj| ƒ tS  tk
rF   yt jj| ƒ tS    t‚Y nX Y nX dS )záDetermine the address family of a textual-form network address.

    @param text: the textual address
    @type text: string
    @raises ValueError: the address family cannot be determined from the input.
    @rtype: int
    N)r   r   r   r   Ú	Exceptionr   r   Ú
ValueError)r
   r   r   r   Úaf_for_addressM   s    r   c             C   st   y$t tjj| ƒd ƒ}|dko$|dkS  tk
rn   yt tjj| ƒd ƒ}|dkS  tk
rh   t‚Y nX Y nX dS )zÄIs the textual-form network address a multicast address?

    @param text: the textual address
    @raises ValueError: the address family cannot be determined from the input.
    @rtype: bool
    r   éà   éï   éÿ   N)Úordr   r   r   r   r   r   )r
   Úfirstr   r   r   Úis_multicast`   s    r   )Ú__doc__ZsocketZdns.ipv4r   Zdns.ipv6r   r   ÚAttributeErrorr   r   r   r   r   r   r   r   Ú<module>   s   

