Description
InetAddr represents an internet address. Currently, only IP version 4
addresses are used (eg, addresses in the form 141.213.8.59).
Details
gnet_inetaddr_new ()
GInetAddr* gnet_inetaddr_new (const gchar *name,
const gint port); |
Create an internet address from a name and port.
gnet_inetaddr_new_async ()
Create a GInetAddr from a name and port asynchronously. Once the
structure is created, it will call the callback. It may call the
callback before the function returns. It will call the callback
if there is a failure.
This is EXPERIMENTAL. It is based on forking, which can cause
some problems. In general, this will work ok for most programs
most of the time. It will be slow or even fail when using
operating systems that copy the entire process when forking.
If you need to lookup a lot of addresses, I recommend calling
g_main_iteration(FALSE) between calls. This will help prevent an
explosion of processes.
If you need a more robust library, look at <ulink
url="http://www.gnu.org/software/adns/adns.html">GNU ADNS</ulink>.
GNU ADNS is under the GNU GPL.
gnet_inetaddr_new_async_cancel ()
Cancel an asynchronous GInetAddr creation that was started with
gnet_inetaddr_new_async().
GInetAddrNewAsyncID
typedef gpointer GInetAddrNewAsyncID; |
enum GInetAddrAsyncStatus
typedef enum {
GINETADDR_ASYNC_STATUS_OK,
GINETADDR_ASYNC_STATUS_ERROR
} GInetAddrAsyncStatus; |
gnet_inetaddr_clone ()
GInetAddr* gnet_inetaddr_clone (const GInetAddr *ia); |
Create an internet address from another one.
gnet_inetaddr_delete ()
void gnet_inetaddr_delete (GInetAddr *ia); |
Delete a GInetAddr.
gnet_inetaddr_ref ()
void gnet_inetaddr_ref (GInetAddr *ia); |
Increment the reference counter of the GInetAddr.
gnet_inetaddr_unref ()
void gnet_inetaddr_unref (GInetAddr *ia); |
Remove a reference from the GInetAddr. When reference count
reaches 0, the address is deleted.
gnet_inetaddr_get_name ()
gchar* gnet_inetaddr_get_name (GInetAddr *ia); |
Get the nice name of the address (eg, "mofo.eecs.umich.edu"). Be
warned that this call may block since it may need to do a reverse
DNS lookup.
gnet_inetaddr_get_name_async ()
Get the nice name of the address (eg, "mofo.eecs.umich.edu").
This function will use the callback once it knows the nice name.
It may even call the callback before it returns. The callback
will be called if there is an error.
This is EXPERIMENTAL. It uses the same mechanism as
gnet_inetaddr_new_async() - see the notes for that function.
GInetAddrGetNameAsyncID
typedef gpointer GInetAddrGetNameAsyncID; |
GInetAddrGetNameAsyncFunc ()
void (*GInetAddrGetNameAsyncFunc) (GInetAddr *inetaddr,
GInetAddrAsyncStatus status,
gchar *name,
gpointer data); |
gnet_inetaddr_get_canonical_name ()
gchar* gnet_inetaddr_get_canonical_name
(GInetAddr *ia); |
Get the "canonical" name of an address (eg, for IP4 the dotted
decimal name 141.213.8.59).
gnet_inetaddr_get_port ()
gint gnet_inetaddr_get_port (const GInetAddr *ia); |
Get the port number.
gnet_inetaddr_set_port ()
void gnet_inetaddr_set_port (const GInetAddr *ia,
guint port); |
Set the port number.
gnet_inetaddr_gethostname ()
gchar* gnet_inetaddr_gethostname (void); |
Get the primary host's name.
gnet_inetaddr_gethostaddr ()
GInetAddr* gnet_inetaddr_gethostaddr (void); |
Get the primary host's GInetAddr.
gnet_inetaddr_hash ()
guint gnet_inetaddr_hash (const gpointer p); |
Hash the address. This is useful for glib containers.
gnet_inetaddr_equal ()
gint gnet_inetaddr_equal (const gpointer p1,
const gpointer p2); |
Compare two GInetAddr's.
gnet_inetaddr_noport_equal ()
gint gnet_inetaddr_noport_equal (const gpointer p1,
const gpointer p2); |
Compare two GInetAddr's, but does not compare the port numbers.