Function

GLibhostname_is_ip_address

Declaration

gboolean
g_hostname_is_ip_address (
  const gchar* hostname
)

Description

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 const gchar*
 

A hostname (or IP address in string form)

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

Return value

Returns: gboolean
 

TRUE if hostname is an IP address.