NM.IPAddress¶
Fields¶
None
Methods¶
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- class NM.IPAddress¶
- classmethod new(family, addr, prefix)¶
- Parameters:
- Raises:
- Returns:
the new
NM.IPAddressobject, orNoneon error- Return type:
Creates a new
NM.IPAddressobject.
- classmethod new_binary(family, addr, prefix)¶
- Parameters:
- Raises:
- Returns:
the new
NM.IPAddressobject, orNoneon error- Return type:
Creates a new
NM.IPAddressobject. addr must point to a buffer of the correct size for family.
- cmp_full(b, cmp_flags)¶
- Parameters:
b (
NM.IPAddress) – theNM.IPAddressto compare address to.cmp_flags (
NM.IPAddressCmpFlags) – theNM.IPAddressCmpFlagsthat indicate what to compare.
- Returns:
0 if the two objects have the same values (according to their flags) or a integer indicating the compare order.
- Return type:
Note that with cmp_flags
NM.IPAddressCmpFlags.WITH_ATTRS, there is no total order for comparingGLib.Variant. That means, if the two addresses only differ by their attributes, the sort order is undefined and the return value only indicates equality.New in version 1.22.
- dup()¶
- Returns:
a copy of self
This API was part of public headers before 1.32.0 but was erroneously not exported in the ABI. It is thus only usable since 1.32.0.
- Return type:
Creates a copy of self
New in version 1.32.
- equal(other)¶
- Parameters:
other (
NM.IPAddress) – theNM.IPAddressto compare self to.- Returns:
Trueif the objects contain the same values,Falseif they do not.- Return type:
Determines if two
NM.IPAddressobjects contain the same address and prefix (attributes are not compared).
- get_address()¶
- Returns:
the IP address
- Return type:
Gets the IP address property of this address object.
- get_attribute(name)¶
- Parameters:
name (
str) – the name of an address attribute- Returns:
the value of the attribute with name name on self, or
Noneif self has no such attribute.- Return type:
Gets the value of the attribute with name name on self
- get_attribute_names()¶
-
Gets an array of attribute names defined on self.
- get_family()¶
- Returns:
the IP address family
- Return type:
Gets the IP address family (eg, AF_INET) property of this address object.
- get_prefix()¶
- Returns:
the IP address prefix
- Return type:
Gets the IP address prefix (ie “24” or “30” etc) property of this address object.
- ref()¶
Increases the reference count of the object.
- set_address(addr)¶
- Parameters:
addr (
str) – the IP address, as a string
Sets the IP address property of this address object.
addr must be a valid address of self's family. If you aren’t sure you have a valid address, use
NM.utils_ipaddr_valid() to check it.
- set_attribute(name, value)¶
- Parameters:
name (
str) – the name of an address attributevalue (
GLib.VariantorNone) – the value
Sets or clears the named attribute on self to the given value.
- set_prefix(prefix)¶
- Parameters:
prefix (
int) – the IP address prefix
Sets the IP address prefix property of this address object.
- unref()¶
Decreases the reference count of the object. If the reference count reaches zero, the object will be destroyed.