bool rascal_aton( const char *symbolic, addr_t *addr, addr_t *mask OPTIONAL );
Converts an address from its text representation to the numeric form. The string can be of one of the following forms:
Four octets of an IPv4 address in dotted quad notation. The mask
parameter is set to 255.255.255.255
.
rascal_aton("127.0.0.1", &addr, NULL);
An IPv4 address and a network mask in dotted quad notation, separated by a slash.
rascal_aton("127.0.0.0/255.0.0.0", &addr, &mask);
An IPv4 address and a network range (an integer number of significant higher bits of the address) separated by a slash.
rascal_aton("192.168.0.0/16", &addr, &mask);
The mask is ignored if the mask
parameter is a null pointer or if the pattern does not contain a network mask.
Return value.
If the address could be interpreted, the function returns REC_SUCCESS and addr
and mask
structures receive the corresponding data. If the mask
parameter was not specified, the corresponding part of the source string is ignored.
When the function fails, the corresponding error message can be retreived by a call to rascal_get_errmsg
. In that case, the content of addr
and mask
structures is undetermined.