Blame docs/reference/gio/html/GResolver.html

Packit ae235b
Packit ae235b
<html>
Packit ae235b
<head>
Packit ae235b
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Packit ae235b
<title>GResolver: GIO Reference Manual</title>
Packit ae235b
<meta name="generator" content="DocBook XSL Stylesheets Vsnapshot">
Packit ae235b
<link rel="home" href="index.html" title="GIO Reference Manual">
Packit ae235b
<link rel="up" href="resolver.html" title="DNS resolution">
Packit ae235b
<link rel="prev" href="resolver.html" title="DNS resolution">
Packit ae235b
<link rel="next" href="GProxyResolver.html" title="GProxyResolver">
Packit ae235b
<meta name="generator" content="GTK-Doc V1.27 (XML mode)">
Packit ae235b
<link rel="stylesheet" href="style.css" type="text/css">
Packit ae235b
</head>
Packit ae235b
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
Packit ae235b
Packit ae235b
Packit ae235b
Top  | 
Packit ae235b
                  Description  | 
Packit ae235b
                  Object Hierarchy  | 
Packit ae235b
                  Signals
Packit ae235b
Packit ae235b
Home
Packit ae235b
Up
Packit ae235b
Prev
Packit ae235b
Next
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

GResolver

Packit ae235b

GResolver — Asynchronous and cancellable DNS resolver

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Functions

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GResolver *
Packit ae235b
Packit ae235b
Packit ae235b
g_resolver_get_default ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
void
Packit ae235b
Packit ae235b
Packit ae235b
g_resolver_set_default ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GList *
Packit ae235b
Packit ae235b
Packit ae235b
g_resolver_lookup_by_name ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
void
Packit ae235b
Packit ae235b
Packit ae235b
g_resolver_lookup_by_name_async ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GList *
Packit ae235b
Packit ae235b
Packit ae235b
g_resolver_lookup_by_name_finish ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
void
Packit ae235b
Packit ae235b
Packit ae235b
g_resolver_free_addresses ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gchar *
Packit ae235b
Packit ae235b
Packit ae235b
g_resolver_lookup_by_address ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
void
Packit ae235b
Packit ae235b
Packit ae235b
g_resolver_lookup_by_address_async ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
gchar *
Packit ae235b
Packit ae235b
Packit ae235b
g_resolver_lookup_by_address_finish ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GList *
Packit ae235b
Packit ae235b
Packit ae235b
g_resolver_lookup_service ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
void
Packit ae235b
Packit ae235b
Packit ae235b
g_resolver_lookup_service_async ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GList *
Packit ae235b
Packit ae235b
Packit ae235b
g_resolver_lookup_service_finish ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
void
Packit ae235b
Packit ae235b
Packit ae235b
g_resolver_free_targets ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GList *
Packit ae235b
Packit ae235b
Packit ae235b
g_resolver_lookup_records ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
void
Packit ae235b
Packit ae235b
Packit ae235b
g_resolver_lookup_records_async ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
GList *
Packit ae235b
Packit ae235b
Packit ae235b
g_resolver_lookup_records_finish ()
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Signals

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
void
Packit ae235b
reload
Packit ae235b
Run Last
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Types and Values

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
 
Packit ae235b
GResolver
Packit ae235b
Packit ae235b
Packit ae235b
enum
Packit ae235b
GResolverRecordType
Packit ae235b
Packit ae235b
Packit ae235b
#define
Packit ae235b
G_RESOLVER_ERROR
Packit ae235b
Packit ae235b
Packit ae235b
enum
Packit ae235b
GResolverError
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Object Hierarchy

Packit ae235b
    GObject
Packit ae235b
    ╰── GResolver
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Includes

Packit ae235b
#include <gio/gio.h>
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Description

Packit ae235b

GResolver provides cancellable synchronous and asynchronous DNS

Packit ae235b
resolution, for hostnames (g_resolver_lookup_by_address(),
Packit ae235b
g_resolver_lookup_by_name() and their async variants) and SRV
Packit ae235b
(service) records (g_resolver_lookup_service()).

Packit ae235b

GNetworkAddress and GNetworkService provide wrappers around

Packit ae235b
GResolver functionality that also implement GSocketConnectable,
Packit ae235b
making it easy to connect to a remote host/service.

Packit ae235b
Packit ae235b
Packit ae235b

Functions

Packit ae235b
Packit ae235b

g_resolver_get_default ()

Packit ae235b
GResolver *
Packit ae235b
g_resolver_get_default (void);
Packit ae235b

Gets the default GResolver. You should unref it when you are done

Packit ae235b
with it. GResolver may use its reference count as a hint about how
Packit ae235b
many threads it should allocate for concurrent DNS resolutions.

Packit ae235b
Packit ae235b

Returns

Packit ae235b

the default GResolver.

Packit ae235b

[transfer full]

Packit ae235b
Packit ae235b

Since: 2.22

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_resolver_set_default ()

Packit ae235b
void
Packit ae235b
g_resolver_set_default (GResolver *resolver);
Packit ae235b

Sets resolver

Packit ae235b
 to be the application's default resolver (reffing
Packit ae235b
resolver
Packit ae235b
, and unreffing the previous default resolver, if any).
Packit ae235b
Future calls to g_resolver_get_default() will return this resolver.

Packit ae235b

This can be used if an application wants to perform any sort of DNS

Packit ae235b
caching or "pinning"; it can implement its own GResolver that
Packit ae235b
calls the original default resolver for DNS operations, and
Packit ae235b
implements its own cache policies on top of that, and then set
Packit ae235b
itself as the default resolver for all later code to use.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

resolver

Packit ae235b

the new default GResolver

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Since: 2.22

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_resolver_lookup_by_name ()

Packit ae235b
GList *
Packit ae235b
g_resolver_lookup_by_name (GResolver *resolver,
Packit ae235b
                           const gchar *hostname,
Packit ae235b
                           GCancellable *cancellable,
Packit ae235b
                           GError **error);
Packit ae235b

Synchronously resolves hostname

Packit ae235b
 to determine its associated IP
Packit ae235b
address(es). hostname
Packit ae235b
 may be an ASCII-only or UTF-8 hostname, or
Packit ae235b
the textual form of an IP address (in which case this just becomes
Packit ae235b
a wrapper around g_inet_address_new_from_string()).

Packit ae235b

On success, g_resolver_lookup_by_name() will return a non-empty GList of

Packit ae235b
GInetAddress, sorted in order of preference and guaranteed to not
Packit ae235b
contain duplicates. That is, if using the result to connect to
Packit ae235b
hostname
Packit ae235b
, you should attempt to connect to the first address
Packit ae235b
first, then the second if the first fails, etc. If you are using
Packit ae235b
the result to listen on a socket, it is appropriate to add each
Packit ae235b
result using e.g. g_socket_listener_add_address().

Packit ae235b

If the DNS resolution fails, error

Packit ae235b
 (if non-NULL) will be set to a
Packit ae235b
value from GResolverError and NULL will be returned.

Packit ae235b

If cancellable

Packit ae235b
 is non-NULL, it can be used to cancel the
Packit ae235b
operation, in which case error
Packit ae235b
 (if non-NULL) will be set to
Packit ae235b
G_IO_ERROR_CANCELLED.

Packit ae235b

If you are planning to connect to a socket on the resolved IP

Packit ae235b
address, it may be easier to create a GNetworkAddress and use its
Packit ae235b
GSocketConnectable interface.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

resolver

Packit ae235b

a GResolver

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

hostname

Packit ae235b

the hostname to look up

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

cancellable

Packit ae235b

a GCancellable, or NULL.

Packit ae235b
[nullable]
Packit ae235b
Packit ae235b
Packit ae235b

error

Packit ae235b

return location for a GError, or NULL

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

a non-empty GList

Packit ae235b
of GInetAddress, or NULL on error. You
Packit ae235b
must unref each of the addresses and free the list when you are
Packit ae235b
done with it. (You can use g_resolver_free_addresses() to do this.). 

Packit ae235b

[element-type GInetAddress][transfer full]

Packit ae235b
Packit ae235b

Since: 2.22

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_resolver_lookup_by_name_async ()

Packit ae235b
void
Packit ae235b
g_resolver_lookup_by_name_async (GResolver *resolver,
Packit ae235b
                                 const gchar *hostname,
Packit ae235b
                                 GCancellable *cancellable,
Packit ae235b
                                 GAsyncReadyCallback callback,
Packit ae235b
                                 gpointer user_data);
Packit ae235b

Begins asynchronously resolving hostname

Packit ae235b
 to determine its
Packit ae235b
associated IP address(es), and eventually calls callback
Packit ae235b
, which
Packit ae235b
must call g_resolver_lookup_by_name_finish() to get the result.
Packit ae235b
See g_resolver_lookup_by_name() for more details.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

resolver

Packit ae235b

a GResolver

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

hostname

Packit ae235b

the hostname to look up the address of

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

cancellable

Packit ae235b

a GCancellable, or NULL.

Packit ae235b
[nullable]
Packit ae235b
Packit ae235b
Packit ae235b

callback

Packit ae235b

callback to call after resolution completes.

Packit ae235b
[scope async]
Packit ae235b
Packit ae235b
Packit ae235b

user_data

Packit ae235b

data for callback

Packit ae235b
. 

Packit ae235b
[closure]
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Since: 2.22

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_resolver_lookup_by_name_finish ()

Packit ae235b
GList *
Packit ae235b
g_resolver_lookup_by_name_finish (GResolver *resolver,
Packit ae235b
                                  GAsyncResult *result,
Packit ae235b
                                  GError **error);
Packit ae235b

Retrieves the result of a call to

Packit ae235b
g_resolver_lookup_by_name_async().

Packit ae235b

If the DNS resolution failed, error

Packit ae235b
 (if non-NULL) will be set to
Packit ae235b
a value from GResolverError. If the operation was cancelled,
Packit ae235b
error
Packit ae235b
 will be set to G_IO_ERROR_CANCELLED.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

resolver

Packit ae235b

a GResolver

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

result

Packit ae235b

the result passed to your GAsyncReadyCallback

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

error

Packit ae235b

return location for a GError, or NULL

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

a GList

Packit ae235b
of GInetAddress, or NULL on error. See g_resolver_lookup_by_name()
Packit ae235b
for more details. 

Packit ae235b

[element-type GInetAddress][transfer full]

Packit ae235b
Packit ae235b

Since: 2.22

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_resolver_free_addresses ()

Packit ae235b
void
Packit ae235b
g_resolver_free_addresses (GList *addresses);
Packit ae235b

Frees addresses

Packit ae235b
 (which should be the return value from
Packit ae235b
g_resolver_lookup_by_name() or g_resolver_lookup_by_name_finish()).
Packit ae235b
(This is a convenience method; you can also simply free the results
Packit ae235b
by hand.)

Packit ae235b

[skip]

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

addresses

Packit ae235b

a GList of GInetAddress

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Since: 2.22

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_resolver_lookup_by_address ()

Packit ae235b
gchar *
Packit ae235b
g_resolver_lookup_by_address (GResolver *resolver,
Packit ae235b
                              GInetAddress *address,
Packit ae235b
                              GCancellable *cancellable,
Packit ae235b
                              GError **error);
Packit ae235b

Synchronously reverse-resolves address

Packit ae235b
 to determine its
Packit ae235b
associated hostname.

Packit ae235b

If the DNS resolution fails, error

Packit ae235b
 (if non-NULL) will be set to
Packit ae235b
a value from GResolverError.

Packit ae235b

If cancellable

Packit ae235b
 is non-NULL, it can be used to cancel the
Packit ae235b
operation, in which case error
Packit ae235b
 (if non-NULL) will be set to
Packit ae235b
G_IO_ERROR_CANCELLED.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

resolver

Packit ae235b

a GResolver

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

address

Packit ae235b

the address to reverse-resolve

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

cancellable

Packit ae235b

a GCancellable, or NULL.

Packit ae235b
[nullable]
Packit ae235b
Packit ae235b
Packit ae235b

error

Packit ae235b

return location for a GError, or NULL

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

a hostname (either ASCII-only, or in ASCII-encoded

Packit ae235b
form), or NULL on error.

Packit ae235b
Packit ae235b

Since: 2.22

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_resolver_lookup_by_address_async ()

Packit ae235b
void
Packit ae235b
g_resolver_lookup_by_address_async (GResolver *resolver,
Packit ae235b
                                    GInetAddress *address,
Packit ae235b
                                    GCancellable *cancellable,
Packit ae235b
                                    GAsyncReadyCallback callback,
Packit ae235b
                                    gpointer user_data);
Packit ae235b

Begins asynchronously reverse-resolving address

Packit ae235b
 to determine its
Packit ae235b
associated hostname, and eventually calls callback
Packit ae235b
, which must
Packit ae235b
call g_resolver_lookup_by_address_finish() to get the final result.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

resolver

Packit ae235b

a GResolver

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

address

Packit ae235b

the address to reverse-resolve

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

cancellable

Packit ae235b

a GCancellable, or NULL.

Packit ae235b
[nullable]
Packit ae235b
Packit ae235b
Packit ae235b

callback

Packit ae235b

callback to call after resolution completes.

Packit ae235b
[scope async]
Packit ae235b
Packit ae235b
Packit ae235b

user_data

Packit ae235b

data for callback

Packit ae235b
. 

Packit ae235b
[closure]
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Since: 2.22

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_resolver_lookup_by_address_finish ()

Packit ae235b
gchar *
Packit ae235b
g_resolver_lookup_by_address_finish (GResolver *resolver,
Packit ae235b
                                     GAsyncResult *result,
Packit ae235b
                                     GError **error);
Packit ae235b

Retrieves the result of a previous call to

Packit ae235b
g_resolver_lookup_by_address_async().

Packit ae235b

If the DNS resolution failed, error

Packit ae235b
 (if non-NULL) will be set to
Packit ae235b
a value from GResolverError. If the operation was cancelled,
Packit ae235b
error
Packit ae235b
 will be set to G_IO_ERROR_CANCELLED.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

resolver

Packit ae235b

a GResolver

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

result

Packit ae235b

the result passed to your GAsyncReadyCallback

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

error

Packit ae235b

return location for a GError, or NULL

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

a hostname (either ASCII-only, or in ASCII-encoded

Packit ae235b
form), or NULL on error.

Packit ae235b
Packit ae235b

Since: 2.22

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_resolver_lookup_service ()

Packit ae235b
GList *
Packit ae235b
g_resolver_lookup_service (GResolver *resolver,
Packit ae235b
                           const gchar *service,
Packit ae235b
                           const gchar *protocol,
Packit ae235b
                           const gchar *domain,
Packit ae235b
                           GCancellable *cancellable,
Packit ae235b
                           GError **error);
Packit ae235b

Synchronously performs a DNS SRV lookup for the given service

Packit ae235b
 and
Packit ae235b
protocol
Packit ae235b
 in the given domain
Packit ae235b
 and returns an array of GSrvTarget.
Packit ae235b
domain
Packit ae235b
 may be an ASCII-only or UTF-8 hostname. Note also that the
Packit ae235b
service
Packit ae235b
 and protocol
Packit ae235b
 arguments do not include the leading underscore
Packit ae235b
that appears in the actual DNS entry.

Packit ae235b

On success, g_resolver_lookup_service() will return a non-empty GList of

Packit ae235b
GSrvTarget, sorted in order of preference. (That is, you should
Packit ae235b
attempt to connect to the first target first, then the second if
Packit ae235b
the first fails, etc.)

Packit ae235b

If the DNS resolution fails, error

Packit ae235b
 (if non-NULL) will be set to
Packit ae235b
a value from GResolverError and NULL will be returned.

Packit ae235b

If cancellable

Packit ae235b
 is non-NULL, it can be used to cancel the
Packit ae235b
operation, in which case error
Packit ae235b
 (if non-NULL) will be set to
Packit ae235b
G_IO_ERROR_CANCELLED.

Packit ae235b

If you are planning to connect to the service, it is usually easier

Packit ae235b
to create a GNetworkService and use its GSocketConnectable
Packit ae235b
interface.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

resolver

Packit ae235b

a GResolver

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

service

Packit ae235b

the service type to look up (eg, "ldap")

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

protocol

Packit ae235b

the networking protocol to use for service

Packit ae235b
(eg, "tcp")

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

domain

Packit ae235b

the DNS domain to look up the service in

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

cancellable

Packit ae235b

a GCancellable, or NULL.

Packit ae235b
[nullable]
Packit ae235b
Packit ae235b
Packit ae235b

error

Packit ae235b

return location for a GError, or NULL

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

a non-empty GList of

Packit ae235b
GSrvTarget, or NULL on error. You must free each of the targets and the
Packit ae235b
list when you are done with it. (You can use g_resolver_free_targets() to do
Packit ae235b
this.). 

Packit ae235b

[element-type GSrvTarget][transfer full]

Packit ae235b
Packit ae235b

Since: 2.22

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_resolver_lookup_service_async ()

Packit ae235b
void
Packit ae235b
g_resolver_lookup_service_async (GResolver *resolver,
Packit ae235b
                                 const gchar *service,
Packit ae235b
                                 const gchar *protocol,
Packit ae235b
                                 const gchar *domain,
Packit ae235b
                                 GCancellable *cancellable,
Packit ae235b
                                 GAsyncReadyCallback callback,
Packit ae235b
                                 gpointer user_data);
Packit ae235b

Begins asynchronously performing a DNS SRV lookup for the given

Packit ae235b
service
Packit ae235b
 and protocol
Packit ae235b
 in the given domain
Packit ae235b
, and eventually calls
Packit ae235b
callback
Packit ae235b
, which must call g_resolver_lookup_service_finish() to
Packit ae235b
get the final result. See g_resolver_lookup_service() for more
Packit ae235b
details.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

resolver

Packit ae235b

a GResolver

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

service

Packit ae235b

the service type to look up (eg, "ldap")

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

protocol

Packit ae235b

the networking protocol to use for service

Packit ae235b
(eg, "tcp")

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

domain

Packit ae235b

the DNS domain to look up the service in

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

cancellable

Packit ae235b

a GCancellable, or NULL.

Packit ae235b
[nullable]
Packit ae235b
Packit ae235b
Packit ae235b

callback

Packit ae235b

callback to call after resolution completes.

Packit ae235b
[scope async]
Packit ae235b
Packit ae235b
Packit ae235b

user_data

Packit ae235b

data for callback

Packit ae235b
. 

Packit ae235b
[closure]
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Since: 2.22

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_resolver_lookup_service_finish ()

Packit ae235b
GList *
Packit ae235b
g_resolver_lookup_service_finish (GResolver *resolver,
Packit ae235b
                                  GAsyncResult *result,
Packit ae235b
                                  GError **error);
Packit ae235b

Retrieves the result of a previous call to

Packit ae235b
g_resolver_lookup_service_async().

Packit ae235b

If the DNS resolution failed, error

Packit ae235b
 (if non-NULL) will be set to
Packit ae235b
a value from GResolverError. If the operation was cancelled,
Packit ae235b
error
Packit ae235b
 will be set to G_IO_ERROR_CANCELLED.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

resolver

Packit ae235b

a GResolver

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

result

Packit ae235b

the result passed to your GAsyncReadyCallback

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

error

Packit ae235b

return location for a GError, or NULL

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

a non-empty GList of

Packit ae235b
GSrvTarget, or NULL on error. See g_resolver_lookup_service() for more
Packit ae235b
details. 

Packit ae235b

[element-type GSrvTarget][transfer full]

Packit ae235b
Packit ae235b

Since: 2.22

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_resolver_free_targets ()

Packit ae235b
void
Packit ae235b
g_resolver_free_targets (GList *targets);
Packit ae235b

Frees targets

Packit ae235b
 (which should be the return value from
Packit ae235b
g_resolver_lookup_service() or g_resolver_lookup_service_finish()).
Packit ae235b
(This is a convenience method; you can also simply free the
Packit ae235b
results by hand.)

Packit ae235b

[skip]

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

targets

Packit ae235b

a GList of GSrvTarget

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Since: 2.22

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_resolver_lookup_records ()

Packit ae235b
GList *
Packit ae235b
g_resolver_lookup_records (GResolver *resolver,
Packit ae235b
                           const gchar *rrname,
Packit ae235b
                           GResolverRecordType record_type,
Packit ae235b
                           GCancellable *cancellable,
Packit ae235b
                           GError **error);
Packit ae235b

Synchronously performs a DNS record lookup for the given rrname

Packit ae235b
 and returns
Packit ae235b
a list of records as GVariant tuples. See GResolverRecordType for
Packit ae235b
information on what the records contain for each record_type
Packit ae235b
.

Packit ae235b

If the DNS resolution fails, error

Packit ae235b
 (if non-NULL) will be set to
Packit ae235b
a value from GResolverError and NULL will be returned.

Packit ae235b

If cancellable

Packit ae235b
 is non-NULL, it can be used to cancel the
Packit ae235b
operation, in which case error
Packit ae235b
 (if non-NULL) will be set to
Packit ae235b
G_IO_ERROR_CANCELLED.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

resolver

Packit ae235b

a GResolver

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

rrname

Packit ae235b

the DNS name to lookup the record for

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

record_type

Packit ae235b

the type of DNS record to lookup

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

cancellable

Packit ae235b

a GCancellable, or NULL.

Packit ae235b
[nullable]
Packit ae235b
Packit ae235b
Packit ae235b

error

Packit ae235b

return location for a GError, or NULL

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

a non-empty GList of

Packit ae235b
GVariant, or NULL on error. You must free each of the records and the list
Packit ae235b
when you are done with it. (You can use g_list_free_full() with
Packit ae235b
g_variant_unref() to do this.). 

Packit ae235b

[element-type GVariant][transfer full]

Packit ae235b
Packit ae235b

Since: 2.34

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_resolver_lookup_records_async ()

Packit ae235b
void
Packit ae235b
g_resolver_lookup_records_async (GResolver *resolver,
Packit ae235b
                                 const gchar *rrname,
Packit ae235b
                                 GResolverRecordType record_type,
Packit ae235b
                                 GCancellable *cancellable,
Packit ae235b
                                 GAsyncReadyCallback callback,
Packit ae235b
                                 gpointer user_data);
Packit ae235b

Begins asynchronously performing a DNS lookup for the given

Packit ae235b
rrname
Packit ae235b
, and eventually calls callback
Packit ae235b
, which must call
Packit ae235b
g_resolver_lookup_records_finish() to get the final result. See
Packit ae235b
g_resolver_lookup_records() for more details.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

resolver

Packit ae235b

a GResolver

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

rrname

Packit ae235b

the DNS name to lookup the record for

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

record_type

Packit ae235b

the type of DNS record to lookup

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

cancellable

Packit ae235b

a GCancellable, or NULL.

Packit ae235b
[nullable]
Packit ae235b
Packit ae235b
Packit ae235b

callback

Packit ae235b

callback to call after resolution completes.

Packit ae235b
[scope async]
Packit ae235b
Packit ae235b
Packit ae235b

user_data

Packit ae235b

data for callback

Packit ae235b
. 

Packit ae235b
[closure]
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Since: 2.34

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

g_resolver_lookup_records_finish ()

Packit ae235b
GList *
Packit ae235b
g_resolver_lookup_records_finish (GResolver *resolver,
Packit ae235b
                                  GAsyncResult *result,
Packit ae235b
                                  GError **error);
Packit ae235b

Retrieves the result of a previous call to

Packit ae235b
g_resolver_lookup_records_async(). Returns a non-empty list of records as
Packit ae235b
GVariant tuples. See GResolverRecordType for information on what the
Packit ae235b
records contain.

Packit ae235b

If the DNS resolution failed, error

Packit ae235b
 (if non-NULL) will be set to
Packit ae235b
a value from GResolverError. If the operation was cancelled,
Packit ae235b
error
Packit ae235b
 will be set to G_IO_ERROR_CANCELLED.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

resolver

Packit ae235b

a GResolver

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

result

Packit ae235b

the result passed to your GAsyncReadyCallback

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

error

Packit ae235b

return location for a GError, or NULL

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Returns

Packit ae235b

a non-empty GList of

Packit ae235b
GVariant, or NULL on error. You must free each of the records and the list
Packit ae235b
when you are done with it. (You can use g_list_free_full() with
Packit ae235b
g_variant_unref() to do this.). 

Packit ae235b

[element-type GVariant][transfer full]

Packit ae235b
Packit ae235b

Since: 2.34

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Types and Values

Packit ae235b
Packit ae235b

GResolver

Packit ae235b
typedef struct _GResolver GResolver;
Packit ae235b

The object that handles DNS resolution. Use g_resolver_get_default()

Packit ae235b
to get the default resolver.

Packit ae235b

This is an abstract type; subclasses of it implement different resolvers for

Packit ae235b
different platforms and situations.

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

enum GResolverRecordType

Packit ae235b

The type of record that g_resolver_lookup_records() or

Packit ae235b
g_resolver_lookup_records_async() should retrieve. The records are returned
Packit ae235b
as lists of GVariant tuples. Each record type has different values in
Packit ae235b
the variant tuples returned.

Packit ae235b

G_RESOLVER_RECORD_SRV records are returned as variants with the signature

Packit ae235b
'(qqqs)', containing a guint16 with the priority, a guint16 with the
Packit ae235b
weight, a guint16 with the port, and a string of the hostname.

Packit ae235b

G_RESOLVER_RECORD_MX records are returned as variants with the signature

Packit ae235b
'(qs)', representing a guint16 with the preference, and a string containing
Packit ae235b
the mail exchanger hostname.

Packit ae235b

G_RESOLVER_RECORD_TXT records are returned as variants with the signature

Packit ae235b
'(as)', representing an array of the strings in the text record.

Packit ae235b

G_RESOLVER_RECORD_SOA records are returned as variants with the signature

Packit ae235b
'(ssuuuuu)', representing a string containing the primary name server, a
Packit ae235b
string containing the administrator, the serial as a guint32, the refresh
Packit ae235b
interval as guint32, the retry interval as a guint32, the expire timeout
Packit ae235b
as a guint32, and the ttl as a guint32.

Packit ae235b

G_RESOLVER_RECORD_NS records are returned as variants with the signature

Packit ae235b
'(s)', representing a string of the hostname of the name server.

Packit ae235b
Packit ae235b

Members

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

G_RESOLVER_RECORD_SRV

Packit ae235b
Packit ae235b

lookup DNS SRV records for a domain

Packit ae235b
Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

G_RESOLVER_RECORD_MX

Packit ae235b
Packit ae235b

lookup DNS MX records for a domain

Packit ae235b
Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

G_RESOLVER_RECORD_TXT

Packit ae235b
Packit ae235b

lookup DNS TXT records for a name

Packit ae235b
Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

G_RESOLVER_RECORD_SOA

Packit ae235b
Packit ae235b

lookup DNS SOA records for a zone

Packit ae235b
Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

G_RESOLVER_RECORD_NS

Packit ae235b
Packit ae235b

lookup DNS NS records for a domain

Packit ae235b
Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Since: 2.34

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

G_RESOLVER_ERROR

Packit ae235b
#define G_RESOLVER_ERROR (g_resolver_error_quark ())
Packit ae235b
Packit ae235b

Error domain for GResolver. Errors in this domain will be from the

Packit ae235b
GResolverError enumeration. See GError for more information on
Packit ae235b
error domains.

Packit ae235b
Packit ae235b

Packit ae235b
Packit ae235b

enum GResolverError

Packit ae235b

An error code used with G_RESOLVER_ERROR in a GError returned

Packit ae235b
from a GResolver routine.

Packit ae235b
Packit ae235b

Members

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

G_RESOLVER_ERROR_NOT_FOUND

Packit ae235b
Packit ae235b

the requested name/address/service was not

Packit ae235b
    found

Packit ae235b
Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

G_RESOLVER_ERROR_TEMPORARY_FAILURE

Packit ae235b
Packit ae235b

the requested information could not

Packit ae235b
    be looked up due to a network error or similar problem

Packit ae235b
Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

G_RESOLVER_ERROR_INTERNAL

Packit ae235b
Packit ae235b

unknown error

Packit ae235b
Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Since: 2.22

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Signal Details

Packit ae235b
Packit ae235b

The “reload” signal

Packit ae235b
void
Packit ae235b
user_function (GResolver *resolver,
Packit ae235b
               gpointer   user_data)
Packit ae235b

Emitted when the resolver notices that the system resolver

Packit ae235b
configuration has changed.

Packit ae235b
Packit ae235b

Parameters

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

resolver

Packit ae235b

a GResolver

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b

user_data

Packit ae235b

user data set when the signal handler was connected.

Packit ae235b
 
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Flags: Run Last

Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b
Packit ae235b

Generated by GTK-Doc V1.27
Packit ae235b
</body>
Packit ae235b
</html>