Class

GioResolver

Description [src]

abstract class Gio.Resolver : GObject.Object
{
  priv: GResolverPrivate*
}

The object that handles DNS resolution. Use g_resolver_get_default() to get the default resolver.

GResolver provides cancellable synchronous and asynchronous DNS resolution, for hostnames (g_resolver_lookup_by_address(), g_resolver_lookup_by_name() and their async variants) and SRV (service) records (g_resolver_lookup_service()).

GNetworkAddress and GNetworkService provide wrappers around GResolver functionality that also implement GSocketConnectable, making it easy to connect to a remote host/service.

The default resolver (see g_resolver_get_default()) has a timeout of 30s set on it since GLib 2.78. Earlier versions of GLib did not support resolver timeouts.

This is an abstract type; subclasses of it implement different resolvers for different platforms and situations.

Ancestors

Descendants

Functions

g_resolver_free_addresses

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

since: 2.22

g_resolver_free_targets

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

since: 2.22

g_resolver_get_default

Gets the default GResolver. You should unref it when you are done with it. GResolver may use its reference count as a hint about how many threads it should allocate for concurrent DNS resolutions.

since: 2.22

Instance methods

g_resolver_get_timeout

Get the timeout applied to all resolver lookups. See GResolver:timeout.

since: 2.78

g_resolver_lookup_by_address

Synchronously reverse-resolves address to determine its associated hostname.

since: 2.22

g_resolver_lookup_by_address_async

Begins asynchronously reverse-resolving address to determine its associated hostname, and eventually calls callback, which must call g_resolver_lookup_by_address_finish() to get the final result.

since: 2.22

g_resolver_lookup_by_address_finish

Retrieves the result of a previous call to g_resolver_lookup_by_address_async().

since: 2.22

g_resolver_lookup_by_name

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

since: 2.22

g_resolver_lookup_by_name_async

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

since: 2.22

g_resolver_lookup_by_name_finish

Retrieves the result of a call to g_resolver_lookup_by_name_async().

since: 2.22

g_resolver_lookup_by_name_with_flags

This differs from g_resolver_lookup_by_name() in that you can modify the lookup behavior with flags. For example this can be used to limit results with G_RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY.

since: 2.60

g_resolver_lookup_by_name_with_flags_async

Begins asynchronously resolving hostname to determine its associated IP address(es), and eventually calls callback, which must call g_resolver_lookup_by_name_with_flags_finish() to get the result. See g_resolver_lookup_by_name() for more details.

since: 2.60

g_resolver_lookup_by_name_with_flags_finish

Retrieves the result of a call to g_resolver_lookup_by_name_with_flags_async().

since: 2.60

g_resolver_lookup_records

Synchronously performs a DNS record lookup for the given rrname and returns a list of records as GVariant tuples. See GResolverRecordType for information on what the records contain for each record_type.

since: 2.34

g_resolver_lookup_records_async

Begins asynchronously performing a DNS lookup for the given rrname, and eventually calls callback, which must call g_resolver_lookup_records_finish() to get the final result. See g_resolver_lookup_records() for more details.

since: 2.34

g_resolver_lookup_records_finish

Retrieves the result of a previous call to g_resolver_lookup_records_async(). Returns a non-empty list of records as GVariant tuples. See GResolverRecordType for information on what the records contain.

since: 2.34

g_resolver_lookup_service

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

since: 2.22

g_resolver_lookup_service_async

Begins asynchronously performing a DNS SRV lookup for the given service and protocol in the given domain, and eventually calls callback, which must call g_resolver_lookup_service_finish() to get the final result. See g_resolver_lookup_service() for more details.

since: 2.22

g_resolver_lookup_service_finish

Retrieves the result of a previous call to g_resolver_lookup_service_async().

since: 2.22

g_resolver_set_default

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

since: 2.22

g_resolver_set_timeout

Set the timeout applied to all resolver lookups. See GResolver:timeout.

since: 2.78

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

Properties

Gio.Resolver:timeout

The timeout applied to all resolver lookups, in milliseconds.

since: 2.78

Signals

Gio.Resolver::reload

Emitted when the resolver notices that the system resolver configuration has changed.

Signals inherited from GObject (1)
GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

Class structure

struct GioResolverClass {
  GObjectClass parent_class;
  void (* reload) (
    GResolver* resolver
  );
  GList* (* lookup_by_name) (
    GResolver* resolver,
    const gchar* hostname,
    GCancellable* cancellable,
    GError** error
  );
  void (* lookup_by_name_async) (
    GResolver* resolver,
    const gchar* hostname,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  GList* (* lookup_by_name_finish) (
    GResolver* resolver,
    GAsyncResult* result,
    GError** error
  );
  gchar* (* lookup_by_address) (
    GResolver* resolver,
    GInetAddress* address,
    GCancellable* cancellable,
    GError** error
  );
  void (* lookup_by_address_async) (
    GResolver* resolver,
    GInetAddress* address,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  gchar* (* lookup_by_address_finish) (
    GResolver* resolver,
    GAsyncResult* result,
    GError** error
  );
  GList* (* lookup_service) (
    GResolver* resolver,
    const gchar* rrname,
    GCancellable* cancellable,
    GError** error
  );
  void (* lookup_service_async) (
    GResolver* resolver,
    const gchar* rrname,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  GList* (* lookup_service_finish) (
    GResolver* resolver,
    GAsyncResult* result,
    GError** error
  );
  GList* (* lookup_records) (
    GResolver* resolver,
    const gchar* rrname,
    GResolverRecordType record_type,
    GCancellable* cancellable,
    GError** error
  );
  void (* lookup_records_async) (
    GResolver* resolver,
    const gchar* rrname,
    GResolverRecordType record_type,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  GList* (* lookup_records_finish) (
    GResolver* resolver,
    GAsyncResult* result,
    GError** error
  );
  void (* lookup_by_name_with_flags_async) (
    GResolver* resolver,
    const gchar* hostname,
    GResolverNameLookupFlags flags,
    GCancellable* cancellable,
    GAsyncReadyCallback callback,
    gpointer user_data
  );
  GList* (* lookup_by_name_with_flags_finish) (
    GResolver* resolver,
    GAsyncResult* result,
    GError** error
  );
  GList* (* lookup_by_name_with_flags) (
    GResolver* resolver,
    const gchar* hostname,
    GResolverNameLookupFlags flags,
    GCancellable* cancellable,
    GError** error
  );
  
}

No description available.

Class members
parent_class: GObjectClass

No description available.

reload: void (* reload) ( GResolver* resolver )

No description available.

lookup_by_name: GList* (* lookup_by_name) ( GResolver* resolver, const gchar* hostname, GCancellable* cancellable, GError** error )

No description available.

lookup_by_name_async: void (* lookup_by_name_async) ( GResolver* resolver, const gchar* hostname, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data )

No description available.

lookup_by_name_finish: GList* (* lookup_by_name_finish) ( GResolver* resolver, GAsyncResult* result, GError** error )

No description available.

lookup_by_address: gchar* (* lookup_by_address) ( GResolver* resolver, GInetAddress* address, GCancellable* cancellable, GError** error )

No description available.

lookup_by_address_async: void (* lookup_by_address_async) ( GResolver* resolver, GInetAddress* address, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data )

No description available.

lookup_by_address_finish: gchar* (* lookup_by_address_finish) ( GResolver* resolver, GAsyncResult* result, GError** error )

No description available.

lookup_service: GList* (* lookup_service) ( GResolver* resolver, const gchar* rrname, GCancellable* cancellable, GError** error )

No description available.

lookup_service_async: void (* lookup_service_async) ( GResolver* resolver, const gchar* rrname, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data )

No description available.

lookup_service_finish: GList* (* lookup_service_finish) ( GResolver* resolver, GAsyncResult* result, GError** error )

No description available.

lookup_records: GList* (* lookup_records) ( GResolver* resolver, const gchar* rrname, GResolverRecordType record_type, GCancellable* cancellable, GError** error )

No description available.

lookup_records_async: void (* lookup_records_async) ( GResolver* resolver, const gchar* rrname, GResolverRecordType record_type, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data )

No description available.

lookup_records_finish: GList* (* lookup_records_finish) ( GResolver* resolver, GAsyncResult* result, GError** error )

No description available.

lookup_by_name_with_flags_async: void (* lookup_by_name_with_flags_async) ( GResolver* resolver, const gchar* hostname, GResolverNameLookupFlags flags, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data )

No description available.

lookup_by_name_with_flags_finish: GList* (* lookup_by_name_with_flags_finish) ( GResolver* resolver, GAsyncResult* result, GError** error )

No description available.

lookup_by_name_with_flags: GList* (* lookup_by_name_with_flags) ( GResolver* resolver, const gchar* hostname, GResolverNameLookupFlags flags, GCancellable* cancellable, GError** error )

No description available.

Virtual methods

Gio.ResolverClass.lookup_by_address

Synchronously reverse-resolves address to determine its associated hostname.

since: 2.22

Gio.ResolverClass.lookup_by_address_async

Begins asynchronously reverse-resolving address to determine its associated hostname, and eventually calls callback, which must call g_resolver_lookup_by_address_finish() to get the final result.

since: 2.22

Gio.ResolverClass.lookup_by_address_finish

Retrieves the result of a previous call to g_resolver_lookup_by_address_async().

since: 2.22

Gio.ResolverClass.lookup_by_name

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

since: 2.22

Gio.ResolverClass.lookup_by_name_async

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

since: 2.22

Gio.ResolverClass.lookup_by_name_finish

Retrieves the result of a call to g_resolver_lookup_by_name_async().

since: 2.22

Gio.ResolverClass.lookup_by_name_with_flags

This differs from g_resolver_lookup_by_name() in that you can modify the lookup behavior with flags. For example this can be used to limit results with G_RESOLVER_NAME_LOOKUP_FLAGS_IPV4_ONLY.

since: 2.60

Gio.ResolverClass.lookup_by_name_with_flags_async

Begins asynchronously resolving hostname to determine its associated IP address(es), and eventually calls callback, which must call g_resolver_lookup_by_name_with_flags_finish() to get the result. See g_resolver_lookup_by_name() for more details.

since: 2.60

Gio.ResolverClass.lookup_by_name_with_flags_finish

Retrieves the result of a call to g_resolver_lookup_by_name_with_flags_async().

since: 2.60

Gio.ResolverClass.lookup_records

Synchronously performs a DNS record lookup for the given rrname and returns a list of records as GVariant tuples. See GResolverRecordType for information on what the records contain for each record_type.

since: 2.34

Gio.ResolverClass.lookup_records_async

Begins asynchronously performing a DNS lookup for the given rrname, and eventually calls callback, which must call g_resolver_lookup_records_finish() to get the final result. See g_resolver_lookup_records() for more details.

since: 2.34

Gio.ResolverClass.lookup_records_finish

Retrieves the result of a previous call to g_resolver_lookup_records_async(). Returns a non-empty list of records as GVariant tuples. See GResolverRecordType for information on what the records contain.

since: 2.34

Gio.ResolverClass.lookup_service
No description available.

Gio.ResolverClass.lookup_service_async
No description available.

Gio.ResolverClass.lookup_service_finish

Retrieves the result of a previous call to g_resolver_lookup_service_async().

since: 2.22

Gio.ResolverClass.reload
No description available.