| Home | Trees | Index | Help |
|---|
| Module ipaddr :: Class IPv4 |
|
object--+ |BaseIP--+ | IPv4
This class represents and manipulates 32-bit IPv4 addresses.
Attributes: [examples for IPv4('1.2.3.4/27')]
.ip: 16909060
.ip_ext: '1.2.3.4'
.ip_ext_full: '1.2.3.4'
.network: 16909056L
.network_ext: '1.2.3.0'
.hostmask: 31L (0x1F)
.hostmask_ext: '0.0.0.31'
.broadcast: 16909087L (0x102031F)
.broadcast_ext: '1.2.3.31'
.netmask: 4294967040L (0xFFFFFFE0)
.netmask_ext: '255.255.255.224'
.prefixlen: 27
| Method Summary | |
|---|---|
Instantiate a new IPv4 object. | |
Test if the address is reserved for LinkLocal. | |
Test if the address is a loopback adddress. | |
Test if the address is reserved for multicast use. | |
Test if the IPv4 address is reserved per RFC1918. | |
Change the prefix length. | |
The subnets which join to make the current subnet. | |
The supernet containing the current network. | |
| 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. | |
| 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 | |
|---|---|
version | |
| Inherited from BaseIP | |
broadcast | |
broadcast_ext | |
hostmask | |
hostmask_ext | |
ip_ext | |
ip_ext_full | |
netmask_ext | |
network | |
network_ext | |
numhosts | |
| Method Details |
|---|
__init__(self,
ipaddr)
|
IsLinkLocal(self)
Test if the address is reserved for LinkLocal.
Returns:
A boolean, True if the address is link local.
|
IsLoopback(self)
Test if the address is a loopback adddress.
Returns:
A boolean, True if the address is a loopback.
|
IsMulticast(self)
Test if the address is reserved for multicast use.
Returns:
A boolean, True if the address is multicast.
|
IsRFC1918(self)
Test if the IPv4 address is reserved per RFC1918.
Returns:
A boolean, True if the address is reserved.
|
SetPrefix(self, prefixlen)
Change the prefix length.
Args:
prefixlen: An integer, the new prefix length.
Raises:
IPv4NetmaskValidationError: 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 == 32), return a list with just ourself.
Args:
prefixlen_diff: An integer, the amount the prefix length
should be increased by. Given a /24 network and a
prefixlen_diff of 3, for example, 8 subnets of size /27
will be returned. The default value of 1 splits the
current network into two halves.
Returns:
A list of IPv4 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
/24 network and a prefixlen_diff of 3, a supernet with a
/21 netmask is returned.
Returns:
An IPv4 object.
Raises:
PrefixlenDiffInvalidError: If
self.prefixlen - prefixlen_diff < 0. I.e., you have a
negative prefix length.
|
| Property Details |
|---|
version
|
| Home | Trees | Index | Help |
|---|
| Generated by Epydoc 2.1 on Tue Feb 3 11:02:37 2009 | http://epydoc.sf.net |