From f3debedfd2a3197230ac6f09f56741c3eda61e29 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Fri, 7 May 2010 15:55:54 -0400 Subject: [PATCH] Implemented proxy-resolver extension point This extension point allow extending GLib with library like LibProxy that interprets system proxy settings and finds the appropriate configuration based on the type of connection being made. Reviewed-by: Dan Winship --- docs/reference/gio/gio-docs.xml | 1 + docs/reference/gio/gio-sections.txt | 20 +++ docs/reference/gio/gio.types | 1 + gio/Makefile.am | 4 + gio/gdummyproxyresolver.c | 156 ++++++++++++++++++ gio/gdummyproxyresolver.h | 54 +++++++ gio/gio.h | 1 + gio/gio.symbols | 11 ++ gio/giomodule.c | 7 + gio/giotypes.h | 9 ++ gio/gproxyresolver.c | 241 ++++++++++++++++++++++++++++ gio/gproxyresolver.h | 96 +++++++++++ 12 files changed, 601 insertions(+) create mode 100644 gio/gdummyproxyresolver.c create mode 100644 gio/gdummyproxyresolver.h create mode 100644 gio/gproxyresolver.c create mode 100644 gio/gproxyresolver.h diff --git a/docs/reference/gio/gio-docs.xml b/docs/reference/gio/gio-docs.xml index 9fea7a398..61f9168d0 100644 --- a/docs/reference/gio/gio-docs.xml +++ b/docs/reference/gio/gio-docs.xml @@ -123,6 +123,7 @@ DNS resolution + diff --git a/docs/reference/gio/gio-sections.txt b/docs/reference/gio/gio-sections.txt index a03ca710b..f762c0281 100644 --- a/docs/reference/gio/gio-sections.txt +++ b/docs/reference/gio/gio-sections.txt @@ -2766,3 +2766,23 @@ G_SIMPLE_ACTION_GROUP_GET_CLASS G_IS_SIMPLE_ACTION_GROUP_CLASS G_SIMPLE_ACTION_GROUP + +
+gproxyresolver +GProxyResolver +GProxyResolver +GProxyResolverIface +G_PROXY_RESOLVER_EXTENSION_POINT_NAME +g_proxy_resolver_get_default +g_proxy_resolver_is_supported +g_proxy_resolver_lookup +g_proxy_resolver_lookup_async +g_proxy_resolver_lookup_finish + +G_PROXY_RESOLVER +G_IS_PROXY_RESOLVER +G_TYPE_PROXY_RESOLVER +G_PROXY_RESOLVER_GET_IFACE + +g_proxy_resolver_get_type +
diff --git a/docs/reference/gio/gio.types b/docs/reference/gio/gio.types index 7d208ddee..5a9f7d7aa 100644 --- a/docs/reference/gio/gio.types +++ b/docs/reference/gio/gio.types @@ -75,6 +75,7 @@ g_output_stream_get_type g_output_stream_splice_flags_get_type g_password_save_get_type g_permission_get_type +g_proxy_resolver_get_type g_resolver_error_get_type g_resolver_get_type g_seekable_get_type diff --git a/gio/Makefile.am b/gio/Makefile.am index 8cff34f2c..10df75af6 100644 --- a/gio/Makefile.am +++ b/gio/Makefile.am @@ -288,6 +288,8 @@ libgio_2_0_la_SOURCES = \ gdrive.c \ gdummyfile.h \ gdummyfile.c \ + gdummyproxyresolver.c \ + gdummyproxyresolver.h \ gemblem.h \ gemblem.c \ gemblemedicon.h \ @@ -331,6 +333,7 @@ libgio_2_0_la_SOURCES = \ gpermission.c \ gpollfilemonitor.c \ gpollfilemonitor.h \ + gproxyresolver.c \ gresolver.c \ gseekable.c \ gsimpleasyncresult.c \ @@ -478,6 +481,7 @@ gio_headers = \ gnetworkservice.h \ goutputstream.h \ gpermission.h \ + gproxyresolver.h \ gresolver.h \ gseekable.h \ gsimpleasyncresult.h \ diff --git a/gio/gdummyproxyresolver.c b/gio/gdummyproxyresolver.c new file mode 100644 index 000000000..5d4c3474b --- /dev/null +++ b/gio/gdummyproxyresolver.c @@ -0,0 +1,156 @@ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2010 Collabora, Ltd. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Nicolas Dufresne + */ + +#include "config.h" + +#include "gdummyproxyresolver.h" + +#include + +#include "gasyncresult.h" +#include "gcancellable.h" +#include "gproxyresolver.h" +#include "gsimpleasyncresult.h" + +#include "giomodule.h" +#include "giomodule-priv.h" + +struct _GDummyProxyResolver { + GObject parent_instance; +}; + +static void g_dummy_proxy_resolver_iface_init (GProxyResolverInterface *iface); + +#define g_dummy_proxy_resolver_get_type _g_dummy_proxy_resolver_get_type +G_DEFINE_TYPE_WITH_CODE (GDummyProxyResolver, g_dummy_proxy_resolver, G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE (G_TYPE_PROXY_RESOLVER, + g_dummy_proxy_resolver_iface_init) + _g_io_modules_ensure_extension_points_registered (); + g_io_extension_point_implement (G_PROXY_RESOLVER_EXTENSION_POINT_NAME, + g_define_type_id, + "dummy", + -100)) + +static void +g_dummy_proxy_resolver_finalize (GObject *object) +{ + /* must chain up */ + G_OBJECT_CLASS (g_dummy_proxy_resolver_parent_class)->finalize (object); +} + +static void +g_dummy_proxy_resolver_init (GDummyProxyResolver *resolver) +{ +} + +static gboolean +g_dummy_proxy_resolver_is_supported (GProxyResolver *resolver) +{ + return TRUE; +} + +static gchar ** +g_dummy_proxy_resolver_lookup (GProxyResolver *resolver, + const gchar *uri, + GCancellable *cancellable, + GError **error) +{ + gchar **proxies; + + if (g_cancellable_set_error_if_cancelled (cancellable, error)) + return NULL; + + proxies = g_new0 (gchar *, 2); + proxies[0] = g_strdup ("direct://"); + + return proxies; +} + +static void +g_dummy_proxy_resolver_lookup_async (GProxyResolver *resolver, + const gchar *uri, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + GError *error = NULL; + GSimpleAsyncResult *simple; + gchar **proxies; + + proxies = g_dummy_proxy_resolver_lookup (resolver, uri, cancellable, &error); + + + simple = g_simple_async_result_new (G_OBJECT (resolver), + callback, user_data, + g_dummy_proxy_resolver_lookup_async); + + if (proxies == NULL) + { + g_simple_async_result_set_from_error (simple, error); + g_error_free (error); + } + else + { + g_simple_async_result_set_op_res_gpointer (simple, + proxies, + NULL); + } + + g_simple_async_result_complete_in_idle (simple); + g_object_unref (simple); +} + +static gchar ** +g_dummy_proxy_resolver_lookup_finish (GProxyResolver *resolver, + GAsyncResult *result, + GError **error) +{ + if (G_IS_SIMPLE_ASYNC_RESULT (result)) + { + GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (result); + + if (g_simple_async_result_propagate_error (simple, error)) + return NULL; + + return g_simple_async_result_get_op_res_gpointer (simple); + } + + return NULL; +} + +static void +g_dummy_proxy_resolver_class_init (GDummyProxyResolverClass *resolver_class) +{ + GObjectClass *object_class; + + object_class = G_OBJECT_CLASS (resolver_class); + object_class->finalize = g_dummy_proxy_resolver_finalize; +} + +static void +g_dummy_proxy_resolver_iface_init (GProxyResolverInterface *iface) +{ + iface->is_supported = g_dummy_proxy_resolver_is_supported; + iface->lookup = g_dummy_proxy_resolver_lookup; + iface->lookup_async = g_dummy_proxy_resolver_lookup_async; + iface->lookup_finish = g_dummy_proxy_resolver_lookup_finish; +} diff --git a/gio/gdummyproxyresolver.h b/gio/gdummyproxyresolver.h new file mode 100644 index 000000000..75bab7bbe --- /dev/null +++ b/gio/gdummyproxyresolver.h @@ -0,0 +1,54 @@ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2010 Collabora, Ltd. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Nicolas Dufresne + */ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __G_DUMMY_PROXY_RESOLVER_H__ +#define __G_DUMMY_PROXY_RESOLVER_H__ + +#include + +G_BEGIN_DECLS + +#define G_TYPE_DUMMY_PROXY_RESOLVER (_g_dummy_proxy_resolver_get_type ()) +#define G_DUMMY_PROXY_RESOLVER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DUMMY_PROXY_RESOLVER, GDummyProxyResolver)) +#define G_DUMMY_PROXY_RESOLVER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DUMMY_PROXY_RESOLVER, GDummyProxyResolverClass)) +#define G_IS_DUMMY_PROXY_RESOLVER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DUMMY_PROXY_RESOLVER)) +#define G_IS_DUMMY_PROXY_RESOLVER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DUMMY_PROXY_RESOLVER)) +#define G_DUMMY_PROXY_RESOLVER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DUMMY_PROXY_RESOLVER, GDummyProxyResolverClass)) + +typedef struct _GDummyProxyResolver GDummyProxyResolver; +typedef struct _GDummyProxyResolverClass GDummyProxyResolverClass; + + +struct _GDummyProxyResolverClass { + GObjectClass parent_class; +}; + +GType _g_dummy_proxy_resolver_get_type (void); + + +G_END_DECLS + +#endif /* __G_DUMMY_PROXY_RESOLVER_H__ */ diff --git a/gio/gio.h b/gio/gio.h index e5f8f9ef5..733ec2f87 100644 --- a/gio/gio.h +++ b/gio/gio.h @@ -92,6 +92,7 @@ #include #include #include +#include #include #include #include diff --git a/gio/gio.symbols b/gio/gio.symbols index 4e13a55c1..700f94913 100644 --- a/gio/gio.symbols +++ b/gio/gio.symbols @@ -1128,6 +1128,17 @@ g_socket_address_to_native #endif #endif +#if IN_HEADER(__G_PROXY_RESOLVER_H__) +#if IN_FILE(__G_PROXY_RESOLVER_C__) +g_proxy_resolver_get_default +g_proxy_resolver_get_type +g_proxy_resolver_is_supported +g_proxy_resolver_lookup +g_proxy_resolver_lookup_async +g_proxy_resolver_lookup_finish +#endif +#endif + #if IN_HEADER(__G_RESOLVER_H__) #if IN_FILE(__G_RESOLVER_C__) g_resolver_error_quark diff --git a/gio/giomodule.c b/gio/giomodule.c index e40b7ef7d..2c9c6e01d 100644 --- a/gio/giomodule.c +++ b/gio/giomodule.c @@ -30,6 +30,7 @@ #include "glocalfilemonitor.h" #include "glocaldirectorymonitor.h" #include "gnativevolumemonitor.h" +#include "gproxyresolver.h" #include "gvfs.h" #ifdef G_OS_UNIX #include "gdesktopappinfo.h" @@ -467,6 +468,8 @@ extern GType _g_win32_volume_monitor_get_type (void); extern GType g_win32_directory_monitor_get_type (void); extern GType _g_winhttp_vfs_get_type (void); +extern GType _g_dummy_proxy_resolver_get_type (void); + #ifdef G_PLATFORM_WIN32 #include @@ -534,6 +537,9 @@ _g_io_modules_ensure_extension_points_registered (void) ep = g_io_extension_point_register ("gsettings-backend"); g_io_extension_point_set_required_type (ep, G_TYPE_OBJECT); + + ep = g_io_extension_point_register (G_PROXY_RESOLVER_EXTENSION_POINT_NAME); + g_io_extension_point_set_required_type (ep, G_TYPE_PROXY_RESOLVER); } G_UNLOCK (registered_extensions); @@ -591,6 +597,7 @@ _g_io_modules_ensure_loaded (void) _g_winhttp_vfs_get_type (); #endif _g_local_vfs_get_type (); + _g_dummy_proxy_resolver_get_type (); } G_UNLOCK (loaded_dirs); diff --git a/gio/giotypes.h b/gio/giotypes.h index ff48a3872..222784637 100644 --- a/gio/giotypes.h +++ b/gio/giotypes.h @@ -198,6 +198,15 @@ typedef struct _GThreadedSocketService GThreadedSocketServi typedef struct _GThemedIcon GThemedIcon; typedef struct _GVfs GVfs; /* Dummy typedef */ +/** + * GProxyResolver: + * + * A helper class to enumerate proxies base on URI. + * + * Since: 2.26 + **/ +typedef struct _GProxyResolver GProxyResolver; + /** * GVolume: * diff --git a/gio/gproxyresolver.c b/gio/gproxyresolver.c new file mode 100644 index 000000000..62f41cfec --- /dev/null +++ b/gio/gproxyresolver.c @@ -0,0 +1,241 @@ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2010 Collabora, Ltd. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Nicolas Dufresne + */ + +#include "config.h" + +#include "gproxyresolver.h" + +#include +#include "glibintl.h" + +#include "gasyncresult.h" +#include "gcancellable.h" +#include "giomodule.h" +#include "giomodule-priv.h" +#include "gsimpleasyncresult.h" + +/** + * SECTION:gproxyresolver + * @short_description: Asynchronous and cancellable network proxy resolver + * @include: gio/gio.h + * + * #GProxyResolver provides synchronous and asynchronous network proxy + * resolution. #GProxyResolver is used within #GClientSocket through + * the method g_socket_connectable_proxy_enumerate(). + */ + +G_DEFINE_INTERFACE (GProxyResolver, g_proxy_resolver, G_TYPE_OBJECT) + +static void +g_proxy_resolver_default_init (GProxyResolverInterface *iface) +{ +} + +static gpointer +get_default_proxy_resolver (gpointer arg) +{ + const gchar *use_this; + GProxyResolver *resolver; + GList *l; + GIOExtensionPoint *ep; + GIOExtension *extension; + + + use_this = g_getenv ("GIO_USE_PROXY_RESOLVER"); + + /* Ensure proxy-resolver modules loaded */ + _g_io_modules_ensure_loaded (); + + ep = g_io_extension_point_lookup (G_PROXY_RESOLVER_EXTENSION_POINT_NAME); + + if (use_this) + { + extension = g_io_extension_point_get_extension_by_name (ep, use_this); + if (extension) + { + resolver = g_object_new (g_io_extension_get_type (extension), NULL); + + if (g_proxy_resolver_is_supported (resolver)) + return resolver; + + g_object_unref (resolver); + } + } + + for (l = g_io_extension_point_get_extensions (ep); l != NULL; l = l->next) + { + extension = l->data; + + resolver = g_object_new (g_io_extension_get_type (extension), NULL); + + if (g_proxy_resolver_is_supported (resolver)) + return resolver; + + g_object_unref (resolver); + } + + return NULL; +} + +/** + * g_proxy_resolver_get_default: + * + * Gets the default #GProxyResolver for the system. + * + * Return value: the default #GProxyResolver. + * + * Since: 2.26 + */ +GProxyResolver * +g_proxy_resolver_get_default (void) +{ + static GOnce once_init = G_ONCE_INIT; + + return g_once (&once_init, get_default_proxy_resolver, NULL); +} + +/** + * g_proxy_resolver_is_supported: + * @resolver: a #GProxyResolver + * + * Checks if @resolver can be used on this system. (This is used + * internally; g_proxy_resolver_get_default() will only return a proxy + * resolver that returns %TRUE for this method.) + * + * Return value: %TRUE if @resolver is supported. + * + * Since: 2.26 + */ +gboolean +g_proxy_resolver_is_supported (GProxyResolver *resolver) +{ + GProxyResolverInterface *iface; + + g_return_val_if_fail (G_IS_PROXY_RESOLVER (resolver), FALSE); + + iface = G_PROXY_RESOLVER_GET_IFACE (resolver); + + return (* iface->is_supported) (resolver); +} + +/** + * g_proxy_resolver_lookup: + * @resolver: a #GProxyResolver + * @uri: a URI representing the destination to connect to + * @cancellable: a #GCancellable, or %NULL + * @error: return location for a #GError, or %NULL + * + * Looks into the system proxy configuration to determine what proxy, + * if any, to use to connect to @uri. The returned proxy URIs are of the + * form <protocol>://[user[:password]@]host:port + * or direct://, where <protocol> could be + * http, rtsp, socks or other proxying protocol. + * + * If you don't know what network protocol is being used on the + * socket, you should use none as the URI protocol. + * In this case, the resolver might still return a generic proxy type + * (such as SOCKS), but would not return protocol-specific proxy types + * (such as http). + * + * direct:// is used when no proxy is needed. + * Direct connection should not be attempted unless it is part of the + * returned array of proxies. + * + * Return value: A NULL-terminated array of proxy URIs. Must be freed with + * g_strfreev(). + * + * Since: 2.26 + */ +gchar ** +g_proxy_resolver_lookup (GProxyResolver *resolver, + const gchar *uri, + GCancellable *cancellable, + GError **error) +{ + GProxyResolverInterface *iface; + + g_return_val_if_fail (G_IS_PROXY_RESOLVER (resolver), NULL); + g_return_val_if_fail (uri != NULL, NULL); + + iface = G_PROXY_RESOLVER_GET_IFACE (resolver); + + return (* iface->lookup) (resolver, uri, cancellable, error); +} + +/** + * g_proxy_resolver_lookup_async: + * @resolver: a #GProxyResolver + * @uri: a URI representing the destination to connect to + * @cancellable: a #GCancellable, or %NULL + * @callback: callback to call after resolution completes + * @user_data: data for @callback + * + * Asynchronous lookup of proxy. See g_proxy_resolver_lookup() for more + * details. + * + * Since: 2.26 + */ +void +g_proxy_resolver_lookup_async (GProxyResolver *resolver, + const gchar *uri, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data) +{ + GProxyResolverInterface *iface; + + g_return_if_fail (G_IS_PROXY_RESOLVER (resolver)); + g_return_if_fail (uri != NULL); + + iface = G_PROXY_RESOLVER_GET_IFACE (resolver); + + (* iface->lookup_async) (resolver, uri, cancellable, callback, user_data); +} + +/** + * g_proxy_resolver_lookup_finish: + * @resolver: a #GProxyResolver + * @result: the result passed to your #GAsyncReadyCallback + * @error: return location for a #GError, or %NULL + * + * Call this function to obtain the array of proxy URIs when + * g_proxy_resolver_lookup_async() is complete. See + * g_proxy_resolver_lookup() for more details. + * + * Return value: A NULL-terminated array of proxy URIs. Must be freed with + * g_strfreev(). + * + * Since: 2.26 + */ +gchar ** +g_proxy_resolver_lookup_finish (GProxyResolver *resolver, + GAsyncResult *result, + GError **error) +{ + GProxyResolverInterface *iface; + + g_return_val_if_fail (G_IS_PROXY_RESOLVER (resolver), NULL); + + iface = G_PROXY_RESOLVER_GET_IFACE (resolver); + + return (* iface->lookup_finish) (resolver, result, error); +} diff --git a/gio/gproxyresolver.h b/gio/gproxyresolver.h new file mode 100644 index 000000000..391f9021b --- /dev/null +++ b/gio/gproxyresolver.h @@ -0,0 +1,96 @@ +/* GIO - GLib Input, Output and Streaming Library + * + * Copyright (C) 2010 Collabora, Ltd. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: Nicolas Dufresne + */ + +#if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION) +#error "Only can be included directly." +#endif + +#ifndef __G_PROXY_RESOLVER_H__ +#define __G_PROXY_RESOLVER_H__ + +#include + +G_BEGIN_DECLS + +#define G_TYPE_PROXY_RESOLVER (g_proxy_resolver_get_type ()) +#define G_PROXY_RESOLVER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_PROXY_RESOLVER, GProxyResolver)) +#define G_IS_PROXY_RESOLVER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_PROXY_RESOLVER)) +#define G_PROXY_RESOLVER_GET_IFACE(o) (G_TYPE_INSTANCE_GET_INTERFACE ((o), G_TYPE_PROXY_RESOLVER, GProxyResolverInterface)) + +/** + * G_PROXY_RESOLVER_EXTENSION_POINT_NAME: + * + * Extension point for proxy resolving functionality. + * See Extending GIO. + */ +#define G_PROXY_RESOLVER_EXTENSION_POINT_NAME "gio-proxy-resolver" + +/** + * GProxyResolver: + * + * Interface that can be used to resolve proxy address. + */ +typedef struct _GProxyResolverInterface GProxyResolverInterface; + +struct _GProxyResolverInterface { + GTypeInterface g_iface; + + /* Virtual Table */ + gboolean (* is_supported) (GProxyResolver *resolver); + + gchar ** (* lookup) (GProxyResolver *resolver, + const gchar *uri, + GCancellable *cancellable, + GError **error); + + void (* lookup_async) (GProxyResolver *resolver, + const gchar *uri, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); + + gchar ** (* lookup_finish) (GProxyResolver *resolver, + GAsyncResult *result, + GError **error); +}; + +GType g_proxy_resolver_get_type (void) G_GNUC_CONST; +GProxyResolver *g_proxy_resolver_get_default (void); + +gboolean g_proxy_resolver_is_supported (GProxyResolver *resolver); +gchar **g_proxy_resolver_lookup (GProxyResolver *resolver, + const gchar *uri, + GCancellable *cancellable, + GError **error); +void g_proxy_resolver_lookup_async (GProxyResolver *resolver, + const gchar *uri, + GCancellable *cancellable, + GAsyncReadyCallback callback, + gpointer user_data); +gchar **g_proxy_resolver_lookup_finish (GProxyResolver *resolver, + GAsyncResult *result, + GError **error); + + +G_END_DECLS + +#endif /* __G_PROXY_RESOLVER_H__ */