|  |  |  | GNet Network Library Reference Manual | |
|---|---|---|---|---|
#include <gnet.h> #define GNET_SOCKS_PORT #define GNET_SOCKS_VERSION gboolean gnet_socks_get_enabled (void); void gnet_socks_set_enabled (gboolean enabled); GInetAddr* gnet_socks_get_server (void); void gnet_socks_set_server (const GInetAddr *inetaddr); gint gnet_socks_get_version (void); void gnet_socks_set_version (gint version);
SOCKS is a TCP proxy protocol. Typically, a host behind a firewall uses SOCKS to connect to hosts outside the firewall via a SOCKS proxy server. To open a TCP connection, a SOCKS client connects to a SOCKS server and the SOCKS server connects to the destination. Data is then forwarded between the client and the destination by the SOCKS server. GNet supports SOCKS versions 4 and 5. Version 5 includes support for server sockets.
SOCKS is used if the SOCKS_SERVER environment variable is set or
gnet_socks_set_server() is called to set the SOCKS server's address.
To disable SOCKS support, call gnet_socks_set_enabled() and pass
FALSE.  The SOCKS_VERSION environment variable controls which SOCKS
version is used.  The default is version 5.
gboolean gnet_socks_get_enabled (void);
Determines whether SOCKS support is enabled.
| Returns : | TRUE if SOCKS is enabled, FALSE otherwise. | 
void gnet_socks_set_enabled (gboolean enabled);
Sets whether SOCKS support is enabled.
| enabled: | is SOCKS support enabled? | 
GInetAddr* gnet_socks_get_server (void);
Gets the address of the SOCKS server (regardless of whether SOCKS
 is enabled).  This function checks the gnet_socks_set_server()
 value and, if not set, the SOCKS_SERVER environment variable.  The
 SOCKS_SERVER enviroment variable should be in the form HOSTNAME or
 HOSTNAME:PORT.
| Returns : | a copy of the address; NULL if there is no server. | 
void gnet_socks_set_server (const GInetAddr *inetaddr);
Sets the address of the SOCKS server.
| inetaddr: | SOCKS server address | 
gint gnet_socks_get_version (void);
Gets the SOCKS version GNet uses.  This function checks the
 gnet_socks_set_version() value and, if not set, the SOCKS_VERSION
 environment variable.
| Returns : | the SOCKS version. |