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 "ginetsocketaddress.h"
32 #include "gsimpleasyncresult.h"
33 #include "gsrvtarget.h"
36 #include "gunixresolver.h"
40 #include "gwin32resolver.h"
49 * @short_description: Asynchronous and cancellable DNS resolver
52 * #GResolver provides cancellable synchronous and asynchronous DNS
53 * resolution, for hostnames (g_resolver_lookup_by_address(),
54 * g_resolver_lookup_by_name() and their async variants) and SRV
55 * (service) records (g_resolver_lookup_service()).
57 * #GNetworkAddress and #GNetworkService provide wrappers around
58 * #GResolver functionality that also implement #GSocketConnectable,
59 * making it easy to connect to a remote host/service.
67 static guint signals[LAST_SIGNAL] = { 0 };
69 struct _GResolverPrivate {
71 time_t resolv_conf_timestamp;
80 * The object that handles DNS resolution. Use g_resolver_get_default()
81 * to get the default resolver.
83 G_DEFINE_TYPE (GResolver, g_resolver, G_TYPE_OBJECT)
86 g_resolver_class_init (GResolverClass *resolver_class)
90 g_type_class_add_private (resolver_class, sizeof (GResolverPrivate));
92 /* Make sure _g_networking_init() has been called */
93 type = g_inet_address_get_type ();
95 /* Initialize _g_resolver_addrinfo_hints */
97 _g_resolver_addrinfo_hints.ai_flags |= AI_ADDRCONFIG;
99 /* These two don't actually matter, they just get copied into the
100 * returned addrinfo structures (and then we ignore them). But if
101 * we leave them unset, we'll get back duplicate answers.
103 _g_resolver_addrinfo_hints.ai_socktype = SOCK_STREAM;
104 _g_resolver_addrinfo_hints.ai_protocol = IPPROTO_TCP;
108 * @resolver: a #GResolver
110 * Emitted when the resolver notices that the system resolver
111 * configuration has changed.
114 g_signal_new (I_("reload"),
117 G_STRUCT_OFFSET (GResolverClass, reload),
119 g_cclosure_marshal_VOID__VOID,
124 g_resolver_init (GResolver *resolver)
130 resolver->priv = G_TYPE_INSTANCE_GET_PRIVATE (resolver, G_TYPE_RESOLVER, GResolverPrivate);
133 if (stat (_PATH_RESCONF, &st) == 0)
134 resolver->priv->resolv_conf_timestamp = st.st_mtime;
138 static GResolver *default_resolver;
141 * g_resolver_get_default:
143 * Gets the default #GResolver. You should unref it when you are done
144 * with it. #GResolver may use its reference count as a hint about how
145 * many threads/processes, etc it should allocate for concurrent DNS
148 * Return value: the default #GResolver.
153 g_resolver_get_default (void)
155 if (!default_resolver)
157 if (g_thread_supported ())
158 default_resolver = g_object_new (G_TYPE_THREADED_RESOLVER, NULL);
161 #if defined(G_OS_UNIX)
162 default_resolver = g_object_new (G_TYPE_UNIX_RESOLVER, NULL);
163 #elif defined(G_OS_WIN32)
164 default_resolver = g_object_new (G_TYPE_WIN32_RESOLVER, NULL);
169 return g_object_ref (default_resolver);
173 * g_resolver_set_default:
174 * @resolver: the new default #GResolver
176 * Sets @resolver to be the application's default resolver (reffing
177 * @resolver, and unreffing the previous default resolver, if any).
178 * Future calls to g_resolver_get_default() will return this resolver.
180 * This can be used if an application wants to perform any sort of DNS
181 * caching or "pinning"; it can implement its own #GResolver that
182 * calls the original default resolver for DNS operations, and
183 * implements its own cache policies on top of that, and then set
184 * itself as the default resolver for all later code to use.
189 g_resolver_set_default (GResolver *resolver)
191 if (default_resolver)
192 g_object_unref (default_resolver);
193 default_resolver = g_object_ref (resolver);
198 g_resolver_maybe_reload (GResolver *resolver)
203 if (stat (_PATH_RESCONF, &st) == 0)
205 if (st.st_mtime != resolver->priv->resolv_conf_timestamp)
207 resolver->priv->resolv_conf_timestamp = st.st_mtime;
209 g_signal_emit (resolver, signals[RELOAD], 0);
216 * g_resolver_lookup_by_name:
217 * @resolver: a #GResolver
218 * @hostname: the hostname to look up
219 * @cancellable: a #GCancellable, or %NULL
220 * @error: return location for a #GError, or %NULL
222 * Synchronously resolves @hostname to determine its associated IP
223 * address(es). @hostname may be an ASCII-only or UTF-8 hostname, or
224 * the textual form of an IP address (in which case this just becomes
225 * a wrapper around g_inet_address_new_from_string()).
227 * On success, g_resolver_lookup_by_name() will return a #GList of
228 * #GInetAddress, sorted in order of preference. (That is, you should
229 * attempt to connect to the first address first, then the second if
230 * the first fails, etc.)
232 * If the DNS resolution fails, @error (if non-%NULL) will be set to a
233 * value from #GResolverError.
235 * If @cancellable is non-%NULL, it can be used to cancel the
236 * operation, in which case @error (if non-%NULL) will be set to
237 * %G_IO_ERROR_CANCELLED.
239 * If you are planning to connect to a socket on the resolved IP
240 * address, it may be easier to create a #GNetworkAddress and use its
241 * #GSocketConnectable interface.
243 * Return value: a #GList of #GInetAddress, or %NULL on error. You
244 * must unref each of the addresses and free the list when you are
245 * done with it. (You can use g_resolver_free_addresses() to do this.)
250 g_resolver_lookup_by_name (GResolver *resolver,
251 const gchar *hostname,
252 GCancellable *cancellable,
257 gchar *ascii_hostname = NULL;
259 g_return_val_if_fail (G_IS_RESOLVER (resolver), NULL);
260 g_return_val_if_fail (hostname != NULL, NULL);
262 /* Check if @hostname is just an IP address */
263 addr = g_inet_address_new_from_string (hostname);
265 return g_list_append (NULL, addr);
267 if (g_hostname_is_non_ascii (hostname))
268 hostname = ascii_hostname = g_hostname_to_ascii (hostname);
270 g_resolver_maybe_reload (resolver);
271 addrs = G_RESOLVER_GET_CLASS (resolver)->
272 lookup_by_name (resolver, hostname, cancellable, error);
274 g_free (ascii_hostname);
279 * g_resolver_lookup_by_name_async:
280 * @resolver: a #GResolver
281 * @hostname: the hostname to look up the address of
282 * @cancellable: a #GCancellable, or %NULL
283 * @callback: callback to call after resolution completes
284 * @user_data: data for @callback
286 * Begins asynchronously resolving @hostname to determine its
287 * associated IP address(es), and eventually calls @callback, which
288 * must call g_resolver_lookup_by_name_finish() to get the result.
289 * See g_resolver_lookup_by_name() for more details.
294 g_resolver_lookup_by_name_async (GResolver *resolver,
295 const gchar *hostname,
296 GCancellable *cancellable,
297 GAsyncReadyCallback callback,
301 gchar *ascii_hostname = NULL;
303 g_return_if_fail (G_IS_RESOLVER (resolver));
304 g_return_if_fail (hostname != NULL);
306 /* Check if @hostname is just an IP address */
307 addr = g_inet_address_new_from_string (hostname);
310 GSimpleAsyncResult *simple;
312 simple = g_simple_async_result_new (G_OBJECT (resolver),
314 g_resolver_lookup_by_name_async);
316 g_simple_async_result_set_op_res_gpointer (simple, addr, g_object_unref);
317 g_simple_async_result_complete_in_idle (simple);
318 g_object_unref (simple);
322 if (g_hostname_is_non_ascii (hostname))
323 hostname = ascii_hostname = g_hostname_to_ascii (hostname);
325 g_resolver_maybe_reload (resolver);
326 G_RESOLVER_GET_CLASS (resolver)->
327 lookup_by_name_async (resolver, hostname, cancellable, callback, user_data);
329 g_free (ascii_hostname);
333 * g_resolver_lookup_by_name_finish:
334 * @resolver: a #GResolver
335 * @result: the result passed to your #GAsyncReadyCallback
336 * @error: return location for a #GError, or %NULL
338 * Retrieves the result of a call to
339 * g_resolver_lookup_by_name_async().
341 * If the DNS resolution failed, @error (if non-%NULL) will be set to
342 * a value from #GResolverError. If the operation was cancelled,
343 * @error will be set to %G_IO_ERROR_CANCELLED.
345 * Return value: a #GList of #GInetAddress, or %NULL on error. See
346 * g_resolver_lookup_by_name() for more details.
351 g_resolver_lookup_by_name_finish (GResolver *resolver,
352 GAsyncResult *result,
355 g_return_val_if_fail (G_IS_RESOLVER (resolver), NULL);
357 if (G_IS_SIMPLE_ASYNC_RESULT (result))
359 GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result);
361 if (g_simple_async_result_propagate_error (simple, error))
364 /* Handle the stringified-IP-addr case */
365 if (g_simple_async_result_get_source_tag (simple) == g_resolver_lookup_by_name_async)
369 addr = g_simple_async_result_get_op_res_gpointer (simple);
370 return g_list_append (NULL, g_object_ref (addr));
374 return G_RESOLVER_GET_CLASS (resolver)->
375 lookup_by_name_finish (resolver, result, error);
379 * g_resolver_free_addresses:
380 * @addresses: a #GList of #GInetAddress
382 * Frees @addresses (which should be the return value from
383 * g_resolver_lookup_by_name() or g_resolver_lookup_by_name_finish()).
384 * (This is a convenience method; you can also simply free the results
390 g_resolver_free_addresses (GList *addresses)
394 for (a = addresses; a; a = a->next)
395 g_object_unref (a->data);
396 g_list_free (addresses);
400 * g_resolver_lookup_by_address:
401 * @resolver: a #GResolver
402 * @address: the address to reverse-resolve
403 * @cancellable: a #GCancellable, or %NULL
404 * @error: return location for a #GError, or %NULL
406 * Synchronously reverse-resolves @address to determine its
407 * associated hostname.
409 * If the DNS resolution fails, @error (if non-%NULL) will be set to
410 * a value from #GResolverError.
412 * If @cancellable is non-%NULL, it can be used to cancel the
413 * operation, in which case @error (if non-%NULL) will be set to
414 * %G_IO_ERROR_CANCELLED.
416 * Return value: a hostname (either ASCII-only, or in ASCII-encoded
417 * form), or %NULL on error.
422 g_resolver_lookup_by_address (GResolver *resolver,
423 GInetAddress *address,
424 GCancellable *cancellable,
427 g_return_val_if_fail (G_IS_RESOLVER (resolver), NULL);
428 g_return_val_if_fail (G_IS_INET_ADDRESS (address), NULL);
430 g_resolver_maybe_reload (resolver);
431 return G_RESOLVER_GET_CLASS (resolver)->
432 lookup_by_address (resolver, address, cancellable, error);
436 * g_resolver_lookup_by_address_async:
437 * @resolver: a #GResolver
438 * @address: the address to reverse-resolve
439 * @cancellable: a #GCancellable, or %NULL
440 * @callback: callback to call after resolution completes
441 * @user_data: data for @callback
443 * Begins asynchronously reverse-resolving @address to determine its
444 * associated hostname, and eventually calls @callback, which must
445 * call g_resolver_lookup_by_address_finish() to get the final result.
450 g_resolver_lookup_by_address_async (GResolver *resolver,
451 GInetAddress *address,
452 GCancellable *cancellable,
453 GAsyncReadyCallback callback,
456 g_return_if_fail (G_IS_RESOLVER (resolver));
457 g_return_if_fail (G_IS_INET_ADDRESS (address));
459 g_resolver_maybe_reload (resolver);
460 G_RESOLVER_GET_CLASS (resolver)->
461 lookup_by_address_async (resolver, address, cancellable, callback, user_data);
465 * g_resolver_lookup_by_address_finish:
466 * @resolver: a #GResolver
467 * @result: the result passed to your #GAsyncReadyCallback
468 * @error: return location for a #GError, or %NULL
470 * Retrieves the result of a previous call to
471 * g_resolver_lookup_by_address_async().
473 * If the DNS resolution failed, @error (if non-%NULL) will be set to
474 * a value from #GResolverError. If the operation was cancelled,
475 * @error will be set to %G_IO_ERROR_CANCELLED.
477 * Return value: a hostname (either ASCII-only, or in ASCII-encoded
478 * form), or %NULL on error.
483 g_resolver_lookup_by_address_finish (GResolver *resolver,
484 GAsyncResult *result,
487 g_return_val_if_fail (G_IS_RESOLVER (resolver), NULL);
489 if (G_IS_SIMPLE_ASYNC_RESULT (result))
491 GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result);
493 if (g_simple_async_result_propagate_error (simple, error))
497 return G_RESOLVER_GET_CLASS (resolver)->
498 lookup_by_address_finish (resolver, result, error);
502 g_resolver_get_service_rrname (const char *service,
503 const char *protocol,
506 gchar *rrname, *ascii_domain = NULL;
508 if (g_hostname_is_non_ascii (domain))
509 domain = ascii_domain = g_hostname_to_ascii (domain);
511 rrname = g_strdup_printf ("_%s._%s.%s", service, protocol, domain);
513 g_free (ascii_domain);
518 * g_resolver_lookup_service:
519 * @resolver: a #GResolver
520 * @service: the service type to look up (eg, "ldap")
521 * @protocol: the networking protocol to use for @service (eg, "tcp")
522 * @domain: the DNS domain to look up the service in
523 * @cancellable: a #GCancellable, or %NULL
524 * @error: return location for a #GError, or %NULL
526 * Synchronously performs a DNS SRV lookup for the given @service and
527 * @protocol in the given @domain and returns an array of #GSrvTarget.
528 * @domain may be an ASCII-only or UTF-8 hostname. Note also that the
529 * @service and @protocol arguments <emphasis>do not</emphasis>
530 * include the leading underscore that appears in the actual DNS
533 * On success, g_resolver_lookup_service() will return a #GList of
534 * #GSrvTarget, sorted in order of preference. (That is, you should
535 * attempt to connect to the first target first, then the second if
536 * the first fails, etc.)
538 * If the DNS resolution fails, @error (if non-%NULL) will be set to
539 * a value from #GResolverError.
541 * If @cancellable is non-%NULL, it can be used to cancel the
542 * operation, in which case @error (if non-%NULL) will be set to
543 * %G_IO_ERROR_CANCELLED.
545 * If you are planning to connect to the service, it is usually easier
546 * to create a #GNetworkService and use its #GSocketConnectable
549 * Return value: a #GList of #GSrvTarget, or %NULL on error. You must
550 * free each of the targets and the list when you are done with it.
551 * (You can use g_resolver_free_targets() to do this.)
556 g_resolver_lookup_service (GResolver *resolver,
557 const gchar *service,
558 const gchar *protocol,
560 GCancellable *cancellable,
566 g_return_val_if_fail (G_IS_RESOLVER (resolver), NULL);
567 g_return_val_if_fail (service != NULL, NULL);
568 g_return_val_if_fail (protocol != NULL, NULL);
569 g_return_val_if_fail (domain != NULL, NULL);
571 rrname = g_resolver_get_service_rrname (service, protocol, domain);
573 g_resolver_maybe_reload (resolver);
574 targets = G_RESOLVER_GET_CLASS (resolver)->
575 lookup_service (resolver, rrname, cancellable, error);
582 * g_resolver_lookup_service_async:
583 * @resolver: a #GResolver
584 * @service: the service type to look up (eg, "ldap")
585 * @protocol: the networking protocol to use for @service (eg, "tcp")
586 * @domain: the DNS domain to look up the service in
587 * @cancellable: a #GCancellable, or %NULL
588 * @callback: callback to call after resolution completes
589 * @user_data: data for @callback
591 * Begins asynchronously performing a DNS SRV lookup for the given
592 * @service and @protocol in the given @domain, and eventually calls
593 * @callback, which must call g_resolver_lookup_service_finish() to
594 * get the final result. See g_resolver_lookup_service() for more
600 g_resolver_lookup_service_async (GResolver *resolver,
601 const gchar *service,
602 const gchar *protocol,
604 GCancellable *cancellable,
605 GAsyncReadyCallback callback,
610 g_return_if_fail (G_IS_RESOLVER (resolver));
611 g_return_if_fail (service != NULL);
612 g_return_if_fail (protocol != NULL);
613 g_return_if_fail (domain != NULL);
615 rrname = g_resolver_get_service_rrname (service, protocol, domain);
617 g_resolver_maybe_reload (resolver);
618 G_RESOLVER_GET_CLASS (resolver)->
619 lookup_service_async (resolver, rrname, cancellable, callback, user_data);
625 * g_resolver_lookup_service_finish:
626 * @resolver: a #GResolver
627 * @result: the result passed to your #GAsyncReadyCallback
628 * @error: return location for a #GError, or %NULL
630 * Retrieves the result of a previous call to
631 * g_resolver_lookup_service_async().
633 * If the DNS resolution failed, @error (if non-%NULL) will be set to
634 * a value from #GResolverError. If the operation was cancelled,
635 * @error will be set to %G_IO_ERROR_CANCELLED.
637 * Return value: a #GList of #GSrvTarget, or %NULL on error. See
638 * g_resolver_lookup_service() for more details.
643 g_resolver_lookup_service_finish (GResolver *resolver,
644 GAsyncResult *result,
647 g_return_val_if_fail (G_IS_RESOLVER (resolver), NULL);
649 if (G_IS_SIMPLE_ASYNC_RESULT (result))
651 GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result);
653 if (g_simple_async_result_propagate_error (simple, error))
657 return G_RESOLVER_GET_CLASS (resolver)->
658 lookup_service_finish (resolver, result, error);
662 * g_resolver_free_targets:
663 * @targets: a #GList of #GSrvTarget
665 * Frees @targets (which should be the return value from
666 * g_resolver_lookup_service() or g_resolver_lookup_service_finish()).
667 * (This is a convenience method; you can also simply free the
673 g_resolver_free_targets (GList *targets)
677 for (t = targets; t; t = t->next)
678 g_srv_target_free (t->data);
679 g_list_free (targets);
683 * g_resolver_error_quark:
685 * Gets the #GResolver Error Quark.
687 * Return value: a #GQuark.
692 g_resolver_error_quark (void)
694 return g_quark_from_static_string ("g-resolver-error-quark");
698 static GResolverError
699 g_resolver_error_from_addrinfo_error (gint err)
704 #if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME)
708 return G_RESOLVER_ERROR_NOT_FOUND;
711 return G_RESOLVER_ERROR_TEMPORARY_FAILURE;
714 return G_RESOLVER_ERROR_INTERNAL;
718 struct addrinfo _g_resolver_addrinfo_hints;
720 /* Private method to process a getaddrinfo() response. */
722 _g_resolver_addresses_from_addrinfo (const char *hostname,
723 struct addrinfo *res,
728 GSocketAddress *sockaddr;
734 g_set_error (error, G_RESOLVER_ERROR,
735 g_resolver_error_from_addrinfo_error (gai_retval),
736 _("Error resolving '%s': %s"),
737 hostname, gai_strerror (gai_retval));
741 g_return_val_if_fail (res != NULL, NULL);
744 for (ai = res; ai; ai = ai->ai_next)
746 sockaddr = g_socket_address_new_from_native (ai->ai_addr, ai->ai_addrlen);
747 if (!sockaddr || !G_IS_INET_SOCKET_ADDRESS (sockaddr))
750 addr = g_object_ref (g_inet_socket_address_get_address ((GInetSocketAddress *)sockaddr));
751 addrs = g_list_prepend (addrs, addr);
752 g_object_unref (sockaddr);
755 return g_list_reverse (addrs);
758 /* Private method to set up a getnameinfo() request */
760 _g_resolver_address_to_sockaddr (GInetAddress *address,
761 struct sockaddr_storage *sa,
764 GSocketAddress *sockaddr;
766 sockaddr = g_inet_socket_address_new (address, 0);
767 g_socket_address_to_native (sockaddr, (struct sockaddr *)sa, sizeof (*sa), NULL);
768 *len = g_socket_address_get_native_size (sockaddr);
769 g_object_unref (sockaddr);
772 /* Private method to process a getnameinfo() response. */
774 _g_resolver_name_from_nameinfo (GInetAddress *address,
783 phys = g_inet_address_to_string (address);
784 g_set_error (error, G_RESOLVER_ERROR,
785 g_resolver_error_from_addrinfo_error (gni_retval),
786 _("Error reverse-resolving '%s': %s"),
787 phys ? phys : "(unknown)", gai_strerror (gni_retval));
792 return g_strdup (name);
795 #if defined(G_OS_UNIX)
796 /* Private method to process a res_query response into GSrvTargets */
798 _g_resolver_targets_from_res_query (const gchar *rrname,
807 guint16 type, qclass, rdlength, priority, weight, port;
815 GResolverError errnum;
818 if (len == 0 || herr == HOST_NOT_FOUND || herr == NO_DATA)
820 errnum = G_RESOLVER_ERROR_NOT_FOUND;
821 format = _("No service record for '%s'");
823 else if (herr == TRY_AGAIN)
825 errnum = G_RESOLVER_ERROR_TEMPORARY_FAILURE;
826 format = _("Temporarily unable to resolve '%s'");
830 errnum = G_RESOLVER_ERROR_INTERNAL;
831 format = _("Error resolving '%s'");
834 g_set_error (error, G_RESOLVER_ERROR, errnum, format, rrname);
840 header = (HEADER *)answer;
841 p = answer + sizeof (HEADER);
845 count = ntohs (header->qdcount);
846 while (count-- && p < end)
848 p += dn_expand (answer, end, p, namebuf, sizeof (namebuf));
853 count = ntohs (header->ancount);
854 while (count-- && p < end)
856 p += dn_expand (answer, end, p, namebuf, sizeof (namebuf));
858 GETSHORT (qclass, p);
860 GETSHORT (rdlength, p);
862 if (type != T_SRV || qclass != C_IN)
868 GETSHORT (priority, p);
869 GETSHORT (weight, p);
871 p += dn_expand (answer, end, p, namebuf, sizeof (namebuf));
873 target = g_srv_target_new (namebuf, port, priority, weight);
874 targets = g_list_prepend (targets, target);
877 return g_srv_target_list_sort (targets);
879 #elif defined(G_OS_WIN32)
880 /* Private method to process a DnsQuery response into GSrvTargets */
882 _g_resolver_targets_from_DnsQuery (const gchar *rrname,
891 if (status != ERROR_SUCCESS)
893 GResolverError errnum;
896 if (status == DNS_ERROR_RCODE_NAME_ERROR)
898 errnum = G_RESOLVER_ERROR_NOT_FOUND;
899 format = _("No service record for '%s'");
901 else if (status == DNS_ERROR_RCODE_SERVER_FAILURE)
903 errnum = G_RESOLVER_ERROR_TEMPORARY_FAILURE;
904 format = _("Temporarily unable to resolve '%s'");
908 errnum = G_RESOLVER_ERROR_INTERNAL;
909 format = _("Error resolving '%s'");
912 g_set_error (error, G_RESOLVER_ERROR, errnum, format, rrname);
917 for (rec = results; rec; rec = rec->pNext)
919 if (rec->wType != DNS_TYPE_SRV)
922 target = g_srv_target_new (rec->Data.SRV.pNameTarget,
924 rec->Data.SRV.wPriority,
925 rec->Data.SRV.wWeight);
926 targets = g_list_prepend (targets, target);
929 return g_srv_target_list_sort (targets);
934 #define __G_RESOLVER_C__
935 #include "gioaliasdef.c"