[glib] Added proxy_enumerate method to GSocketConnectable
- From: Nicolas Dufresne <nicolasd src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] Added proxy_enumerate method to GSocketConnectable
- Date: Thu, 19 Aug 2010 21:05:04 +0000 (UTC)
commit f82f484b8ffa18aab10e79baa96bcfa438f8dc5b
Author: Nicolas Dufresne <nicolas dufresne collabora co uk>
Date: Tue Aug 10 16:53:25 2010 -0400
Added proxy_enumerate method to GSocketConnectable
Reviewed-by: Dan Winship <danw gnome org>
docs/reference/gio/gio-sections.txt | 1 +
gio/gio.symbols | 3 ++-
gio/gnetworkaddress.c | 2 +-
gio/gnetworkingprivate.h | 5 +++++
gio/gsocketconnectable.c | 31 +++++++++++++++++++++++++++++++
gio/gsocketconnectable.h | 8 +++++++-
6 files changed, 47 insertions(+), 3 deletions(-)
---
diff --git a/docs/reference/gio/gio-sections.txt b/docs/reference/gio/gio-sections.txt
index e3740c5..ce903a5 100644
--- a/docs/reference/gio/gio-sections.txt
+++ b/docs/reference/gio/gio-sections.txt
@@ -1633,6 +1633,7 @@ g_srv_target_get_type
GSocketConnectable
GSocketConnectableIface
g_socket_connectable_enumerate
+g_socket_connectable_proxy_enumerate
<SUBSECTION>
GSocketAddressEnumerator
g_socket_address_enumerator_next
diff --git a/gio/gio.symbols b/gio/gio.symbols
index 6b4e57a..ede00ac 100644
--- a/gio/gio.symbols
+++ b/gio/gio.symbols
@@ -1248,8 +1248,9 @@ g_network_service_new
#if IN_HEADER(__G_SOCKET_CONNECTABLE_H__)
#if IN_FILE(__G_SOCKET_CONNECTABLE_C__)
-g_socket_connectable_enumerate
g_socket_connectable_get_type G_GNUC_CONST
+g_socket_connectable_enumerate
+g_socket_connectable_proxy_enumerate
#endif
#endif
diff --git a/gio/gnetworkaddress.c b/gio/gnetworkaddress.c
index 77a82ee..e2ed039 100644
--- a/gio/gnetworkaddress.c
+++ b/gio/gnetworkaddress.c
@@ -422,7 +422,7 @@ g_network_address_parse (const gchar *host_and_port,
#define G_URI_OTHER_UNRESERVED "-._~"
/* This or something equivalent will eventually go into glib/guri.h */
-static gboolean
+gboolean
_g_uri_parse_authority (const char *uri,
char **host,
guint16 *port,
diff --git a/gio/gnetworkingprivate.h b/gio/gnetworkingprivate.h
index dcfba0d..9434adf 100644
--- a/gio/gnetworkingprivate.h
+++ b/gio/gnetworkingprivate.h
@@ -120,6 +120,11 @@ GList *_g_resolver_targets_from_DnsQuery (const gchar *rrname,
GError **error);
#endif
+gboolean _g_uri_parse_authority (const char *uri,
+ char **host,
+ guint16 *port,
+ char **userinfo);
+
G_END_DECLS
#endif /* __G_NETWORKINGPRIVATE_H__ */
diff --git a/gio/gsocketconnectable.c b/gio/gsocketconnectable.c
index dc2821c..aab171c 100644
--- a/gio/gsocketconnectable.c
+++ b/gio/gsocketconnectable.c
@@ -120,3 +120,34 @@ g_socket_connectable_enumerate (GSocketConnectable *connectable)
return (* iface->enumerate) (connectable);
}
+
+/**
+ * g_socket_connectable_proxy_enumerate:
+ * @connectable: a #GSocketConnectable
+ *
+ * Creates a #GSocketAddressEnumerator for @connectable that will
+ * return #GProxyAddress<!-- -->es for addresses that you must connect
+ * to via a proxy.
+ *
+ * If @connectable does not implement
+ * g_socket_connectable_proxy_enumerate(), this will fall back to
+ * calling g_socket_connectable_enumerate().
+ *
+ * Return value: a new #GSocketAddressEnumerator.
+ *
+ * Since: 2.26
+ */
+GSocketAddressEnumerator *
+g_socket_connectable_proxy_enumerate (GSocketConnectable *connectable)
+{
+ GSocketConnectableIface *iface;
+
+ g_return_val_if_fail (G_IS_SOCKET_CONNECTABLE (connectable), NULL);
+
+ iface = G_SOCKET_CONNECTABLE_GET_IFACE (connectable);
+
+ if (iface->proxy_enumerate)
+ return (* iface->proxy_enumerate) (connectable);
+ else
+ return (* iface->enumerate) (connectable);
+}
diff --git a/gio/gsocketconnectable.h b/gio/gsocketconnectable.h
index 5952b4f..0f84a4a 100644
--- a/gio/gsocketconnectable.h
+++ b/gio/gsocketconnectable.h
@@ -45,8 +45,10 @@ typedef struct _GSocketConnectableIface GSocketConnectableIface;
* GSocketConnectableIface:
* @g_iface: The parent interface.
* @enumerate: Creates a #GSocketAddressEnumerator
+ * @proxy_enumerate: Creates a #GProxyAddressEnumerator
*
* Provides an interface for returning a #GSocketAddressEnumerator
+ * and #GProxyAddressEnumerator
*/
struct _GSocketConnectableIface
{
@@ -54,7 +56,9 @@ struct _GSocketConnectableIface
/* Virtual Table */
- GSocketAddressEnumerator * (* enumerate) (GSocketConnectable *connectable);
+ GSocketAddressEnumerator * (* enumerate) (GSocketConnectable *connectable);
+
+ GSocketAddressEnumerator * (* proxy_enumerate) (GSocketConnectable *connectable);
};
@@ -62,6 +66,8 @@ GType g_socket_connectable_get_type (void) G_GNUC_CONST;
GSocketAddressEnumerator *g_socket_connectable_enumerate (GSocketConnectable *connectable);
+GSocketAddressEnumerator *g_socket_connectable_proxy_enumerate (GSocketConnectable *connectable);
+
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]