Gio.InetAddressMask¶
class — extends GObject.Object, Initable
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.
Constructors¶
new¶
Creates a new InetAddressMask representing all addresses whose
first length bits match addr.
Parameters:
addr— aInetAddresslength— number of bits ofaddrto use
new_from_string¶
Parses mask_string as an IP address and (optional) length, and
creates a new 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.
Parameters:
mask_string— an IP address or address/length string
Methods¶
equal¶
Tests if mask and mask2 are the same mask.
Parameters:
mask2— anotherInetAddressMask
get_address¶
Gets mask's base address
get_family¶
Gets the SocketFamily of mask's address
get_length¶
Gets mask's length
matches¶
Tests if address falls within the range described by mask.
Parameters:
address— aInetAddress
to_string¶
Converts mask back to its corresponding string form.
Properties¶
address¶
The base address.
family¶
The address family (IPv4 or IPv6).
length¶
The prefix length, in bytes.