Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Private Attributes
multi_interface_roam.ipaddr._BaseNet Class Reference
Inheritance diagram for multi_interface_roam.ipaddr._BaseNet:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def __contains__
def __eq__
def __ge__
def __getitem__
def __gt__
def __hash__
def __init__
def __iter__
def __le__
def __lt__
def __ne__
def __repr__
def __str__
def address_exclude
def broadcast
def compare_networks
def hostmask
def iter_subnets
def iterhosts
def network
def numhosts
def overlaps
def prefixlen
def subnet
def supernet
def version
def with_hostmask
def with_netmask
def with_prefixlen

Public Attributes

 network

Static Public Attributes

 AddressExclude = address_exclude
 CompareNetworks = compare_networks
 Contains = __contains__
 Subnet = subnet
 Supernet = supernet

Private Member Functions

def _get_networks_key
def _ip_int_from_prefix
def _ip_string_from_prefix
def _prefix_from_ip_int

Private Attributes

 _cache
 _prefixlen
 _version

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.


Constructor & Destructor Documentation

def multi_interface_roam.ipaddr._BaseNet.__init__ (   self,
  address 
)

Definition at line 482 of file ipaddr.py.


Member Function Documentation

Definition at line 580 of file ipaddr.py.

def multi_interface_roam.ipaddr._BaseNet.__eq__ (   self,
  other 
)

Definition at line 559 of file ipaddr.py.

def multi_interface_roam.ipaddr._BaseNet.__ge__ (   self,
  other 
)

Definition at line 553 of file ipaddr.py.

Definition at line 508 of file ipaddr.py.

def multi_interface_roam.ipaddr._BaseNet.__gt__ (   self,
  other 
)

Definition at line 534 of file ipaddr.py.

Definition at line 577 of file ipaddr.py.

Definition at line 501 of file ipaddr.py.

def multi_interface_roam.ipaddr._BaseNet.__le__ (   self,
  other 
)

Definition at line 547 of file ipaddr.py.

def multi_interface_roam.ipaddr._BaseNet.__lt__ (   self,
  other 
)

Definition at line 521 of file ipaddr.py.

def multi_interface_roam.ipaddr._BaseNet.__ne__ (   self,
  other 
)

Definition at line 567 of file ipaddr.py.

Definition at line 485 of file ipaddr.py.

Definition at line 573 of file ipaddr.py.

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.

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.

Definition at line 604 of file ipaddr.py.

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.

Definition at line 612 of file ipaddr.py.

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.

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.

Definition at line 596 of file ipaddr.py.

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.

Definition at line 642 of file ipaddr.py.

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.

Definition at line 638 of file ipaddr.py.

Definition at line 629 of file ipaddr.py.

Definition at line 625 of file ipaddr.py.

Definition at line 621 of file ipaddr.py.


Member Data Documentation

Definition at line 482 of file ipaddr.py.

Definition at line 559 of file ipaddr.py.

Definition at line 934 of file ipaddr.py.

Definition at line 935 of file ipaddr.py.

Definition at line 936 of file ipaddr.py.

Definition at line 559 of file ipaddr.py.

Definition at line 932 of file ipaddr.py.

Definition at line 933 of file ipaddr.py.


The documentation for this class was generated from the following file:


multi_interface_roam
Author(s): Blaise Gassend
autogenerated on Thu Apr 24 2014 15:34:18