Function

Ibisdcc_host_parse

since: 0.14

Declaration [src]

GInetAddress*
ibis_dcc_host_parse (
  const char* host
)

Description [src]

Parses the host value from a DCC request.

The host parameter of a DCC request is the integer representation for IPv4 and the hex representation for IPv6. This function will attempt to parse either into a valid GInetAddress.

This will properly parse a positive 32 bit integer like 2130706433 into an IPv4 address of 127.0.0.1 and for IPv6 addresses it will parse the normal hexadecimal representation like ::1 to a localhost address.

Available since: 0.14

Parameters

host

Type: const char*

The host value.

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

Return value

Type: GInetAddress

The address if parsing was successful.

The caller of the function takes ownership of the data, and is responsible for freeing it.
The return value can be NULL.