Function

GLibhostname_is_ip_address

since: 2.22

Declaration [src]

gboolean
g_hostname_is_ip_address (
  const gchar* hostname
)

Description [src]

Tests if hostname is the string form of an IPv4 or IPv6 address. (Eg, “192.168.0.1”.)

Since 2.66, IPv6 addresses with a zone-id are accepted (RFC6874).

Available since: 2.22

Parameters

hostname

Type: const gchar*

A hostname (or IP address in string form).

The data is owned by the caller of the function.
The value is a NUL terminated UTF-8 string.

Return value

Type: gboolean

TRUE if hostname is an IP address.