GInetAddressMask
GInetAddressMask — An IPv4/IPv6 address mask
|
|
Object Hierarchy
GObject
╰── GInetAddressMask
Implemented Interfaces
GInetAddressMask implements
GInitable.
Includes
#include <gio/gio.h>
Description
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. Eg, "10.0.0.0/8", or "fe80::/10".
Functions
g_inet_address_mask_new_from_string ()
GInetAddressMask *
g_inet_address_mask_new_from_string (const gchar *mask_string,
GError **error);
Parses mask_string
as an IP address and (optional) length, and
creates a new GInetAddressMask. 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.
Since: 2.32
g_inet_address_mask_to_string ()
gchar *
g_inet_address_mask_to_string (GInetAddressMask *mask);
Converts mask
back to its corresponding string form.
Returns
a string corresponding to mask
.
Since: 2.32
g_inet_address_mask_get_address ()
GInetAddress *
g_inet_address_mask_get_address (GInetAddressMask *mask);
Gets mask
's base address
Returns
mask
's base address.
[transfer none]
Since: 2.32
g_inet_address_mask_get_length ()
guint
g_inet_address_mask_get_length (GInetAddressMask *mask);
Gets mask
's length
Since: 2.32
g_inet_address_mask_matches ()
gboolean
g_inet_address_mask_matches (GInetAddressMask *mask,
GInetAddress *address);
Tests if address
falls within the range described by mask
.
Returns
whether address
falls within the range described by
mask
.
Since: 2.32
g_inet_address_mask_equal ()
gboolean
g_inet_address_mask_equal (GInetAddressMask *mask,
GInetAddressMask *mask2);
Tests if mask
and mask2
are the same mask.
Returns
whether mask
and mask2
are the same mask
Since: 2.32
Types and Values
GInetAddressMask
typedef struct _GInetAddressMask GInetAddressMask;
A combination of an IPv4 or IPv6 base address and a length,
representing a range of IP addresses.
Since: 2.32
Property Details
The “address” property
“address” GInetAddress *
The base address.
Owner: GInetAddressMask
Flags: Read / Write
The “family” property
“family” GSocketFamily
The address family (IPv4 or IPv6).
Owner: GInetAddressMask
Flags: Read
Default value: G_SOCKET_FAMILY_INVALID
The “length” property
“length” guint
The prefix length.
Owner: GInetAddressMask
Flags: Read / Write
Allowed values: <= 128
Default value: 0