![]() |
![]() |
![]() |
GIO Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
GInetAddress; GInetAddress * g_inet_address_new_from_string (const gchar *string); GInetAddress * g_inet_address_new_from_bytes (const guint8 *bytes, GSocketFamily family); GInetAddress * g_inet_address_new_any (GSocketFamily family); GInetAddress * g_inet_address_new_loopback (GSocketFamily family); const guint8 * g_inet_address_to_bytes (GInetAddress *address); gsize g_inet_address_get_native_size (GInetAddress *address); gchar * g_inet_address_to_string (GInetAddress *address); GSocketFamily g_inet_address_get_family (GInetAddress *address); gboolean g_inet_address_get_is_any (GInetAddress *address); gboolean g_inet_address_get_is_loopback (GInetAddress *address); gboolean g_inet_address_get_is_link_local (GInetAddress *address); gboolean g_inet_address_get_is_site_local (GInetAddress *address); gboolean g_inet_address_get_is_multicast (GInetAddress *address); gboolean g_inet_address_get_is_mc_link_local (GInetAddress *address); gboolean g_inet_address_get_is_mc_node_local (GInetAddress *address); gboolean g_inet_address_get_is_mc_site_local (GInetAddress *address); gboolean g_inet_address_get_is_mc_org_local (GInetAddress *address); gboolean g_inet_address_get_is_mc_global (GInetAddress *address);
GInetAddress represents an IPv4 or IPv6 internet address. Use
g_resolver_lookup_by_name()
or g_resolver_lookup_by_name_async()
to
look up the GInetAddress for a hostname. Use
g_resolver_lookup_by_address()
or
g_resolver_lookup_by_address_async()
to look up the hostname for a
GInetAddress.
To actually connect to a remote host, you will need a GInetSocketAddress (which includes a GInetAddress as well as a port number).
typedef struct { GObject parent_instance; } GInetAddress;
An IPv4 or IPv6 internet address.
GInetAddress * g_inet_address_new_from_string (const gchar *string);
Parses string
as an IP address and creates a new GInetAddress.
|
a string representation of an IP address |
Returns : |
a new GInetAddress corresponding to string , or NULL if
string could not be parsed.
|
Since 2.22
GInetAddress * g_inet_address_new_from_bytes (const guint8 *bytes, GSocketFamily family);
Creates a new GInetAddress from the given family
and bytes
.
bytes
should be 4 bytes for G_INET_ADDRESS_IPV4
and 16 bytes for
G_INET_ADDRESS_IPV6
.
|
raw address data |
|
the address family of bytes
|
Returns : |
a new GInetAddress corresponding to family and bytes .
|
Since 2.22
GInetAddress * g_inet_address_new_any (GSocketFamily family);
Creates a GInetAddress for the "any" address (unassigned/"don't
care") for family
.
|
the address family |
Returns : |
a new GInetAddress corresponding to the "any" address
for family .
|
Since 2.22
GInetAddress * g_inet_address_new_loopback (GSocketFamily family);
Creates a GInetAddress for the loopback address for family
.
|
the address family |
Returns : |
a new GInetAddress corresponding to the loopback address
for family .
|
Since 2.22
const guint8 * g_inet_address_to_bytes (GInetAddress *address);
Gets the raw binary address data from address
.
|
a GInetAddress |
Returns : |
a pointer to an internal array of the bytes in address ,
which should not be modified, stored, or freed. The size of this
array can be gotten with g_inet_address_get_native_size() .
|
Since 2.22
gsize g_inet_address_get_native_size (GInetAddress *address);
Gets the size of the native raw binary address for address
. This
is the size of the data that you get from g_inet_address_to_bytes()
.
|
a GInetAddress |
Returns : |
the number of bytes used for the native version of address .
|
Since 2.22
gchar * g_inet_address_to_string (GInetAddress *address);
Converts address
to string form.
|
a GInetAddress |
Returns : |
a representation of address as a string, which should be
freed after use.
|
Since 2.22
GSocketFamily g_inet_address_get_family (GInetAddress *address);
Gets address
's family
|
a GInetAddress |
Returns : |
address 's family
|
Since 2.22
gboolean g_inet_address_get_is_any (GInetAddress *address);
Tests whether address
is the "any" address for its family.
|
a GInetAddress |
Returns : |
TRUE if address is the "any" address for its family.
|
Since 2.22
gboolean g_inet_address_get_is_loopback (GInetAddress *address);
Tests whether address
is the loopback address for its family.
|
a GInetAddress |
Returns : |
TRUE if address is the loopback address for its family.
|
Since 2.22
gboolean g_inet_address_get_is_link_local (GInetAddress *address);
Tests whether address
is a link-local address (that is, if it
identifies a host on a local network that is not connected to the
Internet).
|
a GInetAddress |
Returns : |
TRUE if address is a link-local address.
|
Since 2.22
gboolean g_inet_address_get_is_site_local (GInetAddress *address);
Tests whether address
is a site-local address such as 10.0.0.1
(that is, the address identifies a host on a local network that can
not be reached directly from the Internet, but which may have
outgoing Internet connectivity via a NAT or firewall).
|
a GInetAddress |
Returns : |
TRUE if address is a site-local address.
|
Since 2.22
gboolean g_inet_address_get_is_multicast (GInetAddress *address);
Tests whether address
is a multicast address.
|
a GInetAddress |
Returns : |
TRUE if address is a multicast address.
|
Since 2.22
gboolean g_inet_address_get_is_mc_link_local (GInetAddress *address);
Tests whether address
is a link-local multicast address.
|
a GInetAddress |
Returns : |
TRUE if address is a link-local multicast address.
|
Since 2.22
gboolean g_inet_address_get_is_mc_node_local (GInetAddress *address);
Tests whether address
is a node-local multicast address.
|
a GInetAddress |
Returns : |
TRUE if address is a node-local multicast address.
|
Since 2.22
gboolean g_inet_address_get_is_mc_site_local (GInetAddress *address);
Tests whether address
is a site-local multicast address.
|
a GInetAddress |
Returns : |
TRUE if address is a site-local multicast address.
|
Since 2.22
gboolean g_inet_address_get_is_mc_org_local (GInetAddress *address);
Tests whether address
is an organization-local multicast address.
|
a GInetAddress |
Returns : |
TRUE if address is an organization-local multicast address.
|
Since 2.22
gboolean g_inet_address_get_is_mc_global (GInetAddress *address);
Tests whether address
is a global multicast address.
|
a GInetAddress |
Returns : |
TRUE if address is a global multicast address.
|
Since 2.22