GIO Reference Manual | ||||
---|---|---|---|---|
Top | Description | Object Hierarchy | Properties |
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
); gboolean g_inet_address_equal (GInetAddress *address
,GInetAddress *other_address
); 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
);
"bytes" gpointer : Read / Write / Construct Only "family" GSocketFamily : Read / Write / Construct Only "is-any" gboolean : Read "is-link-local" gboolean : Read "is-loopback" gboolean : Read "is-mc-global" gboolean : Read "is-mc-link-local" gboolean : Read "is-mc-node-local" gboolean : Read "is-mc-org-local" gboolean : Read "is-mc-site-local" gboolean : Read "is-multicast" gboolean : Read "is-site-local" gboolean : Read
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).
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_SOCKET_FAMILY_IPV4
and 16 bytes for
G_SOCKET_FAMILY_IPV6
.
|
raw address data. [array][element-type guint8] |
|
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
gboolean g_inet_address_equal (GInetAddress *address
,GInetAddress *other_address
);
Checks if two GInetAddress instances are equal, e.g. the same address.
|
A GInetAddress. |
|
Another GInetAddress. |
Returns : |
TRUE if address and other_address are equal, FALSE otherwise. |
Since 2.30
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
"family"
property"family" GSocketFamily : Read / Write / Construct Only
The address family (IPv4 or IPv6).
Default value: G_SOCKET_FAMILY_INVALID
"is-any"
property"is-any" gboolean : Read
Whether this is the "any" address for its family.
See g_inet_address_get_is_any()
.
Default value: FALSE
Since 2.22
"is-link-local"
property"is-link-local" gboolean : Read
Whether this is a link-local address.
See g_inet_address_get_is_link_local()
.
Default value: FALSE
Since 2.22
"is-loopback"
property"is-loopback" gboolean : Read
Whether this is the loopback address for its family.
See g_inet_address_get_is_loopback()
.
Default value: FALSE
Since 2.22
"is-mc-global"
property"is-mc-global" gboolean : Read
Whether this is a global multicast address.
See g_inet_address_get_is_mc_global()
.
Default value: FALSE
Since 2.22
"is-mc-link-local"
property"is-mc-link-local" gboolean : Read
Whether this is a link-local multicast address.
See g_inet_address_get_is_mc_link_local()
.
Default value: FALSE
Since 2.22
"is-mc-node-local"
property"is-mc-node-local" gboolean : Read
Whether this is a node-local multicast address.
See g_inet_address_get_is_mc_node_local()
.
Default value: FALSE
Since 2.22
"is-mc-org-local"
property"is-mc-org-local" gboolean : Read
Whether this is an organization-local multicast address.
See g_inet_address_get_is_mc_org_local()
.
Default value: FALSE
Since 2.22
"is-mc-site-local"
property"is-mc-site-local" gboolean : Read
Whether this is a site-local multicast address.
See g_inet_address_get_is_mc_site_local()
.
Default value: FALSE
Since 2.22
"is-multicast"
property"is-multicast" gboolean : Read
Whether this is a multicast address.
See g_inet_address_get_is_multicast()
.
Default value: FALSE
Since 2.22
"is-site-local"
property"is-site-local" gboolean : Read
Whether this is a site-local address.
See g_inet_address_get_is_loopback()
.
Default value: FALSE
Since 2.22