1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
3 /* GIO - GLib Input, Output and Streaming Library
5 * Copyright (C) 2008 Red Hat, Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General
18 * Public License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
20 * Boston, MA 02111-1307, USA.
27 #include "gresolver.h"
28 #include "gnetworkingprivate.h"
29 #include "gasyncresult.h"
30 #include "ginetaddress.h"
31 #include "gsimpleasyncresult.h"
33 #include "gsrvtarget.h"
34 #include "gthreadedresolver.h"
45 * @short_description: Asynchronous and cancellable DNS resolver
48 * #GResolver provides cancellable synchronous and asynchronous DNS
49 * resolution, for hostnames (g_resolver_lookup_by_address(),
50 * g_resolver_lookup_by_name() and their async variants) and SRV
51 * (service) records (g_resolver_lookup_service()).
53 * #GNetworkAddress and #GNetworkService provide wrappers around
54 * #GResolver functionality that also implement #GSocketConnectable,
55 * making it easy to connect to a remote host/service.
63 static guint signals[LAST_SIGNAL] = { 0 };
65 struct _GResolverPrivate {
67 time_t resolv_conf_timestamp;
76 * The object that handles DNS resolution. Use g_resolver_get_default()
77 * to get the default resolver.
79 G_DEFINE_TYPE_WITH_CODE (GResolver, g_resolver, G_TYPE_OBJECT,
80 g_networking_init ();)
83 srv_records_to_targets (GList *records)
85 const gchar *hostname;
86 guint16 port, priority, weight;
90 for (l = records; l != NULL; l = g_list_next (l))
92 g_variant_get (l->data, "(qqq&s)", &priority, &weight, &port, &hostname);
93 target = g_srv_target_new (hostname, port, priority, weight);
94 g_variant_unref (l->data);
98 return g_srv_target_list_sort (records);
102 g_resolver_real_lookup_service (GResolver *resolver,
104 GCancellable *cancellable,
109 records = G_RESOLVER_GET_CLASS (resolver)->lookup_records (resolver,
111 G_RESOLVER_RECORD_SRV,
115 return srv_records_to_targets (records);
119 g_resolver_real_lookup_service_async (GResolver *resolver,
121 GCancellable *cancellable,
122 GAsyncReadyCallback callback,
125 G_RESOLVER_GET_CLASS (resolver)->lookup_records_async (resolver,
127 G_RESOLVER_RECORD_SRV,
134 g_resolver_real_lookup_service_finish (GResolver *resolver,
135 GAsyncResult *result,
140 records = G_RESOLVER_GET_CLASS (resolver)->lookup_records_finish (resolver,
144 return srv_records_to_targets (records);
148 g_resolver_class_init (GResolverClass *resolver_class)
150 /* Automatically pass these over to the lookup_records methods */
151 resolver_class->lookup_service = g_resolver_real_lookup_service;
152 resolver_class->lookup_service_async = g_resolver_real_lookup_service_async;
153 resolver_class->lookup_service_finish = g_resolver_real_lookup_service_finish;
155 g_type_class_add_private (resolver_class, sizeof (GResolverPrivate));
159 * @resolver: a #GResolver
161 * Emitted when the resolver notices that the system resolver
162 * configuration has changed.
165 g_signal_new (I_("reload"),
168 G_STRUCT_OFFSET (GResolverClass, reload),
170 g_cclosure_marshal_VOID__VOID,
175 g_resolver_init (GResolver *resolver)
181 resolver->priv = G_TYPE_INSTANCE_GET_PRIVATE (resolver, G_TYPE_RESOLVER, GResolverPrivate);
184 if (stat (_PATH_RESCONF, &st) == 0)
185 resolver->priv->resolv_conf_timestamp = st.st_mtime;
189 static GResolver *default_resolver;
192 * g_resolver_get_default:
194 * Gets the default #GResolver. You should unref it when you are done
195 * with it. #GResolver may use its reference count as a hint about how
196 * many threads it should allocate for concurrent DNS resolutions.
198 * Return value: (transfer full): the default #GResolver.
203 g_resolver_get_default (void)
205 if (!default_resolver)
206 default_resolver = g_object_new (G_TYPE_THREADED_RESOLVER, NULL);
208 return g_object_ref (default_resolver);
212 * g_resolver_set_default:
213 * @resolver: the new default #GResolver
215 * Sets @resolver to be the application's default resolver (reffing
216 * @resolver, and unreffing the previous default resolver, if any).
217 * Future calls to g_resolver_get_default() will return this resolver.
219 * This can be used if an application wants to perform any sort of DNS
220 * caching or "pinning"; it can implement its own #GResolver that
221 * calls the original default resolver for DNS operations, and
222 * implements its own cache policies on top of that, and then set
223 * itself as the default resolver for all later code to use.
228 g_resolver_set_default (GResolver *resolver)
230 if (default_resolver)
231 g_object_unref (default_resolver);
232 default_resolver = g_object_ref (resolver);
235 /* Bionic has res_init() but it's not in any header */
241 g_resolver_maybe_reload (GResolver *resolver)
246 if (stat (_PATH_RESCONF, &st) == 0)
248 if (st.st_mtime != resolver->priv->resolv_conf_timestamp)
250 resolver->priv->resolv_conf_timestamp = st.st_mtime;
254 g_signal_emit (resolver, signals[RELOAD], 0);
260 /* filter out duplicates, cf. https://bugzilla.gnome.org/show_bug.cgi?id=631379 */
262 remove_duplicates (GList *addrs)
268 /* TODO: if this is too slow (it's O(n^2) but n is typically really
269 * small), we can do something more clever but note that we must not
270 * change the order of elements...
272 for (l = addrs; l != NULL; l = l->next)
274 GInetAddress *address = G_INET_ADDRESS (l->data);
275 for (ll = l->next; ll != NULL; ll = lll)
277 GInetAddress *other_address = G_INET_ADDRESS (ll->data);
279 if (g_inet_address_equal (address, other_address))
281 g_object_unref (other_address);
282 /* we never return the first element */
283 g_warn_if_fail (g_list_delete_link (addrs, ll) == addrs);
291 * g_resolver_lookup_by_name:
292 * @resolver: a #GResolver
293 * @hostname: the hostname to look up
294 * @cancellable: (allow-none): a #GCancellable, or %NULL
295 * @error: return location for a #GError, or %NULL
297 * Synchronously resolves @hostname to determine its associated IP
298 * address(es). @hostname may be an ASCII-only or UTF-8 hostname, or
299 * the textual form of an IP address (in which case this just becomes
300 * a wrapper around g_inet_address_new_from_string()).
302 * On success, g_resolver_lookup_by_name() will return a #GList of
303 * #GInetAddress, sorted in order of preference and guaranteed to not
304 * contain duplicates. That is, if using the result to connect to
305 * @hostname, you should attempt to connect to the first address
306 * first, then the second if the first fails, etc. If you are using
307 * the result to listen on a socket, it is appropriate to add each
308 * result using e.g. g_socket_listener_add_address().
310 * If the DNS resolution fails, @error (if non-%NULL) will be set to a
311 * value from #GResolverError.
313 * If @cancellable is non-%NULL, it can be used to cancel the
314 * operation, in which case @error (if non-%NULL) will be set to
315 * %G_IO_ERROR_CANCELLED.
317 * If you are planning to connect to a socket on the resolved IP
318 * address, it may be easier to create a #GNetworkAddress and use its
319 * #GSocketConnectable interface.
321 * Return value: (element-type GInetAddress) (transfer full): a #GList
322 * of #GInetAddress, or %NULL on error. You
323 * must unref each of the addresses and free the list when you are
324 * done with it. (You can use g_resolver_free_addresses() to do this.)
329 g_resolver_lookup_by_name (GResolver *resolver,
330 const gchar *hostname,
331 GCancellable *cancellable,
336 gchar *ascii_hostname = NULL;
338 g_return_val_if_fail (G_IS_RESOLVER (resolver), NULL);
339 g_return_val_if_fail (hostname != NULL, NULL);
341 /* Check if @hostname is just an IP address */
342 addr = g_inet_address_new_from_string (hostname);
344 return g_list_append (NULL, addr);
346 if (g_hostname_is_non_ascii (hostname))
347 hostname = ascii_hostname = g_hostname_to_ascii (hostname);
349 g_resolver_maybe_reload (resolver);
350 addrs = G_RESOLVER_GET_CLASS (resolver)->
351 lookup_by_name (resolver, hostname, cancellable, error);
353 remove_duplicates (addrs);
355 g_free (ascii_hostname);
360 * g_resolver_lookup_by_name_async:
361 * @resolver: a #GResolver
362 * @hostname: the hostname to look up the address of
363 * @cancellable: (allow-none): a #GCancellable, or %NULL
364 * @callback: (scope async): callback to call after resolution completes
365 * @user_data: (closure): data for @callback
367 * Begins asynchronously resolving @hostname to determine its
368 * associated IP address(es), and eventually calls @callback, which
369 * must call g_resolver_lookup_by_name_finish() to get the result.
370 * See g_resolver_lookup_by_name() for more details.
375 g_resolver_lookup_by_name_async (GResolver *resolver,
376 const gchar *hostname,
377 GCancellable *cancellable,
378 GAsyncReadyCallback callback,
382 gchar *ascii_hostname = NULL;
384 g_return_if_fail (G_IS_RESOLVER (resolver));
385 g_return_if_fail (hostname != NULL);
387 /* Check if @hostname is just an IP address */
388 addr = g_inet_address_new_from_string (hostname);
393 task = g_task_new (resolver, cancellable, callback, user_data);
394 g_task_set_source_tag (task, g_resolver_lookup_by_name_async);
395 g_task_return_pointer (task, g_list_append (NULL, addr),
396 (GDestroyNotify) g_resolver_free_addresses);
397 g_object_unref (task);
401 if (g_hostname_is_non_ascii (hostname))
402 hostname = ascii_hostname = g_hostname_to_ascii (hostname);
404 g_resolver_maybe_reload (resolver);
405 G_RESOLVER_GET_CLASS (resolver)->
406 lookup_by_name_async (resolver, hostname, cancellable, callback, user_data);
408 g_free (ascii_hostname);
412 * g_resolver_lookup_by_name_finish:
413 * @resolver: a #GResolver
414 * @result: the result passed to your #GAsyncReadyCallback
415 * @error: return location for a #GError, or %NULL
417 * Retrieves the result of a call to
418 * g_resolver_lookup_by_name_async().
420 * If the DNS resolution failed, @error (if non-%NULL) will be set to
421 * a value from #GResolverError. If the operation was cancelled,
422 * @error will be set to %G_IO_ERROR_CANCELLED.
424 * Return value: (element-type GInetAddress) (transfer full): a #GList
425 * of #GInetAddress, or %NULL on error. See g_resolver_lookup_by_name()
431 g_resolver_lookup_by_name_finish (GResolver *resolver,
432 GAsyncResult *result,
437 g_return_val_if_fail (G_IS_RESOLVER (resolver), NULL);
439 if (g_async_result_legacy_propagate_error (result, error))
441 else if (g_async_result_is_tagged (result, g_resolver_lookup_by_name_async))
443 /* Handle the stringified-IP-addr case */
444 return g_task_propagate_pointer (G_TASK (result), error);
447 addrs = G_RESOLVER_GET_CLASS (resolver)->
448 lookup_by_name_finish (resolver, result, error);
450 remove_duplicates (addrs);
456 * g_resolver_free_addresses: (skip)
457 * @addresses: a #GList of #GInetAddress
459 * Frees @addresses (which should be the return value from
460 * g_resolver_lookup_by_name() or g_resolver_lookup_by_name_finish()).
461 * (This is a convenience method; you can also simply free the results
467 g_resolver_free_addresses (GList *addresses)
471 for (a = addresses; a; a = a->next)
472 g_object_unref (a->data);
473 g_list_free (addresses);
477 * g_resolver_lookup_by_address:
478 * @resolver: a #GResolver
479 * @address: the address to reverse-resolve
480 * @cancellable: (allow-none): a #GCancellable, or %NULL
481 * @error: return location for a #GError, or %NULL
483 * Synchronously reverse-resolves @address to determine its
484 * associated hostname.
486 * If the DNS resolution fails, @error (if non-%NULL) will be set to
487 * a value from #GResolverError.
489 * If @cancellable is non-%NULL, it can be used to cancel the
490 * operation, in which case @error (if non-%NULL) will be set to
491 * %G_IO_ERROR_CANCELLED.
493 * Return value: a hostname (either ASCII-only, or in ASCII-encoded
494 * form), or %NULL on error.
499 g_resolver_lookup_by_address (GResolver *resolver,
500 GInetAddress *address,
501 GCancellable *cancellable,
504 g_return_val_if_fail (G_IS_RESOLVER (resolver), NULL);
505 g_return_val_if_fail (G_IS_INET_ADDRESS (address), NULL);
507 g_resolver_maybe_reload (resolver);
508 return G_RESOLVER_GET_CLASS (resolver)->
509 lookup_by_address (resolver, address, cancellable, error);
513 * g_resolver_lookup_by_address_async:
514 * @resolver: a #GResolver
515 * @address: the address to reverse-resolve
516 * @cancellable: (allow-none): a #GCancellable, or %NULL
517 * @callback: (scope async): callback to call after resolution completes
518 * @user_data: (closure): data for @callback
520 * Begins asynchronously reverse-resolving @address to determine its
521 * associated hostname, and eventually calls @callback, which must
522 * call g_resolver_lookup_by_address_finish() to get the final result.
527 g_resolver_lookup_by_address_async (GResolver *resolver,
528 GInetAddress *address,
529 GCancellable *cancellable,
530 GAsyncReadyCallback callback,
533 g_return_if_fail (G_IS_RESOLVER (resolver));
534 g_return_if_fail (G_IS_INET_ADDRESS (address));
536 g_resolver_maybe_reload (resolver);
537 G_RESOLVER_GET_CLASS (resolver)->
538 lookup_by_address_async (resolver, address, cancellable, callback, user_data);
542 * g_resolver_lookup_by_address_finish:
543 * @resolver: a #GResolver
544 * @result: the result passed to your #GAsyncReadyCallback
545 * @error: return location for a #GError, or %NULL
547 * Retrieves the result of a previous call to
548 * g_resolver_lookup_by_address_async().
550 * If the DNS resolution failed, @error (if non-%NULL) will be set to
551 * a value from #GResolverError. If the operation was cancelled,
552 * @error will be set to %G_IO_ERROR_CANCELLED.
554 * Return value: a hostname (either ASCII-only, or in ASCII-encoded
555 * form), or %NULL on error.
560 g_resolver_lookup_by_address_finish (GResolver *resolver,
561 GAsyncResult *result,
564 g_return_val_if_fail (G_IS_RESOLVER (resolver), NULL);
566 if (g_async_result_legacy_propagate_error (result, error))
569 return G_RESOLVER_GET_CLASS (resolver)->
570 lookup_by_address_finish (resolver, result, error);
574 g_resolver_get_service_rrname (const char *service,
575 const char *protocol,
578 gchar *rrname, *ascii_domain = NULL;
580 if (g_hostname_is_non_ascii (domain))
581 domain = ascii_domain = g_hostname_to_ascii (domain);
583 rrname = g_strdup_printf ("_%s._%s.%s", service, protocol, domain);
585 g_free (ascii_domain);
590 * g_resolver_lookup_service:
591 * @resolver: a #GResolver
592 * @service: the service type to look up (eg, "ldap")
593 * @protocol: the networking protocol to use for @service (eg, "tcp")
594 * @domain: the DNS domain to look up the service in
595 * @cancellable: (allow-none): a #GCancellable, or %NULL
596 * @error: return location for a #GError, or %NULL
598 * Synchronously performs a DNS SRV lookup for the given @service and
599 * @protocol in the given @domain and returns an array of #GSrvTarget.
600 * @domain may be an ASCII-only or UTF-8 hostname. Note also that the
601 * @service and @protocol arguments <emphasis>do not</emphasis>
602 * include the leading underscore that appears in the actual DNS
605 * On success, g_resolver_lookup_service() will return a #GList of
606 * #GSrvTarget, sorted in order of preference. (That is, you should
607 * attempt to connect to the first target first, then the second if
608 * the first fails, etc.)
610 * If the DNS resolution fails, @error (if non-%NULL) will be set to
611 * a value from #GResolverError.
613 * If @cancellable is non-%NULL, it can be used to cancel the
614 * operation, in which case @error (if non-%NULL) will be set to
615 * %G_IO_ERROR_CANCELLED.
617 * If you are planning to connect to the service, it is usually easier
618 * to create a #GNetworkService and use its #GSocketConnectable
621 * Return value: (element-type GSrvTarget) (transfer full): a #GList of #GSrvTarget,
622 * or %NULL on error. You must free each of the targets and the list when you are
623 * done with it. (You can use g_resolver_free_targets() to do this.)
628 g_resolver_lookup_service (GResolver *resolver,
629 const gchar *service,
630 const gchar *protocol,
632 GCancellable *cancellable,
638 g_return_val_if_fail (G_IS_RESOLVER (resolver), NULL);
639 g_return_val_if_fail (service != NULL, NULL);
640 g_return_val_if_fail (protocol != NULL, NULL);
641 g_return_val_if_fail (domain != NULL, NULL);
643 rrname = g_resolver_get_service_rrname (service, protocol, domain);
645 g_resolver_maybe_reload (resolver);
646 targets = G_RESOLVER_GET_CLASS (resolver)->
647 lookup_service (resolver, rrname, cancellable, error);
654 * g_resolver_lookup_service_async:
655 * @resolver: a #GResolver
656 * @service: the service type to look up (eg, "ldap")
657 * @protocol: the networking protocol to use for @service (eg, "tcp")
658 * @domain: the DNS domain to look up the service in
659 * @cancellable: (allow-none): a #GCancellable, or %NULL
660 * @callback: (scope async): callback to call after resolution completes
661 * @user_data: (closure): data for @callback
663 * Begins asynchronously performing a DNS SRV lookup for the given
664 * @service and @protocol in the given @domain, and eventually calls
665 * @callback, which must call g_resolver_lookup_service_finish() to
666 * get the final result. See g_resolver_lookup_service() for more
672 g_resolver_lookup_service_async (GResolver *resolver,
673 const gchar *service,
674 const gchar *protocol,
676 GCancellable *cancellable,
677 GAsyncReadyCallback callback,
682 g_return_if_fail (G_IS_RESOLVER (resolver));
683 g_return_if_fail (service != NULL);
684 g_return_if_fail (protocol != NULL);
685 g_return_if_fail (domain != NULL);
687 rrname = g_resolver_get_service_rrname (service, protocol, domain);
689 g_resolver_maybe_reload (resolver);
690 G_RESOLVER_GET_CLASS (resolver)->
691 lookup_service_async (resolver, rrname, cancellable, callback, user_data);
697 * g_resolver_lookup_service_finish:
698 * @resolver: a #GResolver
699 * @result: the result passed to your #GAsyncReadyCallback
700 * @error: return location for a #GError, or %NULL
702 * Retrieves the result of a previous call to
703 * g_resolver_lookup_service_async().
705 * If the DNS resolution failed, @error (if non-%NULL) will be set to
706 * a value from #GResolverError. If the operation was cancelled,
707 * @error will be set to %G_IO_ERROR_CANCELLED.
709 * Return value: (element-type GSrvTarget) (transfer full): a #GList of #GSrvTarget,
710 * or %NULL on error. See g_resolver_lookup_service() for more details.
715 g_resolver_lookup_service_finish (GResolver *resolver,
716 GAsyncResult *result,
719 g_return_val_if_fail (G_IS_RESOLVER (resolver), NULL);
721 if (g_async_result_legacy_propagate_error (result, error))
724 return G_RESOLVER_GET_CLASS (resolver)->
725 lookup_service_finish (resolver, result, error);
729 * g_resolver_free_targets: (skip)
730 * @targets: a #GList of #GSrvTarget
732 * Frees @targets (which should be the return value from
733 * g_resolver_lookup_service() or g_resolver_lookup_service_finish()).
734 * (This is a convenience method; you can also simply free the
740 g_resolver_free_targets (GList *targets)
744 for (t = targets; t; t = t->next)
745 g_srv_target_free (t->data);
746 g_list_free (targets);
750 * g_resolver_lookup_records:
751 * @resolver: a #GResolver
752 * @rrname: the DNS name to lookup the record for
753 * @record_type: the type of DNS record to lookup
754 * @cancellable: (allow-none): a #GCancellable, or %NULL
755 * @error: return location for a #GError, or %NULL
757 * Synchronously performs a DNS record lookup for the given @rrname and returns
758 * a list of records as #GVariant tuples. See #GResolverRecordType for
759 * information on what the records contain for each @record_type.
761 * If the DNS resolution fails, @error (if non-%NULL) will be set to
762 * a value from #GResolverError.
764 * If @cancellable is non-%NULL, it can be used to cancel the
765 * operation, in which case @error (if non-%NULL) will be set to
766 * %G_IO_ERROR_CANCELLED.
768 * Return value: (element-type GVariant) (transfer full): a #GList of #GVariant,
769 * or %NULL on error. You must free each of the records and the list when you are
770 * done with it. (You can use g_list_free_full() with g_variant_unref() to do this.)
775 g_resolver_lookup_records (GResolver *resolver,
777 GResolverRecordType record_type,
778 GCancellable *cancellable,
783 g_return_val_if_fail (G_IS_RESOLVER (resolver), NULL);
784 g_return_val_if_fail (rrname != NULL, NULL);
786 g_resolver_maybe_reload (resolver);
787 records = G_RESOLVER_GET_CLASS (resolver)->
788 lookup_records (resolver, rrname, record_type, cancellable, error);
794 * g_resolver_lookup_records_async:
795 * @resolver: a #GResolver
796 * @rrname: the DNS name to lookup the record for
797 * @record_type: the type of DNS record to lookup
798 * @cancellable: (allow-none): a #GCancellable, or %NULL
799 * @callback: (scope async): callback to call after resolution completes
800 * @user_data: (closure): data for @callback
802 * Begins asynchronously performing a DNS lookup for the given
803 * @rrname, and eventually calls @callback, which must call
804 * g_resolver_lookup_records_finish() to get the final result. See
805 * g_resolver_lookup_records() for more details.
810 g_resolver_lookup_records_async (GResolver *resolver,
812 GResolverRecordType record_type,
813 GCancellable *cancellable,
814 GAsyncReadyCallback callback,
817 g_return_if_fail (G_IS_RESOLVER (resolver));
818 g_return_if_fail (rrname != NULL);
820 g_resolver_maybe_reload (resolver);
821 G_RESOLVER_GET_CLASS (resolver)->
822 lookup_records_async (resolver, rrname, record_type, cancellable, callback, user_data);
826 * g_resolver_lookup_records_finish:
827 * @resolver: a #GResolver
828 * @result: the result passed to your #GAsyncReadyCallback
829 * @error: return location for a #GError, or %NULL
831 * Retrieves the result of a previous call to
832 * g_resolver_lookup_records_async(). Returns a list of records as #GVariant
833 * tuples. See #GResolverRecordType for information on what the records contain.
835 * If the DNS resolution failed, @error (if non-%NULL) will be set to
836 * a value from #GResolverError. If the operation was cancelled,
837 * @error will be set to %G_IO_ERROR_CANCELLED.
839 * Return value: (element-type GVariant) (transfer full): a #GList of #GVariant,
840 * or %NULL on error. You must free each of the records and the list when you are
841 * done with it. (You can use g_list_free_full() with g_variant_unref() to do this.)
846 g_resolver_lookup_records_finish (GResolver *resolver,
847 GAsyncResult *result,
850 g_return_val_if_fail (G_IS_RESOLVER (resolver), NULL);
851 return G_RESOLVER_GET_CLASS (resolver)->
852 lookup_records_finish (resolver, result, error);
856 g_resolver_get_serial (GResolver *resolver)
858 g_return_val_if_fail (G_IS_RESOLVER (resolver), 0);
860 g_resolver_maybe_reload (resolver);
863 return (guint64) resolver->priv->resolv_conf_timestamp;
870 * g_resolver_error_quark:
872 * Gets the #GResolver Error Quark.
874 * Return value: a #GQuark.
878 G_DEFINE_QUARK (g-resolver-error-quark, g_resolver_error)