Skip to content
Browse files

Added proxy_enumerate method to GSocketConnectable

Reviewed-by: Dan Winship <danw@gnome.org>
  • Loading branch information...
1 parent 6749ffc commit f82f484b8ffa18aab10e79baa96bcfa438f8dc5b @ndufresne ndufresne committed Aug 10, 2010
View
1 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
View
3 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
View
2 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,
View
5 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__ */
View
31 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);
+}
View
8 gio/gsocketconnectable.h
@@ -45,23 +45,29 @@ 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
{
GTypeInterface g_iface;
/* Virtual Table */
- GSocketAddressEnumerator * (* enumerate) (GSocketConnectable *connectable);
+ GSocketAddressEnumerator * (* enumerate) (GSocketConnectable *connectable);
+
+ GSocketAddressEnumerator * (* proxy_enumerate) (GSocketConnectable *connectable);
};
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

0 comments on commit f82f484

Please sign in to comment.
Something went wrong with that request. Please try again.