| libinfinity-0.5 Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | Object Hierarchy | ||||
#include <libinfinity/common/inf-ip-address.h>
InfIpAddress;
enum InfIpAddressFamily;
InfIpAddress * inf_ip_address_new_raw4 (guint32 address);
InfIpAddress * inf_ip_address_new_loopback4 (void);
InfIpAddress * inf_ip_address_new_raw6 (const guint8 address[16]);
InfIpAddress * inf_ip_address_new_loopback6 (void);
InfIpAddress * inf_ip_address_new_from_string (const gchar *str);
InfIpAddress * inf_ip_address_copy (const InfIpAddress *address);
void inf_ip_address_free (InfIpAddress *address);
InfIpAddressFamily inf_ip_address_get_family (const InfIpAddress *address);
gconstpointer inf_ip_address_get_raw (const InfIpAddress *address);
gchar * inf_ip_address_to_string (const InfIpAddress *address);
int inf_ip_address_collate (const InfIpAddress *address1,
const InfIpAddress *address2);
A InfIpAddress represents an IPv4 or an IPv6 network address. Use
inf_ip_address_get_family() to find out the type of a specific address.
typedef struct _InfIpAddress InfIpAddress;
InfIpAddress is an opaque data type. You should only access it via the public API functions.
typedef enum {
INF_IP_ADDRESS_IPV4,
INF_IP_ADDRESS_IPV6
} InfIpAddressFamily;
This enumeration specifies different types of IP addresses.
InfIpAddress * inf_ip_address_new_raw4 (guint32 address);
Creates a new IPv4 address.
|
An IPv4 address in network byte order. |
Returns : |
A new InfIpAddress. |
InfIpAddress * inf_ip_address_new_loopback4 (void);
Creates a new IPv4 address that contains the local host's IP address ("127.0.0.1").
Returns : |
A new InfIpAddress. |
InfIpAddress * inf_ip_address_new_raw6 (const guint8 address[16]);
Creates a new IPv6 address.
|
An IPv6 address in network bype order. |
Returns : |
A new InfIpAddress. |
InfIpAddress * inf_ip_address_new_loopback6 (void);
Creates a new IPv6 address that contains the local host's IP address ("::1").
Returns : |
A new InfIpAddress. |
InfIpAddress * inf_ip_address_new_from_string (const gchar *str);
Creates a new IP address (either IPv4 or IPv6) from the given string.
|
A string containing an IPv4 or IPv6 address in standard dots notation. |
Returns : |
A new InfIpAddress, or NULL. |
InfIpAddress * inf_ip_address_copy (const InfIpAddress *address);
Creates a new InfIpAddress that contains the same address as address.
|
A InfIpAddress. |
Returns : |
A new InfIpAddress. |
void inf_ip_address_free (InfIpAddress *address);
Frees address.
|
A InfIpAddress. |
InfIpAddressFamily inf_ip_address_get_family (const InfIpAddress *address);
Returns the address family of address.
|
A InfIpAddress. |
Returns : |
A InfIpAddressFamily. |
gconstpointer inf_ip_address_get_raw (const InfIpAddress *address);
Returns either 32 bit (IPv4) or 128 bit (IPv6) raw address data in host
byte order of address.
|
A InfIpAddress. |
Returns : |
The raw address. |
gchar * inf_ip_address_to_string (const InfIpAddress *address);
Returns a string representation of address in standard dots format (like
"192.168.0.1" or "::1").
|
A InfIpAddress. |
Returns : |
A newly-allocated string. Free with g_free(). |
int inf_ip_address_collate (const InfIpAddress *address1,const InfIpAddress *address2);
Compares the two addresses for sorting.
|
First address. |
|
Second address. |
Returns : |
-1 if address1 compares before, 0 if it compares equal or
1 if it compares after address. |