Gio.InetAddressMask

g GObject.GInterface GObject.GInterface Gio.Initable Gio.Initable GObject.GInterface->Gio.Initable GObject.Object GObject.Object Gio.InetAddressMask Gio.InetAddressMask GObject.Object->Gio.InetAddressMask Gio.Initable->Gio.InetAddressMask

Subclasses:

None

Methods

Inherited:

GObject.Object (37), Gio.Initable (2)

Structs:

GObject.ObjectClass (5)

class

new (addr, length)

class

new_from_string (mask_string)

equal (mask2)

get_address ()

get_family ()

get_length ()

matches (address)

to_string ()

Virtual Methods

Inherited:

GObject.Object (7), Gio.Initable (1)

Properties

Name

Type

Flags

Short Description

address

Gio.InetAddress

r/w

family

Gio.SocketFamily

r

length

int

r/w

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_instance

GObject.Object

r

Class Details

class Gio.InetAddressMask(**kwargs)
Bases:

GObject.Object, Gio.Initable

Abstract:

No

Structure:

Gio.InetAddressMaskClass

GInetAddressMask represents a range of IPv4 or IPv6 addresses described by a base address and a length indicating how many bits of the base address are relevant for matching purposes. These are often given in string form. For example, 10.0.0.0/8, or fe80::/10.

New in version 2.32.

classmethod new(addr, length)[source]
Parameters:
Raises:

GLib.Error

Returns:

a new Gio.InetAddressMask, or None on error

Return type:

Gio.InetAddressMask

Creates a new Gio.InetAddressMask representing all addresses whose first length bits match addr.

New in version 2.32.

classmethod new_from_string(mask_string)[source]
Parameters:

mask_string (str) – an IP address or address/length string

Raises:

GLib.Error

Returns:

a new Gio.InetAddressMask corresponding to string, or None on error.

Return type:

Gio.InetAddressMask

Parses mask_string as an IP address and (optional) length, and creates a new Gio.InetAddressMask. The length, if present, is delimited by a “/”. If it is not present, then the length is assumed to be the full length of the address.

New in version 2.32.

equal(mask2)[source]
Parameters:

mask2 (Gio.InetAddressMask) – another Gio.InetAddressMask

Returns:

whether self and mask2 are the same mask

Return type:

bool

Tests if self and mask2 are the same mask.

New in version 2.32.

get_address()[source]
Returns:

self's base address

Return type:

Gio.InetAddress

Gets self's base address

New in version 2.32.

get_family()[source]
Returns:

the Gio.SocketFamily of self's address

Return type:

Gio.SocketFamily

Gets the Gio.SocketFamily of self's address

New in version 2.32.

get_length()[source]
Returns:

self's length

Return type:

int

Gets self's length

New in version 2.32.

matches(address)[source]
Parameters:

address (Gio.InetAddress) – a Gio.InetAddress

Returns:

whether address falls within the range described by self.

Return type:

bool

Tests if address falls within the range described by self.

New in version 2.32.

to_string()[source]
Returns:

a string corresponding to self.

Return type:

str

Converts self back to its corresponding string form.

New in version 2.32.

Property Details

Gio.InetAddressMask.props.address
Name:

address

Type:

Gio.InetAddress

Default Value:

None

Flags:

READABLE, WRITABLE

The base address.

New in version 2.32.

Gio.InetAddressMask.props.family
Name:

family

Type:

Gio.SocketFamily

Default Value:

Gio.SocketFamily.INVALID

Flags:

READABLE

The address family (IPv4 or IPv6).

New in version 2.32.

Gio.InetAddressMask.props.length
Name:

length

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE

The prefix length, in bytes.

New in version 2.32.