Home | Trees | Index | Help |
---|
Module ipaddr |
|
An IPv4/IPv6 manipulation library in Python.
This library is used to create/poke/manipulate IPv4 and IPv6 addresses and prefixes.Classes | |
---|---|
BaseIP |
A generic IP object. |
IPv4 |
This class represents and manipulates 32-bit IPv4 addresses. |
IPv6 |
This class respresents and manipulates 128-bit IPv6 addresses. |
Exceptions | |
---|---|
Error |
Base class for exceptions. |
IPAddressExclusionError |
An Error we should never see occurred in address exclusion. |
IPTypeError |
Tried to perform a v4 action on v6 object or vice versa. |
IPv4IpValidationError |
Raised when an IPv4 address is invalid. |
IPv4NetmaskValidationError |
Raised when a netmask is invalid. |
IPv6IpValidationError |
Raised when an IPv6 address is invalid. |
IPv6NetmaskValidationError |
Raised when an IPv6 netmask is invalid. |
PrefixlenDiffInvalidError |
Raised when Sub/Supernets is called with a bad prefixlen_diff. |
Function Summary | |
---|---|
Collapse a list of IP objects. | |
Take an IP string/int and return an object of the correct type. | |
Loops through the addresses, collapsing concurrent netblocks. |
Variable Summary | |
---|---|
str |
__version__ = '1.0.2'
|
Function Details |
---|
CollapseAddrList(addresses)Collapse a list of IP objects. Example: CollapseAddrList([IPv4('1.1.0.0/24'), IPv4('1.1.1.0/24')]) -> [IPv4('1.1.0.0/23')] Args: addresses: A list of IPv4 or IPv6 objects. Returns: A list of IPv4 or IPv6 objects depending on what we were passed. |
IP(ipaddr)Take an IP string/int and return an object of the correct type. Args: ipaddr: A string or integer, the IP address. Either IPv4 or IPv6 addresses may be supplied; integers less than 2**32 will be considered to be IPv4. Returns: An IPv4 or IPv6 object. Raises: ValueError: if the string passed isn't either a v4 or a v6 address. |
_CollapseAddressListRecursive(addresses)Loops through the addresses, collapsing concurrent netblocks. Example: ip1 = IPv4('1.1.0.0/24') ip2 = IPv4('1.1.1.0/24') ip3 = IPv4('1.1.2.0/24') ip4 = IPv4('1.1.3.0/24') ip5 = IPv4('1.1.4.0/24') ip6 = IPv4('1.1.0.1/22') _CollapseAddressListRecursive([ip1, ip2, ip3, ip4, ip5, ip6]) -> [IPv4('1.1.0.0/22'), IPv4('1.1.4.0/24')] This shouldn't be called directly; it is called via CollapseAddrList([]). Args: addresses: A list of IPv4 or IPv6 objects. Returns: A list of IPv4 or IPv6 objects depending on what we were passed. |
Variable Details |
---|
__version__
|
Home | Trees | Index | Help |
---|
Generated by Epydoc 2.1 on Tue Feb 3 11:02:37 2009 | http://epydoc.sf.net |