Proxy Support

Proxy Support — Functions for determining proxy support.

Synopsis




enum        GTcpProxyType;
gboolean    gtcp_proxy_get_use_proxy        (GTcpProxyType type,
                                             const gchar *address);

Description

The GTcpSocket library automatically forwards outgoing connections through configured proxy servers. The configuration is stored in GConf, and GTcpSocket reads the same configuration as GnomeVFS, and by extension, the GNOME Desktop.

The GConf keys used to store proxy settings are:

KeyTypeDescription
/system/http_proxy/use_http_proxyBooleanUse a proxy server to connect to HTTP servers.
/system/http_proxy/hostStringThe hostname of the HTTP proxy server.
/system/http_proxy/portIntegerThe port of the HTTP proxy server defined in /system/http_proxy/host.
/system/http_proxy/use_authenticationBooleanAuthenticate when using the HTTP proxy server.
/system/http_proxy/authentication_userStringThe username to use when authenticating with the HTTP proxy server defined in /system/http_proxy/host.
/system/http_proxy/authentication_passwordStringThe password to use when authenticating with the HTTP proxy server defined in /system/http_proxy/host.
/system/proxy/ftp_hostStringThe hostname of the FTP proxy server.
/system/proxy/ftp_portIntegerThe port of the FTP proxy server defined in /system/proxy/ftp_host.
/system/proxy/ssl_hostStringThe hostname of the SSL proxy server.
/system/proxy/ssl_portIntegerThe port of the SSL proxy server defined in /system/proxy/ssl_host.
/system/proxy/socks_hostStringThe hostname of the SOCKS proxy server.
/system/proxy/socks_portIntegerThe port of the SOCKS proxy server defined in /system/proxy/socks_host.
/system/proxy/socks_is_v5BooleanThe SOCKS proxy server defined in /system/proxy/socks_host uses SOCKS version 5.

Details

enum GTcpProxyType

typedef enum					/* < prefix=GTCP_PROXY > */
{
	GTCP_PROXY_HTTP = GTCP_CONNECTION_HTTP,
	GTCP_PROXY_FTP = GTCP_CONNECTION_FTP,
	GTCP_PROXY_OTHER = GTCP_CONNECTION_OTHER,

	GTCP_PROXY_SSL,
	GTCP_PROXY_SOCKS4,
	GTCP_PROXY_SOCKS5
}
GTcpProxyType;

The proxy type to use for a particular address. See also: GTcpConnectionStyle.

GTCP_PROXY_HTTP use an HTTP proxy.
GTCP_PROXY_FTP use an FTP proxy (not implemented).
GTCP_PROXY_OTHER use a SOCKS proxy of some type (this will be determined from the proxy configuration).
GTCP_PROXY_SSL use an SSL proxy (HTTPS should use HTTP proxies) (not implemented).
GTCP_PROXY_SOCKS4 use a SOCKS version 4 server.
GTCP_PROXY_SOCKS5 use a SOCKS version 5 server.

Since 1.0.


gtcp_proxy_get_use_proxy ()

gboolean    gtcp_proxy_get_use_proxy        (GTcpProxyType type,
                                             const gchar *address);

This function checks GTcpProxyType & the address, and returns TRUE if a proxy will be used, or FALSE, if one won't. This is useful if you need to check to see if you can create a GTcpServer without problems.

type : the GTcpProxyType for this connection.
address : the remote address to check the proxy for.
Returns : a gboolean if a proxy will be used for this connection.

Since 1.0