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
);
237 g_resolver_maybe_reload (GResolver
*resolver
)
242 if (stat (_PATH_RESCONF
, &st
) == 0)
244 if (st
.st_mtime
!= resolver
->priv
->resolv_conf_timestamp
)
246 resolver
->priv
->resolv_conf_timestamp
= st
.st_mtime
;
248 g_signal_emit (resolver
, signals
[RELOAD
], 0);
254 /* filter out duplicates, cf. https://bugzilla.gnome.org/show_bug.cgi?id=631379 */
256 remove_duplicates (GList
*addrs
)
262 /* TODO: if this is too slow (it's O(n^2) but n is typically really
263 * small), we can do something more clever but note that we must not
264 * change the order of elements...
266 for (l
= addrs
; l
!= NULL
; l
= l
->next
)
268 GInetAddress
*address
= G_INET_ADDRESS (l
->data
);
269 for (ll
= l
->next
; ll
!= NULL
; ll
= lll
)
271 GInetAddress
*other_address
= G_INET_ADDRESS (ll
->data
);
273 if (g_inet_address_equal (address
, other_address
))
275 g_object_unref (other_address
);
276 /* we never return the first element */
277 g_warn_if_fail (g_list_delete_link (addrs
, ll
) == addrs
);
285 * g_resolver_lookup_by_name:
286 * @resolver: a #GResolver
287 * @hostname: the hostname to look up
288 * @cancellable: (allow-none): a #GCancellable, or %NULL
289 * @error: return location for a #GError, or %NULL
291 * Synchronously resolves @hostname to determine its associated IP
292 * address(es). @hostname may be an ASCII-only or UTF-8 hostname, or
293 * the textual form of an IP address (in which case this just becomes
294 * a wrapper around g_inet_address_new_from_string()).
296 * On success, g_resolver_lookup_by_name() will return a #GList of
297 * #GInetAddress, sorted in order of preference and guaranteed to not
298 * contain duplicates. That is, if using the result to connect to
299 * @hostname, you should attempt to connect to the first address
300 * first, then the second if the first fails, etc. If you are using
301 * the result to listen on a socket, it is appropriate to add each
302 * result using e.g. g_socket_listener_add_address().
304 * If the DNS resolution fails, @error (if non-%NULL) will be set to a
305 * value from #GResolverError.
307 * If @cancellable is non-%NULL, it can be used to cancel the
308 * operation, in which case @error (if non-%NULL) will be set to
309 * %G_IO_ERROR_CANCELLED.
311 * If you are planning to connect to a socket on the resolved IP
312 * address, it may be easier to create a #GNetworkAddress and use its
313 * #GSocketConnectable interface.
315 * Return value: (element-type GInetAddress) (transfer full): a #GList
316 * of #GInetAddress, or %NULL on error. You
317 * must unref each of the addresses and free the list when you are
318 * done with it. (You can use g_resolver_free_addresses() to do this.)
323 g_resolver_lookup_by_name (GResolver
*resolver
,
324 const gchar
*hostname
,
325 GCancellable
*cancellable
,
330 gchar
*ascii_hostname
= NULL
;
332 g_return_val_if_fail (G_IS_RESOLVER (resolver
), NULL
);
333 g_return_val_if_fail (hostname
!= NULL
, NULL
);
335 /* Check if @hostname is just an IP address */
336 addr
= g_inet_address_new_from_string (hostname
);
338 return g_list_append (NULL
, addr
);
340 if (g_hostname_is_non_ascii (hostname
))
341 hostname
= ascii_hostname
= g_hostname_to_ascii (hostname
);
343 g_resolver_maybe_reload (resolver
);
344 addrs
= G_RESOLVER_GET_CLASS (resolver
)->
345 lookup_by_name (resolver
, hostname
, cancellable
, error
);
347 remove_duplicates (addrs
);
349 g_free (ascii_hostname
);
354 * g_resolver_lookup_by_name_async:
355 * @resolver: a #GResolver
356 * @hostname: the hostname to look up the address of
357 * @cancellable: (allow-none): a #GCancellable, or %NULL
358 * @callback: (scope async): callback to call after resolution completes
359 * @user_data: (closure): data for @callback
361 * Begins asynchronously resolving @hostname to determine its
362 * associated IP address(es), and eventually calls @callback, which
363 * must call g_resolver_lookup_by_name_finish() to get the result.
364 * See g_resolver_lookup_by_name() for more details.
369 g_resolver_lookup_by_name_async (GResolver
*resolver
,
370 const gchar
*hostname
,
371 GCancellable
*cancellable
,
372 GAsyncReadyCallback callback
,
376 gchar
*ascii_hostname
= NULL
;
378 g_return_if_fail (G_IS_RESOLVER (resolver
));
379 g_return_if_fail (hostname
!= NULL
);
381 /* Check if @hostname is just an IP address */
382 addr
= g_inet_address_new_from_string (hostname
);
387 task
= g_task_new (resolver
, cancellable
, callback
, user_data
);
388 g_task_set_source_tag (task
, g_resolver_lookup_by_name_async
);
389 g_task_return_pointer (task
, g_list_append (NULL
, addr
),
390 (GDestroyNotify
) g_resolver_free_addresses
);
391 g_object_unref (task
);
395 if (g_hostname_is_non_ascii (hostname
))
396 hostname
= ascii_hostname
= g_hostname_to_ascii (hostname
);
398 g_resolver_maybe_reload (resolver
);
399 G_RESOLVER_GET_CLASS (resolver
)->
400 lookup_by_name_async (resolver
, hostname
, cancellable
, callback
, user_data
);
402 g_free (ascii_hostname
);
406 * g_resolver_lookup_by_name_finish:
407 * @resolver: a #GResolver
408 * @result: the result passed to your #GAsyncReadyCallback
409 * @error: return location for a #GError, or %NULL
411 * Retrieves the result of a call to
412 * g_resolver_lookup_by_name_async().
414 * If the DNS resolution failed, @error (if non-%NULL) will be set to
415 * a value from #GResolverError. If the operation was cancelled,
416 * @error will be set to %G_IO_ERROR_CANCELLED.
418 * Return value: (element-type GInetAddress) (transfer full): a #GList
419 * of #GInetAddress, or %NULL on error. See g_resolver_lookup_by_name()
425 g_resolver_lookup_by_name_finish (GResolver
*resolver
,
426 GAsyncResult
*result
,
431 g_return_val_if_fail (G_IS_RESOLVER (resolver
), NULL
);
433 if (g_async_result_legacy_propagate_error (result
, error
))
435 else if (g_async_result_is_tagged (result
, g_resolver_lookup_by_name_async
))
437 /* Handle the stringified-IP-addr case */
438 return g_task_propagate_pointer (G_TASK (result
), error
);
441 addrs
= G_RESOLVER_GET_CLASS (resolver
)->
442 lookup_by_name_finish (resolver
, result
, error
);
444 remove_duplicates (addrs
);
450 * g_resolver_free_addresses: (skip)
451 * @addresses: a #GList of #GInetAddress
453 * Frees @addresses (which should be the return value from
454 * g_resolver_lookup_by_name() or g_resolver_lookup_by_name_finish()).
455 * (This is a convenience method; you can also simply free the results
461 g_resolver_free_addresses (GList
*addresses
)
465 for (a
= addresses
; a
; a
= a
->next
)
466 g_object_unref (a
->data
);
467 g_list_free (addresses
);
471 * g_resolver_lookup_by_address:
472 * @resolver: a #GResolver
473 * @address: the address to reverse-resolve
474 * @cancellable: (allow-none): a #GCancellable, or %NULL
475 * @error: return location for a #GError, or %NULL
477 * Synchronously reverse-resolves @address to determine its
478 * associated hostname.
480 * If the DNS resolution fails, @error (if non-%NULL) will be set to
481 * a value from #GResolverError.
483 * If @cancellable is non-%NULL, it can be used to cancel the
484 * operation, in which case @error (if non-%NULL) will be set to
485 * %G_IO_ERROR_CANCELLED.
487 * Return value: a hostname (either ASCII-only, or in ASCII-encoded
488 * form), or %NULL on error.
493 g_resolver_lookup_by_address (GResolver
*resolver
,
494 GInetAddress
*address
,
495 GCancellable
*cancellable
,
498 g_return_val_if_fail (G_IS_RESOLVER (resolver
), NULL
);
499 g_return_val_if_fail (G_IS_INET_ADDRESS (address
), NULL
);
501 g_resolver_maybe_reload (resolver
);
502 return G_RESOLVER_GET_CLASS (resolver
)->
503 lookup_by_address (resolver
, address
, cancellable
, error
);
507 * g_resolver_lookup_by_address_async:
508 * @resolver: a #GResolver
509 * @address: the address to reverse-resolve
510 * @cancellable: (allow-none): a #GCancellable, or %NULL
511 * @callback: (scope async): callback to call after resolution completes
512 * @user_data: (closure): data for @callback
514 * Begins asynchronously reverse-resolving @address to determine its
515 * associated hostname, and eventually calls @callback, which must
516 * call g_resolver_lookup_by_address_finish() to get the final result.
521 g_resolver_lookup_by_address_async (GResolver
*resolver
,
522 GInetAddress
*address
,
523 GCancellable
*cancellable
,
524 GAsyncReadyCallback callback
,
527 g_return_if_fail (G_IS_RESOLVER (resolver
));
528 g_return_if_fail (G_IS_INET_ADDRESS (address
));
530 g_resolver_maybe_reload (resolver
);
531 G_RESOLVER_GET_CLASS (resolver
)->
532 lookup_by_address_async (resolver
, address
, cancellable
, callback
, user_data
);
536 * g_resolver_lookup_by_address_finish:
537 * @resolver: a #GResolver
538 * @result: the result passed to your #GAsyncReadyCallback
539 * @error: return location for a #GError, or %NULL
541 * Retrieves the result of a previous call to
542 * g_resolver_lookup_by_address_async().
544 * If the DNS resolution failed, @error (if non-%NULL) will be set to
545 * a value from #GResolverError. If the operation was cancelled,
546 * @error will be set to %G_IO_ERROR_CANCELLED.
548 * Return value: a hostname (either ASCII-only, or in ASCII-encoded
549 * form), or %NULL on error.
554 g_resolver_lookup_by_address_finish (GResolver
*resolver
,
555 GAsyncResult
*result
,
558 g_return_val_if_fail (G_IS_RESOLVER (resolver
), NULL
);
560 if (g_async_result_legacy_propagate_error (result
, error
))
563 return G_RESOLVER_GET_CLASS (resolver
)->
564 lookup_by_address_finish (resolver
, result
, error
);
568 g_resolver_get_service_rrname (const char *service
,
569 const char *protocol
,
572 gchar
*rrname
, *ascii_domain
= NULL
;
574 if (g_hostname_is_non_ascii (domain
))
575 domain
= ascii_domain
= g_hostname_to_ascii (domain
);
577 rrname
= g_strdup_printf ("_%s._%s.%s", service
, protocol
, domain
);
579 g_free (ascii_domain
);
584 * g_resolver_lookup_service:
585 * @resolver: a #GResolver
586 * @service: the service type to look up (eg, "ldap")
587 * @protocol: the networking protocol to use for @service (eg, "tcp")
588 * @domain: the DNS domain to look up the service in
589 * @cancellable: (allow-none): a #GCancellable, or %NULL
590 * @error: return location for a #GError, or %NULL
592 * Synchronously performs a DNS SRV lookup for the given @service and
593 * @protocol in the given @domain and returns an array of #GSrvTarget.
594 * @domain may be an ASCII-only or UTF-8 hostname. Note also that the
595 * @service and @protocol arguments <emphasis>do not</emphasis>
596 * include the leading underscore that appears in the actual DNS
599 * On success, g_resolver_lookup_service() will return a #GList of
600 * #GSrvTarget, sorted in order of preference. (That is, you should
601 * attempt to connect to the first target first, then the second if
602 * the first fails, etc.)
604 * If the DNS resolution fails, @error (if non-%NULL) will be set to
605 * a value from #GResolverError.
607 * If @cancellable is non-%NULL, it can be used to cancel the
608 * operation, in which case @error (if non-%NULL) will be set to
609 * %G_IO_ERROR_CANCELLED.
611 * If you are planning to connect to the service, it is usually easier
612 * to create a #GNetworkService and use its #GSocketConnectable
615 * Return value: (element-type GSrvTarget) (transfer full): a #GList of #GSrvTarget,
616 * or %NULL on error. You must free each of the targets and the list when you are
617 * done with it. (You can use g_resolver_free_targets() to do this.)
622 g_resolver_lookup_service (GResolver
*resolver
,
623 const gchar
*service
,
624 const gchar
*protocol
,
626 GCancellable
*cancellable
,
632 g_return_val_if_fail (G_IS_RESOLVER (resolver
), NULL
);
633 g_return_val_if_fail (service
!= NULL
, NULL
);
634 g_return_val_if_fail (protocol
!= NULL
, NULL
);
635 g_return_val_if_fail (domain
!= NULL
, NULL
);
637 rrname
= g_resolver_get_service_rrname (service
, protocol
, domain
);
639 g_resolver_maybe_reload (resolver
);
640 targets
= G_RESOLVER_GET_CLASS (resolver
)->
641 lookup_service (resolver
, rrname
, cancellable
, error
);
648 * g_resolver_lookup_service_async:
649 * @resolver: a #GResolver
650 * @service: the service type to look up (eg, "ldap")
651 * @protocol: the networking protocol to use for @service (eg, "tcp")
652 * @domain: the DNS domain to look up the service in
653 * @cancellable: (allow-none): a #GCancellable, or %NULL
654 * @callback: (scope async): callback to call after resolution completes
655 * @user_data: (closure): data for @callback
657 * Begins asynchronously performing a DNS SRV lookup for the given
658 * @service and @protocol in the given @domain, and eventually calls
659 * @callback, which must call g_resolver_lookup_service_finish() to
660 * get the final result. See g_resolver_lookup_service() for more
666 g_resolver_lookup_service_async (GResolver
*resolver
,
667 const gchar
*service
,
668 const gchar
*protocol
,
670 GCancellable
*cancellable
,
671 GAsyncReadyCallback callback
,
676 g_return_if_fail (G_IS_RESOLVER (resolver
));
677 g_return_if_fail (service
!= NULL
);
678 g_return_if_fail (protocol
!= NULL
);
679 g_return_if_fail (domain
!= NULL
);
681 rrname
= g_resolver_get_service_rrname (service
, protocol
, domain
);
683 g_resolver_maybe_reload (resolver
);
684 G_RESOLVER_GET_CLASS (resolver
)->
685 lookup_service_async (resolver
, rrname
, cancellable
, callback
, user_data
);
691 * g_resolver_lookup_service_finish:
692 * @resolver: a #GResolver
693 * @result: the result passed to your #GAsyncReadyCallback
694 * @error: return location for a #GError, or %NULL
696 * Retrieves the result of a previous call to
697 * g_resolver_lookup_service_async().
699 * If the DNS resolution failed, @error (if non-%NULL) will be set to
700 * a value from #GResolverError. If the operation was cancelled,
701 * @error will be set to %G_IO_ERROR_CANCELLED.
703 * Return value: (element-type GSrvTarget) (transfer full): a #GList of #GSrvTarget,
704 * or %NULL on error. See g_resolver_lookup_service() for more details.
709 g_resolver_lookup_service_finish (GResolver
*resolver
,
710 GAsyncResult
*result
,
713 g_return_val_if_fail (G_IS_RESOLVER (resolver
), NULL
);
715 if (g_async_result_legacy_propagate_error (result
, error
))
718 return G_RESOLVER_GET_CLASS (resolver
)->
719 lookup_service_finish (resolver
, result
, error
);
723 * g_resolver_free_targets: (skip)
724 * @targets: a #GList of #GSrvTarget
726 * Frees @targets (which should be the return value from
727 * g_resolver_lookup_service() or g_resolver_lookup_service_finish()).
728 * (This is a convenience method; you can also simply free the
734 g_resolver_free_targets (GList
*targets
)
738 for (t
= targets
; t
; t
= t
->next
)
739 g_srv_target_free (t
->data
);
740 g_list_free (targets
);
744 * g_resolver_lookup_records:
745 * @resolver: a #GResolver
746 * @rrname: the DNS name to lookup the record for
747 * @record_type: the type of DNS record to lookup
748 * @cancellable: (allow-none): a #GCancellable, or %NULL
749 * @error: return location for a #GError, or %NULL
751 * Synchronously performs a DNS record lookup for the given @rrname and returns
752 * a list of records as #GVariant tuples. See #GResolverRecordType for
753 * information on what the records contain for each @record_type.
755 * If the DNS resolution fails, @error (if non-%NULL) will be set to
756 * a value from #GResolverError.
758 * If @cancellable is non-%NULL, it can be used to cancel the
759 * operation, in which case @error (if non-%NULL) will be set to
760 * %G_IO_ERROR_CANCELLED.
762 * Return value: (element-type GVariant) (transfer full): a #GList of #GVariant,
763 * or %NULL on error. You must free each of the records and the list when you are
764 * done with it. (You can use g_list_free_full() with g_variant_unref() to do this.)
769 g_resolver_lookup_records (GResolver
*resolver
,
771 GResolverRecordType record_type
,
772 GCancellable
*cancellable
,
777 g_return_val_if_fail (G_IS_RESOLVER (resolver
), NULL
);
778 g_return_val_if_fail (rrname
!= NULL
, NULL
);
780 g_resolver_maybe_reload (resolver
);
781 records
= G_RESOLVER_GET_CLASS (resolver
)->
782 lookup_records (resolver
, rrname
, record_type
, cancellable
, error
);
788 * g_resolver_lookup_records_async:
789 * @resolver: a #GResolver
790 * @rrname: the DNS name to lookup the record for
791 * @record_type: the type of DNS record to lookup
792 * @cancellable: (allow-none): a #GCancellable, or %NULL
793 * @callback: (scope async): callback to call after resolution completes
794 * @user_data: (closure): data for @callback
796 * Begins asynchronously performing a DNS lookup for the given
797 * @rrname, and eventually calls @callback, which must call
798 * g_resolver_lookup_records_finish() to get the final result. See
799 * g_resolver_lookup_records() for more details.
804 g_resolver_lookup_records_async (GResolver
*resolver
,
806 GResolverRecordType record_type
,
807 GCancellable
*cancellable
,
808 GAsyncReadyCallback callback
,
811 g_return_if_fail (G_IS_RESOLVER (resolver
));
812 g_return_if_fail (rrname
!= NULL
);
814 g_resolver_maybe_reload (resolver
);
815 G_RESOLVER_GET_CLASS (resolver
)->
816 lookup_records_async (resolver
, rrname
, record_type
, cancellable
, callback
, user_data
);
820 * g_resolver_lookup_records_finish:
821 * @resolver: a #GResolver
822 * @result: the result passed to your #GAsyncReadyCallback
823 * @error: return location for a #GError, or %NULL
825 * Retrieves the result of a previous call to
826 * g_resolver_lookup_records_async(). Returns a list of records as #GVariant
827 * tuples. See #GResolverRecordType for information on what the records contain.
829 * If the DNS resolution failed, @error (if non-%NULL) will be set to
830 * a value from #GResolverError. If the operation was cancelled,
831 * @error will be set to %G_IO_ERROR_CANCELLED.
833 * Return value: (element-type GVariant) (transfer full): a #GList of #GVariant,
834 * or %NULL on error. You must free each of the records and the list when you are
835 * done with it. (You can use g_list_free_full() with g_variant_unref() to do this.)
840 g_resolver_lookup_records_finish (GResolver
*resolver
,
841 GAsyncResult
*result
,
844 g_return_val_if_fail (G_IS_RESOLVER (resolver
), NULL
);
845 return G_RESOLVER_GET_CLASS (resolver
)->
846 lookup_records_finish (resolver
, result
, error
);
850 * g_resolver_error_quark:
852 * Gets the #GResolver Error Quark.
854 * Return value: a #GQuark.
858 G_DEFINE_QUARK (g
-resolver
-error
-quark
, g_resolver_error
)