GIO Reference Manual | ||||
---|---|---|---|---|
Top | Description |
GInetAddressMask; GInetAddressMask * g_inet_address_mask_new (GInetAddress *addr
,guint length
,GError **error
); GInetAddressMask * g_inet_address_mask_new_from_string (const gchar *mask_string
,GError **error
); gchar * g_inet_address_mask_to_string (GInetAddressMask *mask
); GSocketFamily g_inet_address_mask_get_family (GInetAddressMask *mask
); GInetAddress * g_inet_address_mask_get_address (GInetAddressMask *mask
); guint g_inet_address_mask_get_length (GInetAddressMask *mask
); gboolean g_inet_address_mask_matches (GInetAddressMask *mask
,GInetAddress *address
); gboolean g_inet_address_mask_equal (GInetAddressMask *mask
,GInetAddressMask *mask2
);
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".
typedef struct { GObject parent_instance; } GInetAddressMask;
A combination of an IPv4 or IPv6 base address and a length, representing a range of IP addresses.
Since 2.32
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
.
|
a GInetAddress |
|
number of bits of addr to use |
|
return location for GError, or NULL
|
Returns : |
a new GInetAddressMask, or NULL on error |
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.
|
an IP address or address/length string |
|
return location for GError, or NULL
|
Returns : |
a new GInetAddressMask corresponding to string , or NULL
on error. |
Since 2.32
gchar * g_inet_address_mask_to_string (GInetAddressMask *mask
);
Converts mask
back to its corresponding string form.
|
a GInetAddressMask |
Returns : |
a string corresponding to mask . |
Since 2.32
GSocketFamily g_inet_address_mask_get_family (GInetAddressMask *mask
);
Gets the GSocketFamily of mask
's address
|
a GInetAddressMask |
Returns : |
the GSocketFamily of mask 's address |
Since 2.32
GInetAddress * g_inet_address_mask_get_address (GInetAddressMask *mask
);
Gets mask
's base address
|
a GInetAddressMask |
Returns : |
mask 's base address. [transfer none]
|
Since 2.32
guint g_inet_address_mask_get_length (GInetAddressMask *mask
);
Gets mask
's length
|
a GInetAddressMask |
Returns : |
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
.
|
a GInetAddressMask |
|
a GInetAddress |
Returns : |
whether 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.
|
a GInetAddressMask |
|
another GInetAddressMask |
Returns : |
whether mask and mask2 are the same mask |
Since 2.32