Home | Trees | Index | Help |
---|
Module ipaddr :: Class 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 | |
---|---|
Instantiate a new IPv6 object. | |
Change the prefix length. | |
The subnets which join to make the current subnet. | |
The supernet containing the current network. | |
Compresses a list of hextets. | |
Expand a shortened IPv6 address. | |
Turn an IPv6 address into an integer. | |
Determine if the address is shortened. | |
Ensure we have a valid IPv6 address. | |
Verify that the netmask/prefixlen is valid. | |
Turns a 128-bit integer into hexadecimal notation. | |
Inherited from BaseIP | |
| |
Return True if other is contained by self. | |
| |
| |
| |
| |
| |
| |
| |
| |
Remove an address from a larger block. | |
Compare two IP objects. | |
Return True if other is contained by self. | |
Turn the prefix length netmask into a int for comparison. | |
Turn a prefix length into a dotted decimal string. | |
Return prefix length from the decimal netmask. | |
Inherited from object | |
x.__delattr__('name') <==> del x.name | |
x.__getattribute__('name') <==> x.name | |
T.__new__(S, ...) -> a new object with type S, a subtype of T | |
helper for pickle | |
helper for pickle | |
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 |
Class Variable Summary | |
---|---|
long |
_ALL_ONES = 340282366920938463463374607431768211455L
|
Method Details |
---|
__init__(self,
ipaddr)
|
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. |
_CompressHextets(self, hextets)Compresses a list of hextets. Compresses a list of strings, replacing the longest continuous sequence of "0" in the list with "" and adding empty strings at the beginning or at the end of the string such that subsequently calling ":".join(hextets) will produce the compressed version of the IPv6 address. Args: hextets: A list of strings, the hextets to compress. Returns: A list of strings. |
_ExplodeShortHandIpStr(self, ip_str)Expand a shortened IPv6 address. Args: ip_str: A string, the IPv6 address. Returns: A string, the expanded IPv6 address. |
_IpIntFromStr(self, ip_str=None)Turn an IPv6 address into an integer. Args: ip_str: A string, the IPv6 address. Returns: A long, the IPv6 address. |
_IsShortHandIp(self, ip_str=None)Determine if the address is shortened. Args: ip_str: A string, the IPv6 address. Returns: A boolean, True if the address is shortened. |
_IsValidIp(self, ip_str=None)Ensure we have a valid IPv6 address. Probably not as exhaustive as it should be. Args: ip_str: A string, the IPv6 address. Returns: A boolean, True if this is a valid IPv6 address. |
_IsValidNetmask(self, prefixlen)Verify that the netmask/prefixlen is valid. Args: prefixlen: A string, the netmask in prefix length format. Returns: A boolean, True if the prefix represents a valid IPv6 netmask. |
_StrFromIpInt(self, ip_int=None)Turns a 128-bit integer into hexadecimal notation. Args: ip_int: An integer, the IP address. Returns: A string, the hexadecimal representation of the address. Raises: ValueError: The address is bigger than 128 bits of all ones. |
Property Details |
---|
ip_ext_full
|
netmask_ext
|
version
|
Class Variable Details |
---|
_ALL_ONES
|
Home | Trees | Index | Help |
---|
Generated by Epydoc 2.1 on Tue Feb 3 11:02:37 2009 | http://epydoc.sf.net |