Defines | Functions

sofia-sip/hostdomain.h File Reference

Predicates for handling host names: IP addresses or domain names. More...

#include <sofia-sip/su_config.h>
Include dependency graph for hostdomain.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.

Detailed Description

Predicates for handling host names: IP addresses or domain names.

Author:
Pekka Pessi <Pekka.Pessi@nokia-email.address.hidden>
Date:
Created: Thu Mar 9 16:15:22 EET 2006 ppessi

Define Documentation

#define SOFIA_SIP_HOSTDOMAIN_H

Defined when <sofia-sip/hostdomain.h> has been included.


Function Documentation

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.

Parameters:
a IP address or domain name
b IP address or domain name
Return values:
-1 if a < b
0 if a == b
1 if a > b
Since:
New in 1.12.4.
int host_ip6_reference ( char const *  string  ) 

This is typo.

Deprecated:
Use host_is_ip6_reference() instead.
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.

 hostname         =  *( domainlabel "." ) toplabel [ "." ]
 domainlabel      =  alphanum
                     / alphanum *( alphanum / "-" ) alphanum
 toplabel         =  ALPHA / ALPHA *( alphanum / "-" ) alphanum
int host_is_ip4_address ( char const *  string  ) 

Return true if string is valid IP4 address in dot-notation.

Note:
Only 4-octet form is accepted, e.g., 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.

 All Data Structures Files Functions Variables Enumerator Defines

Sofia-SIP 1.12.11 - Copyright (C) 2006 Nokia Corporation. All rights reserved. Licensed under the terms of the GNU Lesser General Public License.