diff options
-rw-r--r-- | docs/reference/gio/gio-sections.txt | 1 | ||||
-rw-r--r-- | gio/gio.symbols | 3 | ||||
-rw-r--r-- | gio/gnetworkaddress.c | 2 | ||||
-rw-r--r-- | gio/gnetworkingprivate.h | 5 | ||||
-rw-r--r-- | gio/gsocketconnectable.c | 31 | ||||
-rw-r--r-- | 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 e3740c53c..ce903a50e 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 6b4e57a4b..ede00ac77 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 77a82eee3..e2ed039bd 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 dcfba0dab..9434adf14 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 dc2821cc0..aab171cc0 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 5952b4ff1..0f84a4ae7 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 |