DNS Resolution

DNS Resolution — Generic thread-safe address resolution functions.

Synopsis




GnomeVFSResult gnome_vfs_resolve            (const char *hostname,
                                             GnomeVFSResolveHandle **handle);
void        gnome_vfs_resolve_free          (GnomeVFSResolveHandle *handle);
gboolean    gnome_vfs_resolve_next_address  (GnomeVFSResolveHandle *handle,
                                             GnomeVFSAddress **address);
void        gnome_vfs_resolve_reset_to_beginning
                                            (GnomeVFSResolveHandle *handle);
            GnomeVFSAddress;
int         gnome_vfs_address_get_family_type
                                            (GnomeVFSAddress *address);
guint32     gnome_vfs_address_get_ipv4      (GnomeVFSAddress *address);
GType       gnome_vfs_address_get_type      (void);
GnomeVFSAddress* gnome_vfs_address_new_from_ipv4
                                            (guint32 ipv4_address);
GnomeVFSAddress* gnome_vfs_address_new_from_sockaddr
                                            (struct sockaddr *sa,
                                             int len);
GnomeVFSAddress* gnome_vfs_address_new_from_string
                                            (const char *address);
char*       gnome_vfs_address_to_string     (GnomeVFSAddress *address);

Description

Details

gnome_vfs_resolve ()

GnomeVFSResult gnome_vfs_resolve            (const char *hostname,
                                             GnomeVFSResolveHandle **handle);

Tries to resolve hostname. If the operation was successful you can get the resolved addresses in form of GnomeVFSAddress by calling gnome_vfs_resolve_next_address().

hostname : hostname you want to resolve.
handle : pointer to a pointer to a GnomeVFSResolveHandle.
Returns : A GnomeVFSResult indicating the success of the operation.

Since 2.8


gnome_vfs_resolve_free ()

void        gnome_vfs_resolve_free          (GnomeVFSResolveHandle *handle);

Use this function to free a GnomeVFSResolveHandle returned by gnome_vfs_resolve().

handle : a GnomeVFSResolveHandle.

Since 2.8


gnome_vfs_resolve_next_address ()

gboolean    gnome_vfs_resolve_next_address  (GnomeVFSResolveHandle *handle,
                                             GnomeVFSAddress **address);

Stores the next GnomeVFSAddress available in handle of the former lookup in address.

handle : a GnomeVFSResolveHandle.
address : a pointer to a pointer to a GnomeVFSAddress.
Returns : TRUE if the next address was stored in address or FALSE if no other address is available.

Since 2.8


gnome_vfs_resolve_reset_to_beginning ()

void        gnome_vfs_resolve_reset_to_beginning
                                            (GnomeVFSResolveHandle *handle);

Reset handle so that a following call to gnome_vfs_resolve_next_address() will return the first resolved address.

handle : a GnomeVFSResolveHandle.

Since 2.8


GnomeVFSAddress

typedef struct _GnomeVFSAddress GnomeVFSAddress;


gnome_vfs_address_get_family_type ()

int         gnome_vfs_address_get_family_type
                                            (GnomeVFSAddress *address);

Use this function to retrive the address family of address.

address : A pointer to a GnomeVFSAddress
Returns : The address family of address.

Since 2.8


gnome_vfs_address_get_ipv4 ()

guint32     gnome_vfs_address_get_ipv4      (GnomeVFSAddress *address);

address : A GnomeVFSAddress.
Returns : The associated IPv4 address in network byte order. Note that you should avoid using this function because newly written code should be protocol independent.

Since 2.8


gnome_vfs_address_get_type ()

GType       gnome_vfs_address_get_type      (void);

Returns :

gnome_vfs_address_new_from_ipv4 ()

GnomeVFSAddress* gnome_vfs_address_new_from_ipv4
                                            (guint32 ipv4_address);

Creates a new GnomeVFSAddress from ipv4_address.

Note that this function should be avoided because newly written code should be protocol independent.

ipv4_address : A IPv4 Address in network byte order
Returns : A new GnomeVFSAdress.

Since 2.8


gnome_vfs_address_new_from_sockaddr ()

GnomeVFSAddress* gnome_vfs_address_new_from_sockaddr
                                            (struct sockaddr *sa,
                                             int len);

Creates a new GnomeVFSAddress from sa.

sa : A pointer to a sockaddr.
len : The size of sa.
Returns : The new GnomeVFSAddress or NULL if sa was invalid or the address family isn't supported.

Since 2.8


gnome_vfs_address_new_from_string ()

GnomeVFSAddress* gnome_vfs_address_new_from_string
                                            (const char *address);

Creates a new GnomeVFSAddress from the given string or NULL if address isn't a valid.

address : A string representation of the address.
Returns : The new GnomeVFSAddress.

Since 2.8


gnome_vfs_address_to_string ()

char*       gnome_vfs_address_to_string     (GnomeVFSAddress *address);

Translate address to a printable string.

address : A pointer to a GnomeVFSAddress
Returns : A newly alloced string representation of address which the caller must free.

Since 2.8