Package dns :: Module inet
[hide private]
[frames] | no frames]

Module inet

source code

Generic Internet address helper functions.

Functions [hide private]
 
inet_pton(family, text)
Convert the textual form of a network address into its binary form.
source code
 
inet_ntop(family, address)
Convert the binary form of a network address into its textual form.
source code
 
af_for_address(text)
Determine the address family of a textual-form network address.
source code
 
is_multicast(text)
Is the textual-form network address a multicast address?
source code
Variables [hide private]
  AF_INET = 2
  AF_INET6 = 30
  __package__ = 'dns'
Function Details [hide private]

inet_pton(family, text)

source code 

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``.

inet_ntop(family, address)

source code 

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``.

af_for_address(text)

source code 

Determine 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``.

is_multicast(text)

source code 

Is 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``.