Top |
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".
GInetAddressMask * g_inet_address_mask_new (GInetAddress *addr
,guint length
,GError **error
);
Creates a new GInetAddressMask representing all addresses whose
first length
bits match addr
.
Since: 2.32
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
gchar *
g_inet_address_mask_to_string (GInetAddressMask *mask
);
Converts mask
back to its corresponding string form.
Since: 2.32
GSocketFamily
g_inet_address_mask_get_family (GInetAddressMask *mask
);
Gets the GSocketFamily of mask
's address
Since: 2.32
GInetAddress *
g_inet_address_mask_get_address (GInetAddressMask *mask
);
Gets mask
's base address
Since: 2.32
guint
g_inet_address_mask_get_length (GInetAddressMask *mask
);
Gets mask
's length
Since: 2.32
gboolean g_inet_address_mask_matches (GInetAddressMask *mask
,GInetAddress *address
);
Tests if address
falls within the range described by mask
.
Since: 2.32
gboolean g_inet_address_mask_equal (GInetAddressMask *mask
,GInetAddressMask *mask2
);
Tests if mask
and mask2
are the same mask.
Since: 2.32
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
“family”
property“family” GSocketFamily
The address family (IPv4 or IPv6).
Flags: Read
Default value: G_SOCKET_FAMILY_INVALID
“length”
property“length” guint
The prefix length.
Flags: Read / Write
Allowed values: <= 128
Default value: 0