Module ipaddr :: Class IPv6
[show private | hide private]
[frames | no frames]

Type IPv6

object --+    
         |    
    BaseIP --+
             |
            IPv6


This class respresents and manipulates 128-bit IPv6 addresses.

Attributes: [examples for IPv6('2001:658:22A:CAFE:200::1/64')]
    .ip: 42540616829182469433547762482097946625L
    .ip_ext: '2001:658:22a:cafe:200::1'
    .ip_ext_full: '2001:0658:022a:cafe:0200:0000:0000:0001'
    .network: 42540616829182469433403647294022090752L
    .network_ext: '2001:658:22a:cafe::'
    .hostmask: 18446744073709551615L
    .hostmask_ext: '::ffff:ffff:ffff:ffff'
    .broadcast: 42540616829182469451850391367731642367L
    .broadcast_ext: '2001:658:22a:cafe:ffff:ffff:ffff:ffff'
    .netmask: 340282366920938463444927863358058659840L
    .netmask_ext: 64
    .prefixlen: 64

Method Summary
  __init__(self, ipaddr)
Instantiate a new IPv6 object.
  SetPrefix(self, prefixlen)
Change the prefix length.
  Subnet(self, prefixlen_diff)
The subnets which join to make the current subnet.
  Supernet(self, prefixlen_diff)
The supernet containing the current network.
    Inherited from BaseIP
  __cmp__(self, other)
  __contains__(self, other)
Return True if other is contained by self.
  __eq__(self, other)
  __getitem__(self, n)
  __hash__(self)
  __hex__(self)
  __int__(self)
  __ne__(self, other)
  __repr__(self)
  __str__(self)
  AddressExclude(self, other)
Remove an address from a larger block.
  CompareNetworks(self, other)
Compare two IP objects.
  Contains(self, other)
Return True if other is contained by self.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name
  __getattribute__(...)
x.__getattribute__('name') <==> x.name
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T
  __reduce__(...)
helper for pickle
  __reduce_ex__(...)
helper for pickle
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value

Property Summary
  ip_ext_full
  netmask_ext
  version
    Inherited from BaseIP
  broadcast
  broadcast_ext
  hostmask
  hostmask_ext
  ip_ext
  network
  network_ext
  numhosts

Method Details

__init__(self, ipaddr)
(Constructor)

Instantiate a new IPv6 object.

Args:
    ipaddr: A string or integer representing the IP or the IP
      and prefix/netmask.
      '2001:4860::/128'
      '2001:4860:0000:0000:0000:0000:0000:0000/128'
      '2001:4860::'
      are all functionally the same in IPv6.  That is to say,
      failing to provide a subnetmask will create an object with
      a mask of /128.

      Additionally, an integer can be passed, so
      IPv6('2001:4860::') ==
      IPv6(42541956101370907050197289607612071936L).
      or, more generally
      IPv6(IPv6('2001:4860::').ip) == IPv6('2001:4860::')

Raises:
    IPv6IpValidationError: If ipaddr isn't a valid IPv6 address.
    IPv6NetmaskValidationError: If the netmask isn't valid for
      an IPv6 address.
Overrides:
__builtin__.object.__init__

SetPrefix(self, prefixlen)

Change the prefix length.

Args:
    prefixlen: An integer, the new prefix length.

Raises:
    IPv6NetmaskValidationError: If prefixlen is out of bounds.

Subnet(self, prefixlen_diff=1)

The subnets which join to make the current subnet.

In the case that self contains only one IP
(self.prefixlen == 128), return a list with just ourself.

Args:
    prefixlen_diff: An integer, the amount the prefix length
      should be increased by.

Returns:
    A list of IPv6 objects.

Raises:
    PrefixlenDiffInvalidError: The prefixlen_diff is too small
      or too large.

Supernet(self, prefixlen_diff=1)

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 /96
      network and a prefixlen_diff of 3, a supernet with a /93
      netmask is returned.

Returns:
    An IPv6 object.

Raises:
    PrefixlenDiffInvalidError: If
      self.prefixlen - prefixlen_diff < 0. I.e., you have a
      negative prefix length.

Property Details

ip_ext_full

Get Method:
ip_ext_full(...)

netmask_ext

Get Method:
netmask_ext(...)

version

Get Method:
version(...)

Generated by Epydoc 2.1 on Tue Feb 3 11:02:37 2009 http://epydoc.sf.net