Commit f82f484b authored by Nicolas Dufresne's avatar Nicolas Dufresne

Added proxy_enumerate method to GSocketConnectable

Reviewed-by: Dan Winship's avatarDan Winship <danw@gnome.org>
parent 6749ffce
......@@ -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
......
......@@ -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
......
......@@ -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,
......
......@@ -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__ */
......@@ -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);
}
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment