multi_interface_roam::ipaddr::_BaseNet Class Reference
List of all members.
Detailed Description
A generic IP object.
This IP class contains the version independent methods which are
used by networks.
Definition at line 473 of file ipaddr.py.
Member Function Documentation
def multi_interface_roam::ipaddr::_BaseNet::__contains__ |
( |
|
self, |
|
|
|
other | |
|
) |
| | |
def multi_interface_roam::ipaddr::_BaseNet::__eq__ |
( |
|
self, |
|
|
|
other | |
|
) |
| | |
def multi_interface_roam::ipaddr::_BaseNet::__ge__ |
( |
|
self, |
|
|
|
other | |
|
) |
| | |
def multi_interface_roam::ipaddr::_BaseNet::__getitem__ |
( |
|
self, |
|
|
|
n | |
|
) |
| | |
def multi_interface_roam::ipaddr::_BaseNet::__gt__ |
( |
|
self, |
|
|
|
other | |
|
) |
| | |
def multi_interface_roam::ipaddr::_BaseNet::__hash__ |
( |
|
self |
) |
|
def multi_interface_roam::ipaddr::_BaseNet::__init__ |
( |
|
self, |
|
|
|
address | |
|
) |
| | |
def multi_interface_roam::ipaddr::_BaseNet::__iter__ |
( |
|
self |
) |
|
def multi_interface_roam::ipaddr::_BaseNet::__le__ |
( |
|
self, |
|
|
|
other | |
|
) |
| | |
def multi_interface_roam::ipaddr::_BaseNet::__lt__ |
( |
|
self, |
|
|
|
other | |
|
) |
| | |
def multi_interface_roam::ipaddr::_BaseNet::__ne__ |
( |
|
self, |
|
|
|
other | |
|
) |
| | |
def multi_interface_roam::ipaddr::_BaseNet::__repr__ |
( |
|
self |
) |
|
def multi_interface_roam::ipaddr::_BaseNet::__str__ |
( |
|
self |
) |
|
def multi_interface_roam::ipaddr::_BaseNet::_get_networks_key |
( |
|
self |
) |
[private] |
Network-only key function.
Returns an object that identifies this address' network and
netmask. This function is a suitable "key" argument for sorted()
and list.sort().
Definition at line 768 of file ipaddr.py.
def multi_interface_roam::ipaddr::_BaseNet::_ip_int_from_prefix |
( |
|
self, |
|
|
|
prefixlen = None | |
|
) |
| | [private] |
Turn the prefix length netmask into a int for comparison.
Args:
prefixlen: An integer, the prefix length.
Returns:
An integer.
Definition at line 778 of file ipaddr.py.
def multi_interface_roam::ipaddr::_BaseNet::_ip_string_from_prefix |
( |
|
self, |
|
|
|
prefixlen = None | |
|
) |
| | [private] |
Turn a prefix length into a dotted decimal string.
Args:
prefixlen: An integer, the netmask prefix length.
Returns:
A string, the dotted decimal netmask string.
Definition at line 811 of file ipaddr.py.
def multi_interface_roam::ipaddr::_BaseNet::_prefix_from_ip_int |
( |
|
self, |
|
|
|
ip_int, |
|
|
|
mask = 32 | |
|
) |
| | [private] |
Return prefix length from the decimal netmask.
Args:
ip_int: An integer, the IP address.
mask: The netmask. Defaults to 32.
Returns:
An integer, the prefix length.
Definition at line 792 of file ipaddr.py.
def multi_interface_roam::ipaddr::_BaseNet::address_exclude |
( |
|
self, |
|
|
|
other | |
|
) |
| | |
Remove an address from a larger block.
For example:
addr1 = IP('10.1.1.0/24')
addr2 = IP('10.1.1.0/26')
addr1.address_exclude(addr2) =
[IP('10.1.1.64/26'), IP('10.1.1.128/25')]
or IPv6:
addr1 = IP('::1/32')
addr2 = IP('::1/128')
addr1.address_exclude(addr2) = [IP('::0/128'),
IP('::2/127'),
IP('::4/126'),
IP('::8/125'),
...
IP('0:0:8000::/33')]
Args:
other: An IP object of the same type.
Returns:
A sorted list of IP objects addresses which is self minus
other.
Raises:
TypeError: If self and other are of difffering address
versions.
ValueError: If other is not completely contained by self.
Definition at line 645 of file ipaddr.py.
def multi_interface_roam::ipaddr::_BaseNet::broadcast |
( |
|
self |
) |
|
def multi_interface_roam::ipaddr::_BaseNet::compare_networks |
( |
|
self, |
|
|
|
other | |
|
) |
| | |
Compare two IP objects.
This is only concerned about the comparison of the integer
representation of the network addresses. This means that the
host bits aren't considered at all in this method. If you want
to compare host bits, you can easily enough do a
'HostA._ip < HostB._ip'
Args:
other: An IP object.
Returns:
If the IP versions of self and other are the same, returns:
-1 if self < other:
eg: IPv4('1.1.1.0/24') < IPv4('1.1.2.0/24')
IPv6('1080::200C:417A') < IPv6('1080::200B:417B')
0 if self == other
eg: IPv4('1.1.1.1/24') == IPv4('1.1.1.2/24')
IPv6('1080::200C:417A/96') == IPv6('1080::200C:417B/96')
1 if self > other
eg: IPv4('1.1.1.0/24') > IPv4('1.1.0.0/24')
IPv6('1080::1:200C:417A/112') >
IPv6('1080::0:200C:417A/112')
If the IP versions of self and other are different, returns:
-1 if self._version < other._version
eg: IPv4('10.0.0.1/24') < IPv6('::1/128')
1 if self._version > other._version
eg: IPv6('::1/128') > IPv4('255.255.255.0/24')
Definition at line 717 of file ipaddr.py.
def multi_interface_roam::ipaddr::_BaseNet::hostmask |
( |
|
self |
) |
|
def multi_interface_roam::ipaddr::_BaseNet::iter_subnets |
( |
|
self, |
|
|
|
prefixlen_diff = 1 , |
|
|
|
new_prefix = None | |
|
) |
| | |
The subnets which join to make the current subnet.
In the case that self contains only one IP
(self._prefixlen == 32 for IPv4 or self._prefixlen == 128
for IPv6), return a list with just ourself.
Args:
prefixlen_diff: An integer, the amount the prefix length
should be increased by. This should not be set if
new_prefix is also set.
new_prefix: The desired new prefix length. This must be a
larger number (smaller prefix) than the existing prefix.
This should not be set if prefixlen_diff is also set.
Returns:
An iterator of IPv(4|6) objects.
Raises:
ValueError: The prefixlen_diff is too small or too large.
OR
prefixlen_diff and new_prefix are both set or new_prefix
is a smaller number than the current prefix (smaller
number means a larger network)
Definition at line 825 of file ipaddr.py.
def multi_interface_roam::ipaddr::_BaseNet::iterhosts |
( |
|
self |
) |
|
Generate Iterator over usable hosts in a network.
This is like __iter__ except it doesn't return the network
or broadcast addresses.
Definition at line 488 of file ipaddr.py.
def multi_interface_roam::ipaddr::_BaseNet::numhosts |
( |
|
self |
) |
|
Number of hosts in the current subnet.
Definition at line 633 of file ipaddr.py.
def multi_interface_roam::ipaddr::_BaseNet::overlaps |
( |
|
self, |
|
|
|
other | |
|
) |
| | |
Tell if self is partly contained in other.
Definition at line 590 of file ipaddr.py.
def multi_interface_roam::ipaddr::_BaseNet::prefixlen |
( |
|
self |
) |
|
def multi_interface_roam::ipaddr::_BaseNet::subnet |
( |
|
self, |
|
|
|
prefixlen_diff = 1 , |
|
|
|
new_prefix = None | |
|
) |
| | |
Return a list of subnets, rather than an interator.
Definition at line 887 of file ipaddr.py.
def multi_interface_roam::ipaddr::_BaseNet::supernet |
( |
|
self, |
|
|
|
prefixlen_diff = 1 , |
|
|
|
new_prefix = None | |
|
) |
| | |
The supernet containing the current network.
Args:
prefixlen_diff: An integer, the amount the prefix length of
the network should be decreased by. For example, given a
/24 network and a prefixlen_diff of 3, a supernet with a
/21 netmask is returned.
Returns:
An IPv4 network object.
Raises:
ValueError: If self.prefixlen - prefixlen_diff < 0. I.e., you have a
negative prefix length.
OR
If prefixlen_diff and new_prefix are both set or new_prefix is a
larger number than the current prefix (larger number means a
smaller network)
Definition at line 891 of file ipaddr.py.
def multi_interface_roam::ipaddr::_BaseNet::version |
( |
|
self |
) |
|
def multi_interface_roam::ipaddr::_BaseNet::with_hostmask |
( |
|
self |
) |
|
def multi_interface_roam::ipaddr::_BaseNet::with_netmask |
( |
|
self |
) |
|
def multi_interface_roam::ipaddr::_BaseNet::with_prefixlen |
( |
|
self |
) |
|
Member Data Documentation
The documentation for this class was generated from the following file: