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, see <http://www.gnu.org/licenses/>.
25 #include "gresolver.h"
26 #include "gnetworkingprivate.h"
27 #include "gasyncresult.h"
28 #include "ginetaddress.h"
29 #include "gsimpleasyncresult.h"
31 #include "gsrvtarget.h"
32 #include "gthreadedresolver.h"
43 * @short_description: Asynchronous and cancellable DNS resolver
46 * #GResolver provides cancellable synchronous and asynchronous DNS
47 * resolution, for hostnames (g_resolver_lookup_by_address(),
48 * g_resolver_lookup_by_name() and their async variants) and SRV
49 * (service) records (g_resolver_lookup_service()).
51 * #GNetworkAddress and #GNetworkService provide wrappers around
52 * #GResolver functionality that also implement #GSocketConnectable,
53 * making it easy to connect to a remote host/service.
61 static guint signals[LAST_SIGNAL] = { 0 };
63 struct _GResolverPrivate {
65 time_t resolv_conf_timestamp;
74 * The object that handles DNS resolution. Use g_resolver_get_default()
75 * to get the default resolver.
77 G_DEFINE_TYPE_WITH_CODE (GResolver, g_resolver, G_TYPE_OBJECT,
78 G_ADD_PRIVATE (GResolver)
79 g_networking_init ();)
82 srv_records_to_targets (GList *records)
84 const gchar *hostname;
85 guint16 port, priority, weight;
89 for (l = records; l != NULL; l = g_list_next (l))
91 g_variant_get (l->data, "(qqq&s)", &priority, &weight, &port, &hostname);
92 target = g_srv_target_new (hostname, port, priority, weight);
93 g_variant_unref (l->data);
97 return g_srv_target_list_sort (records);
101 g_resolver_real_lookup_service (GResolver *resolver,
103 GCancellable *cancellable,
108 records = G_RESOLVER_GET_CLASS (resolver)->lookup_records (resolver,
110 G_RESOLVER_RECORD_SRV,
114 return srv_records_to_targets (records);
118 g_resolver_real_lookup_service_async (GResolver *resolver,
120 GCancellable *cancellable,
121 GAsyncReadyCallback callback,
124 G_RESOLVER_GET_CLASS (resolver)->lookup_records_async (resolver,
126 G_RESOLVER_RECORD_SRV,
133 g_resolver_real_lookup_service_finish (GResolver *resolver,
134 GAsyncResult *result,
139 records = G_RESOLVER_GET_CLASS (resolver)->lookup_records_finish (resolver,
143 return srv_records_to_targets (records);
147 g_resolver_class_init (GResolverClass *resolver_class)
149 /* Automatically pass these over to the lookup_records methods */
150 resolver_class->lookup_service = g_resolver_real_lookup_service;
151 resolver_class->lookup_service_async = g_resolver_real_lookup_service_async;
152 resolver_class->lookup_service_finish = g_resolver_real_lookup_service_finish;
156 * @resolver: a #GResolver
158 * Emitted when the resolver notices that the system resolver
159 * configuration has changed.
162 g_signal_new (I_("reload"),
165 G_STRUCT_OFFSET (GResolverClass, reload),
167 g_cclosure_marshal_VOID__VOID,
172 g_resolver_init (GResolver *resolver)
178 resolver->priv = g_resolver_get_instance_private (resolver);
181 if (stat (_PATH_RESCONF, &st) == 0)
182 resolver->priv->resolv_conf_timestamp = st.st_mtime;
186 static GResolver *default_resolver;
189 * g_resolver_get_default:
191 * Gets the default #GResolver. You should unref it when you are done
192 * with it. #GResolver may use its reference count as a hint about how
193 * many threads it should allocate for concurrent DNS resolutions.
195 * Return value: (transfer full): the default #GResolver.
200 g_resolver_get_default (void)
202 if (!default_resolver)
203 default_resolver = g_object_new (G_TYPE_THREADED_RESOLVER, NULL);
205 return g_object_ref (default_resolver);
209 * g_resolver_set_default:
210 * @resolver: the new default #GResolver
212 * Sets @resolver to be the application's default resolver (reffing
213 * @resolver, and unreffing the previous default resolver, if any).
214 * Future calls to g_resolver_get_default() will return this resolver.
216 * This can be used if an application wants to perform any sort of DNS
217 * caching or "pinning"; it can implement its own #GResolver that
218 * calls the original default resolver for DNS operations, and
219 * implements its own cache policies on top of that, and then set
220 * itself as the default resolver for all later code to use.
225 g_resolver_set_default (GResolver *resolver)
227 if (default_resolver)
228 g_object_unref (default_resolver);
229 default_resolver = g_object_ref (resolver);
232 /* Bionic has res_init() but it's not in any header */
238 g_resolver_maybe_reload (GResolver *resolver)
243 if (stat (_PATH_RESCONF, &st) == 0)
245 if (st.st_mtime != resolver->priv->resolv_conf_timestamp)
247 resolver->priv->resolv_conf_timestamp = st.st_mtime;
251 g_signal_emit (resolver, signals[RELOAD], 0);
257 /* filter out duplicates, cf. https://bugzilla.gnome.org/show_bug.cgi?id=631379 */
259 remove_duplicates (GList *addrs)
265 /* TODO: if this is too slow (it's O(n^2) but n is typically really
266 * small), we can do something more clever but note that we must not
267 * change the order of elements...
269 for (l = addrs; l != NULL; l = l->next)
271 GInetAddress *address = G_INET_ADDRESS (l->data);
272 for (ll = l->next; ll != NULL; ll = lll)
274 GInetAddress *other_address = G_INET_ADDRESS (ll->data);
276 if (g_inet_address_equal (address, other_address))
278 g_object_unref (other_address);
279 /* we never return the first element */
280 g_warn_if_fail (g_list_delete_link (addrs, ll) == addrs);
286 /* Note that this does not follow the "FALSE means @error is set"
287 * convention. The return value tells the caller whether it should
288 * return @addrs and @error to the caller right away, or if it should
289 * continue and trying to resolve the name as a hostname.
292 handle_ip_address (const char *hostname,
297 struct in_addr ip4addr;
299 addr = g_inet_address_new_from_string (hostname);
302 *addrs = g_list_append (NULL, addr);
308 /* Reject non-standard IPv4 numbers-and-dots addresses.
309 * g_inet_address_new_from_string() will have accepted any "real" IP
310 * address, so if inet_aton() succeeds, then it's an address we want
313 if (inet_aton (hostname, &ip4addr))
315 g_set_error (error, G_RESOLVER_ERROR, G_RESOLVER_ERROR_NOT_FOUND,
316 _("Error resolving '%s': %s"),
317 hostname, gai_strerror (EAI_NONAME));
325 * g_resolver_lookup_by_name:
326 * @resolver: a #GResolver
327 * @hostname: the hostname to look up
328 * @cancellable: (allow-none): a #GCancellable, or %NULL
329 * @error: return location for a #GError, or %NULL
331 * Synchronously resolves @hostname to determine its associated IP
332 * address(es). @hostname may be an ASCII-only or UTF-8 hostname, or
333 * the textual form of an IP address (in which case this just becomes
334 * a wrapper around g_inet_address_new_from_string()).
336 * On success, g_resolver_lookup_by_name() will return a #GList of
337 * #GInetAddress, sorted in order of preference and guaranteed to not
338 * contain duplicates. That is, if using the result to connect to
339 * @hostname, you should attempt to connect to the first address
340 * first, then the second if the first fails, etc. If you are using
341 * the result to listen on a socket, it is appropriate to add each
342 * result using e.g. g_socket_listener_add_address().
344 * If the DNS resolution fails, @error (if non-%NULL) will be set to a
345 * value from #GResolverError.
347 * If @cancellable is non-%NULL, it can be used to cancel the
348 * operation, in which case @error (if non-%NULL) will be set to
349 * %G_IO_ERROR_CANCELLED.
351 * If you are planning to connect to a socket on the resolved IP
352 * address, it may be easier to create a #GNetworkAddress and use its
353 * #GSocketConnectable interface.
355 * Return value: (element-type GInetAddress) (transfer full): a #GList
356 * of #GInetAddress, or %NULL on error. You
357 * must unref each of the addresses and free the list when you are
358 * done with it. (You can use g_resolver_free_addresses() to do this.)
363 g_resolver_lookup_by_name (GResolver *resolver,
364 const gchar *hostname,
365 GCancellable *cancellable,
369 gchar *ascii_hostname = NULL;
371 g_return_val_if_fail (G_IS_RESOLVER (resolver), NULL);
372 g_return_val_if_fail (hostname != NULL, NULL);
374 /* Check if @hostname is just an IP address */
375 if (handle_ip_address (hostname, &addrs, error))
378 if (g_hostname_is_non_ascii (hostname))
379 hostname = ascii_hostname = g_hostname_to_ascii (hostname);
381 g_resolver_maybe_reload (resolver);
382 addrs = G_RESOLVER_GET_CLASS (resolver)->
383 lookup_by_name (resolver, hostname, cancellable, error);
385 remove_duplicates (addrs);
387 g_free (ascii_hostname);
392 * g_resolver_lookup_by_name_async:
393 * @resolver: a #GResolver
394 * @hostname: the hostname to look up the address of
395 * @cancellable: (allow-none): a #GCancellable, or %NULL
396 * @callback: (scope async): callback to call after resolution completes
397 * @user_data: (closure): data for @callback
399 * Begins asynchronously resolving @hostname to determine its
400 * associated IP address(es), and eventually calls @callback, which
401 * must call g_resolver_lookup_by_name_finish() to get the result.
402 * See g_resolver_lookup_by_name() for more details.
407 g_resolver_lookup_by_name_async (GResolver *resolver,
408 const gchar *hostname,
409 GCancellable *cancellable,
410 GAsyncReadyCallback callback,
413 gchar *ascii_hostname = NULL;
415 GError *error = NULL;
417 g_return_if_fail (G_IS_RESOLVER (resolver));
418 g_return_if_fail (hostname != NULL);
420 /* Check if @hostname is just an IP address */
421 if (handle_ip_address (hostname, &addrs, &error))
425 task = g_task_new (resolver, cancellable, callback, user_data);
426 g_task_set_source_tag (task, g_resolver_lookup_by_name_async);
428 g_task_return_pointer (task, addrs, (GDestroyNotify) g_resolver_free_addresses);
430 g_task_return_error (task, error);
431 g_object_unref (task);
435 if (g_hostname_is_non_ascii (hostname))
436 hostname = ascii_hostname = g_hostname_to_ascii (hostname);
438 g_resolver_maybe_reload (resolver);
439 G_RESOLVER_GET_CLASS (resolver)->
440 lookup_by_name_async (resolver, hostname, cancellable, callback, user_data);
442 g_free (ascii_hostname);
446 * g_resolver_lookup_by_name_finish:
447 * @resolver: a #GResolver
448 * @result: the result passed to your #GAsyncReadyCallback
449 * @error: return location for a #GError, or %NULL
451 * Retrieves the result of a call to
452 * g_resolver_lookup_by_name_async().
454 * If the DNS resolution failed, @error (if non-%NULL) will be set to
455 * a value from #GResolverError. If the operation was cancelled,
456 * @error will be set to %G_IO_ERROR_CANCELLED.
458 * Return value: (element-type GInetAddress) (transfer full): a #GList
459 * of #GInetAddress, or %NULL on error. See g_resolver_lookup_by_name()
465 g_resolver_lookup_by_name_finish (GResolver *resolver,
466 GAsyncResult *result,
471 g_return_val_if_fail (G_IS_RESOLVER (resolver), NULL);
473 if (g_async_result_legacy_propagate_error (result, error))
475 else if (g_async_result_is_tagged (result, g_resolver_lookup_by_name_async))
477 /* Handle the stringified-IP-addr case */
478 return g_task_propagate_pointer (G_TASK (result), error);
481 addrs = G_RESOLVER_GET_CLASS (resolver)->
482 lookup_by_name_finish (resolver, result, error);
484 remove_duplicates (addrs);
490 * g_resolver_free_addresses: (skip)
491 * @addresses: a #GList of #GInetAddress
493 * Frees @addresses (which should be the return value from
494 * g_resolver_lookup_by_name() or g_resolver_lookup_by_name_finish()).
495 * (This is a convenience method; you can also simply free the results
501 g_resolver_free_addresses (GList *addresses)
505 for (a = addresses; a; a = a->next)
506 g_object_unref (a->data);
507 g_list_free (addresses);
511 * g_resolver_lookup_by_address:
512 * @resolver: a #GResolver
513 * @address: the address to reverse-resolve
514 * @cancellable: (allow-none): a #GCancellable, or %NULL
515 * @error: return location for a #GError, or %NULL
517 * Synchronously reverse-resolves @address to determine its
518 * associated hostname.
520 * If the DNS resolution fails, @error (if non-%NULL) will be set to
521 * a value from #GResolverError.
523 * If @cancellable is non-%NULL, it can be used to cancel the
524 * operation, in which case @error (if non-%NULL) will be set to
525 * %G_IO_ERROR_CANCELLED.
527 * Return value: a hostname (either ASCII-only, or in ASCII-encoded
528 * form), or %NULL on error.
533 g_resolver_lookup_by_address (GResolver *resolver,
534 GInetAddress *address,
535 GCancellable *cancellable,
538 g_return_val_if_fail (G_IS_RESOLVER (resolver), NULL);
539 g_return_val_if_fail (G_IS_INET_ADDRESS (address), NULL);
541 g_resolver_maybe_reload (resolver);
542 return G_RESOLVER_GET_CLASS (resolver)->
543 lookup_by_address (resolver, address, cancellable, error);
547 * g_resolver_lookup_by_address_async:
548 * @resolver: a #GResolver
549 * @address: the address to reverse-resolve
550 * @cancellable: (allow-none): a #GCancellable, or %NULL
551 * @callback: (scope async): callback to call after resolution completes
552 * @user_data: (closure): data for @callback
554 * Begins asynchronously reverse-resolving @address to determine its
555 * associated hostname, and eventually calls @callback, which must
556 * call g_resolver_lookup_by_address_finish() to get the final result.
561 g_resolver_lookup_by_address_async (GResolver *resolver,
562 GInetAddress *address,
563 GCancellable *cancellable,
564 GAsyncReadyCallback callback,
567 g_return_if_fail (G_IS_RESOLVER (resolver));
568 g_return_if_fail (G_IS_INET_ADDRESS (address));
570 g_resolver_maybe_reload (resolver);
571 G_RESOLVER_GET_CLASS (resolver)->
572 lookup_by_address_async (resolver, address, cancellable, callback, user_data);
576 * g_resolver_lookup_by_address_finish:
577 * @resolver: a #GResolver
578 * @result: the result passed to your #GAsyncReadyCallback
579 * @error: return location for a #GError, or %NULL
581 * Retrieves the result of a previous call to
582 * g_resolver_lookup_by_address_async().
584 * If the DNS resolution failed, @error (if non-%NULL) will be set to
585 * a value from #GResolverError. If the operation was cancelled,
586 * @error will be set to %G_IO_ERROR_CANCELLED.
588 * Return value: a hostname (either ASCII-only, or in ASCII-encoded
589 * form), or %NULL on error.
594 g_resolver_lookup_by_address_finish (GResolver *resolver,
595 GAsyncResult *result,
598 g_return_val_if_fail (G_IS_RESOLVER (resolver), NULL);
600 if (g_async_result_legacy_propagate_error (result, error))
603 return G_RESOLVER_GET_CLASS (resolver)->
604 lookup_by_address_finish (resolver, result, error);
608 g_resolver_get_service_rrname (const char *service,
609 const char *protocol,
612 gchar *rrname, *ascii_domain = NULL;
614 if (g_hostname_is_non_ascii (domain))
615 domain = ascii_domain = g_hostname_to_ascii (domain);
617 rrname = g_strdup_printf ("_%s._%s.%s", service, protocol, domain);
619 g_free (ascii_domain);
624 * g_resolver_lookup_service:
625 * @resolver: a #GResolver
626 * @service: the service type to look up (eg, "ldap")
627 * @protocol: the networking protocol to use for @service (eg, "tcp")
628 * @domain: the DNS domain to look up the service in
629 * @cancellable: (allow-none): a #GCancellable, or %NULL
630 * @error: return location for a #GError, or %NULL
632 * Synchronously performs a DNS SRV lookup for the given @service and
633 * @protocol in the given @domain and returns an array of #GSrvTarget.
634 * @domain may be an ASCII-only or UTF-8 hostname. Note also that the
635 * @service and @protocol arguments do not include the leading underscore
636 * that appears in the actual DNS entry.
638 * On success, g_resolver_lookup_service() will return a #GList of
639 * #GSrvTarget, sorted in order of preference. (That is, you should
640 * attempt to connect to the first target first, then the second if
641 * the first fails, etc.)
643 * If the DNS resolution fails, @error (if non-%NULL) will be set to
644 * a value from #GResolverError.
646 * If @cancellable is non-%NULL, it can be used to cancel the
647 * operation, in which case @error (if non-%NULL) will be set to
648 * %G_IO_ERROR_CANCELLED.
650 * If you are planning to connect to the service, it is usually easier
651 * to create a #GNetworkService and use its #GSocketConnectable
654 * Return value: (element-type GSrvTarget) (transfer full): a #GList of #GSrvTarget,
655 * or %NULL on error. You must free each of the targets and the list when you are
656 * done with it. (You can use g_resolver_free_targets() to do this.)
661 g_resolver_lookup_service (GResolver *resolver,
662 const gchar *service,
663 const gchar *protocol,
665 GCancellable *cancellable,
671 g_return_val_if_fail (G_IS_RESOLVER (resolver), NULL);
672 g_return_val_if_fail (service != NULL, NULL);
673 g_return_val_if_fail (protocol != NULL, NULL);
674 g_return_val_if_fail (domain != NULL, NULL);
676 rrname = g_resolver_get_service_rrname (service, protocol, domain);
678 g_resolver_maybe_reload (resolver);
679 targets = G_RESOLVER_GET_CLASS (resolver)->
680 lookup_service (resolver, rrname, cancellable, error);
687 * g_resolver_lookup_service_async:
688 * @resolver: a #GResolver
689 * @service: the service type to look up (eg, "ldap")
690 * @protocol: the networking protocol to use for @service (eg, "tcp")
691 * @domain: the DNS domain to look up the service in
692 * @cancellable: (allow-none): a #GCancellable, or %NULL
693 * @callback: (scope async): callback to call after resolution completes
694 * @user_data: (closure): data for @callback
696 * Begins asynchronously performing a DNS SRV lookup for the given
697 * @service and @protocol in the given @domain, and eventually calls
698 * @callback, which must call g_resolver_lookup_service_finish() to
699 * get the final result. See g_resolver_lookup_service() for more
705 g_resolver_lookup_service_async (GResolver *resolver,
706 const gchar *service,
707 const gchar *protocol,
709 GCancellable *cancellable,
710 GAsyncReadyCallback callback,
715 g_return_if_fail (G_IS_RESOLVER (resolver));
716 g_return_if_fail (service != NULL);
717 g_return_if_fail (protocol != NULL);
718 g_return_if_fail (domain != NULL);
720 rrname = g_resolver_get_service_rrname (service, protocol, domain);
722 g_resolver_maybe_reload (resolver);
723 G_RESOLVER_GET_CLASS (resolver)->
724 lookup_service_async (resolver, rrname, cancellable, callback, user_data);
730 * g_resolver_lookup_service_finish:
731 * @resolver: a #GResolver
732 * @result: the result passed to your #GAsyncReadyCallback
733 * @error: return location for a #GError, or %NULL
735 * Retrieves the result of a previous call to
736 * g_resolver_lookup_service_async().
738 * If the DNS resolution failed, @error (if non-%NULL) will be set to
739 * a value from #GResolverError. If the operation was cancelled,
740 * @error will be set to %G_IO_ERROR_CANCELLED.
742 * Return value: (element-type GSrvTarget) (transfer full): a #GList of #GSrvTarget,
743 * or %NULL on error. See g_resolver_lookup_service() for more details.
748 g_resolver_lookup_service_finish (GResolver *resolver,
749 GAsyncResult *result,
752 g_return_val_if_fail (G_IS_RESOLVER (resolver), NULL);
754 if (g_async_result_legacy_propagate_error (result, error))
757 return G_RESOLVER_GET_CLASS (resolver)->
758 lookup_service_finish (resolver, result, error);
762 * g_resolver_free_targets: (skip)
763 * @targets: a #GList of #GSrvTarget
765 * Frees @targets (which should be the return value from
766 * g_resolver_lookup_service() or g_resolver_lookup_service_finish()).
767 * (This is a convenience method; you can also simply free the
773 g_resolver_free_targets (GList *targets)
777 for (t = targets; t; t = t->next)
778 g_srv_target_free (t->data);
779 g_list_free (targets);
783 * g_resolver_lookup_records:
784 * @resolver: a #GResolver
785 * @rrname: the DNS name to lookup the record for
786 * @record_type: the type of DNS record to lookup
787 * @cancellable: (allow-none): a #GCancellable, or %NULL
788 * @error: return location for a #GError, or %NULL
790 * Synchronously performs a DNS record lookup for the given @rrname and returns
791 * a list of records as #GVariant tuples. See #GResolverRecordType for
792 * information on what the records contain for each @record_type.
794 * If the DNS resolution fails, @error (if non-%NULL) will be set to
795 * a value from #GResolverError.
797 * If @cancellable is non-%NULL, it can be used to cancel the
798 * operation, in which case @error (if non-%NULL) will be set to
799 * %G_IO_ERROR_CANCELLED.
801 * Return value: (element-type GVariant) (transfer full): a #GList of #GVariant,
802 * or %NULL on error. You must free each of the records and the list when you are
803 * done with it. (You can use g_list_free_full() with g_variant_unref() to do this.)
808 g_resolver_lookup_records (GResolver *resolver,
810 GResolverRecordType record_type,
811 GCancellable *cancellable,
816 g_return_val_if_fail (G_IS_RESOLVER (resolver), NULL);
817 g_return_val_if_fail (rrname != NULL, NULL);
819 g_resolver_maybe_reload (resolver);
820 records = G_RESOLVER_GET_CLASS (resolver)->
821 lookup_records (resolver, rrname, record_type, cancellable, error);
827 * g_resolver_lookup_records_async:
828 * @resolver: a #GResolver
829 * @rrname: the DNS name to lookup the record for
830 * @record_type: the type of DNS record to lookup
831 * @cancellable: (allow-none): a #GCancellable, or %NULL
832 * @callback: (scope async): callback to call after resolution completes
833 * @user_data: (closure): data for @callback
835 * Begins asynchronously performing a DNS lookup for the given
836 * @rrname, and eventually calls @callback, which must call
837 * g_resolver_lookup_records_finish() to get the final result. See
838 * g_resolver_lookup_records() for more details.
843 g_resolver_lookup_records_async (GResolver *resolver,
845 GResolverRecordType record_type,
846 GCancellable *cancellable,
847 GAsyncReadyCallback callback,
850 g_return_if_fail (G_IS_RESOLVER (resolver));
851 g_return_if_fail (rrname != NULL);
853 g_resolver_maybe_reload (resolver);
854 G_RESOLVER_GET_CLASS (resolver)->
855 lookup_records_async (resolver, rrname, record_type, cancellable, callback, user_data);
859 * g_resolver_lookup_records_finish:
860 * @resolver: a #GResolver
861 * @result: the result passed to your #GAsyncReadyCallback
862 * @error: return location for a #GError, or %NULL
864 * Retrieves the result of a previous call to
865 * g_resolver_lookup_records_async(). Returns a list of records as #GVariant
866 * tuples. See #GResolverRecordType for information on what the records contain.
868 * If the DNS resolution failed, @error (if non-%NULL) will be set to
869 * a value from #GResolverError. If the operation was cancelled,
870 * @error will be set to %G_IO_ERROR_CANCELLED.
872 * Return value: (element-type GVariant) (transfer full): a #GList of #GVariant,
873 * or %NULL on error. You must free each of the records and the list when you are
874 * done with it. (You can use g_list_free_full() with g_variant_unref() to do this.)
879 g_resolver_lookup_records_finish (GResolver *resolver,
880 GAsyncResult *result,
883 g_return_val_if_fail (G_IS_RESOLVER (resolver), NULL);
884 return G_RESOLVER_GET_CLASS (resolver)->
885 lookup_records_finish (resolver, result, error);
889 g_resolver_get_serial (GResolver *resolver)
891 g_return_val_if_fail (G_IS_RESOLVER (resolver), 0);
893 g_resolver_maybe_reload (resolver);
896 return (guint64) resolver->priv->resolv_conf_timestamp;
903 * g_resolver_error_quark:
905 * Gets the #GResolver Error Quark.
907 * Return value: a #GQuark.
911 G_DEFINE_QUARK (g-resolver-error-quark, g_resolver_error)