DNS Resolution

DNS Resolution — Generic thread-safe address resolution functions.

Synopsis

MateVFSResult       mate_vfs_resolve                    (const char *hostname,
                                                         MateVFSResolveHandle **handle);
void                mate_vfs_resolve_free               (MateVFSResolveHandle *handle);
gboolean            mate_vfs_resolve_next_address       (MateVFSResolveHandle *handle,
                                                         MateVFSAddress **address);
void                mate_vfs_resolve_reset_to_beginning (MateVFSResolveHandle *handle);
                    MateVFSAddress;
MateVFSAddress *    mate_vfs_address_dup                (MateVFSAddress *address);
void                mate_vfs_address_free               (MateVFSAddress *address);
int                 mate_vfs_address_get_family_type    (MateVFSAddress *address);
guint32             mate_vfs_address_get_ipv4           (MateVFSAddress *address);
GType               mate_vfs_address_get_type           (void);
MateVFSAddress *    mate_vfs_address_new_from_ipv4      (guint32 ipv4_address);
MateVFSAddress *    mate_vfs_address_new_from_sockaddr  (struct sockaddr *sa,
                                                         int len);
MateVFSAddress *    mate_vfs_address_new_from_string    (const char *address);
char *              mate_vfs_address_to_string          (MateVFSAddress *address);

Description

Details

mate_vfs_resolve ()

MateVFSResult       mate_vfs_resolve                    (const char *hostname,
                                                         MateVFSResolveHandle **handle);

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

hostname :

hostname you want to resolve.

handle :

pointer to a pointer to a MateVFSResolveHandle.

Returns :

A MateVFSResult indicating the success of the operation.

Since 2.8


mate_vfs_resolve_free ()

void                mate_vfs_resolve_free               (MateVFSResolveHandle *handle);

Use this function to free a MateVFSResolveHandle returned by mate_vfs_resolve().

handle :

a MateVFSResolveHandle.

Since 2.8


mate_vfs_resolve_next_address ()

gboolean            mate_vfs_resolve_next_address       (MateVFSResolveHandle *handle,
                                                         MateVFSAddress **address);

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

handle :

a MateVFSResolveHandle.

address :

a pointer to a pointer to a MateVFSAddress.

Returns :

TRUE if the next address was stored in address or FALSE if no other address is available.

Since 2.8


mate_vfs_resolve_reset_to_beginning ()

void                mate_vfs_resolve_reset_to_beginning (MateVFSResolveHandle *handle);

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

handle :

a MateVFSResolveHandle.

Since 2.8


MateVFSAddress

typedef struct _MateVFSAddress MateVFSAddress;


mate_vfs_address_dup ()

MateVFSAddress *    mate_vfs_address_dup                (MateVFSAddress *address);

Duplicates address.

address :

A MateVFSAddress.

Returns :

Duplicated address or NULL if address was not valid.

Since 2.8


mate_vfs_address_free ()

void                mate_vfs_address_free               (MateVFSAddress *address);

Frees the memory allocated for address.

address :

A MateVFSAddress.

Since 2.8


mate_vfs_address_get_family_type ()

int                 mate_vfs_address_get_family_type    (MateVFSAddress *address);

Use this function to retrive the address family of address.

address :

A pointer to a MateVFSAddress

Returns :

The address family of address.

Since 2.8


mate_vfs_address_get_ipv4 ()

guint32             mate_vfs_address_get_ipv4           (MateVFSAddress *address);

address :

A MateVFSAddress.

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


mate_vfs_address_get_type ()

GType               mate_vfs_address_get_type           (void);


mate_vfs_address_new_from_ipv4 ()

MateVFSAddress *    mate_vfs_address_new_from_ipv4      (guint32 ipv4_address);

Creates a new MateVFSAddress 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 MateVFSAdress.

Since 2.8


mate_vfs_address_new_from_sockaddr ()

MateVFSAddress *    mate_vfs_address_new_from_sockaddr  (struct sockaddr *sa,
                                                         int len);

Creates a new MateVFSAddress from sa.

sa :

A pointer to a sockaddr.

len :

The size of sa.

Returns :

The new MateVFSAddress or NULL if sa was invalid or the address family isn't supported.

Since 2.8


mate_vfs_address_new_from_string ()

MateVFSAddress *    mate_vfs_address_new_from_string    (const char *address);

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

address :

A string representation of the address.

Returns :

The new MateVFSAddress.

Since 2.8


mate_vfs_address_to_string ()

char *              mate_vfs_address_to_string          (MateVFSAddress *address);

Translate address to a printable string.

address :

A pointer to a MateVFSAddress

Returns :

A newly alloced string representation of address which the caller must free.

Since 2.8