Predicates for handling host names: IP addresses or domain names. More...
#include <sofia-sip/su_config.h>
Go to the source code of this file.
Defines | |
#define | SOFIA_SIP_HOSTDOMAIN_H |
Defined when <sofia-sip/hostdomain.h> has been included. | |
Functions | |
int | host_is_ip4_address (char const *string) |
Return true if string is valid IP4 address in dot-notation. | |
int | host_is_ip6_address (char const *string) |
Return true if string is valid IP6 address in hex notation. | |
int | host_is_ip6_reference (char const *string) |
Return true if string is valid IP6 reference, i.e. | |
int | host_is_ip_address (char const *string) |
Return true if string is valid IP address. | |
int | host_is_domain (char const *string) |
Return true if string is valid a domain name. | |
int | host_is_valid (char const *string) |
Return true if string is valid a host name. | |
int | host_is_local (char const *string) |
Returns true if string is describing a local address. | |
int | host_has_domain_invalid (char const *string) |
Return true if string has domain name in "invalid." domain. | |
int | host_cmp (char const *a, char const *b) |
Compare two host names or IP addresses. | |
int | host_ip6_reference (char const *string) |
This is typo. |
Predicates for handling host names: IP addresses or domain names.
#define SOFIA_SIP_HOSTDOMAIN_H |
Defined when <sofia-sip/hostdomain.h> has been included.
int host_cmp | ( | char const * | a, | |
char const * | b | |||
) |
Compare two host names or IP addresses.
Converts valid IP addresses to the binary format before comparing them. Note that IP6-mapped IP4 addresses and IP6-compatible IP4 addresses are compared as IP4 addresses; that is, ::ffff:127.0.0.1, ::127.0.0.1 and 127.0.0.1 all are all equal.
a | IP address or domain name | |
b | IP address or domain name |
-1 | if a < b | |
0 | if a == b | |
1 | if a > b |
int host_ip6_reference | ( | char const * | string | ) |
This is typo.
int host_is_domain | ( | char const * | string | ) |
Return true if string is valid a domain name.
Valid domain name consists of alphanumeric labels separated with dot ("."). There can be a "-" in the middle of label. The last label must start with a letter.
int host_is_ip4_address | ( | char const * | string | ) |
Return true if string is valid IP4 address in dot-notation.
127.1
is not considered valid IP4 address. int host_is_ip6_address | ( | char const * | string | ) |
Return true if string is valid IP6 address in hex notation.
E.g., fe80::1 is a valid IP6 address.
int host_is_ip6_reference | ( | char const * | string | ) |
Return true if string is valid IP6 reference, i.e.
hex notation in square brackets.
E.g., [::1] is a valid IP6 reference.
int host_is_ip_address | ( | char const * | string | ) |
Return true if string is valid IP address.
Valid IP address is either a IP4 adddress in quad-octet notation, IP6 hex address or IP6 reference in square brackets ([]).
int host_is_local | ( | char const * | host | ) |
Returns true if string is describing a local address.
Uses the definitions of local addresses found in RFC1700 and RFC4291.
int host_is_valid | ( | char const * | string | ) |
Return true if string is valid a host name.
Check if the string is a domain name, IP address or IP6 reference.