Name
is_valid_IP — Determines whether or not string is a valid IP address
Synopsis
#include "dns.h"
| int **is_valid_IP** ( | string, | |
| | family, | |
| | address); | |
const char * <var class="pdparam">string</var>;
u_int8_t * <var class="pdparam">family</var>;
struct in6_addr * <var class="pdparam">address</var>;
Description
Determines whether or not string is a valid IP address.
- string
-
The string to be validated.
- family
-
As a side effect, this address will be populated with one of the following values:
AF_INET,AF_INET6, orAF_UNSPEC.The following typedef applies to the
u_int8_tdata type:typedef uint8_t u_int8_t; - address
-
An address of the system struct
struct in6_addr. As a side effect, this address will be populated with eitherstruct in6_addr (AF_INET6)data orstruct in_addr (AF_INET)data. IffamilyisAF_INET, then the caller should cast the value ofaddressto astruct in_addrin order to access the data structure for an IPv4 address.
This is a Boolean function that returns 1 if string is valid IP address and 0 otherwise. If the string validates, then address will have struct in6_addr data.
It is legal to call this function in any thread.