Infinity.IpAddress

Fields

None

Methods

class

new_from_string (str)

class

new_loopback4 ()

class

new_loopback6 ()

class

new_raw4 (address)

class

new_raw6 (address)

collate (address2)

copy ()

free ()

get_family ()

get_raw ()

to_string ()

Details

class Infinity.IpAddress

Infinity.IpAddress is an opaque data type. You should only access it via the public API functions.

classmethod new_from_string(str)
Parameters:

str (str) – A string containing an IPv4 or IPv6 address in standard dots notation.

Returns:

A new Infinity.IpAddress, or None.

Return type:

Infinity.IpAddress

Creates a new IP address (either IPv4 or IPv6) from the given string.

classmethod new_loopback4()
Returns:

A new Infinity.IpAddress.

Return type:

Infinity.IpAddress

Creates a new IPv4 address that contains the local host’s IP address (“127.0.0.1”).

classmethod new_loopback6()
Returns:

A new Infinity.IpAddress.

Return type:

Infinity.IpAddress

Creates a new IPv6 address that contains the local host’s IP address (”::1”).

classmethod new_raw4(address)
Parameters:

address (int) – An IPv4 address in network byte order.

Returns:

A new Infinity.IpAddress.

Return type:

Infinity.IpAddress

Creates a new IPv4 address.

classmethod new_raw6(address)
Parameters:

address (int) – An IPv6 address in network bype order.

Returns:

A new Infinity.IpAddress.

Return type:

Infinity.IpAddress

Creates a new IPv6 address.

collate(address2)
Parameters:

address2 (Infinity.IpAddress) – Second address.

Returns:

-1 if self compares before, 0 if it compares equal or 1 if it compares after address.

Return type:

int

Compares the two addresses for sorting.

copy()
Returns:

A new Infinity.IpAddress.

Return type:

Infinity.IpAddress

Creates a new Infinity.IpAddress that contains the same address as self.

free()

Frees self.

get_family()
Returns:

A Infinity.IpAddressFamily.

Return type:

Infinity.IpAddressFamily

Returns the address family of self.

get_raw()
Returns:

The raw address.

Return type:

object or None

Returns either 32 bit (IPv4) or 128 bit (IPv6) raw address data in host byte order of self.

to_string()
Returns:

A newly-allocated string. Free with GLib.free().

Return type:

str

Returns a string representation of self in standard dots format (like “192.168.0.1” or “::1”).