AN_SET_PROXY

Section: Antinat Programmer's Manual (3)
Updated: 2005-01-03
Index Return to Main Contents
 

NAME

an_set_proxy - set the location and type of the proxy server  

SYNOPSIS

#include <antinat.h>

int an_set_proxy(ANCONN s, unsigned short proxy_type, unsigned short packet_family, const char * proxy_hostname, unsigned short proxy_port);  

DESCRIPTION

The an_set_proxy(3) function is used to specify the proxy server to use and other characteristics associated with the socket. This function allows fine-grained control of how a proxy can be configured; a simpler interface is available in the form of an_set_proxy_url(3). This function can only be used to define a connection to a proxy server. If you want the socket to connect directly, without a proxy server, use the an_unset_proxy(3) function. The default values are determined by the AN_PROXY environment variable.

s is a socket previously created with an_new_connection(3).

proxy_type is the type of proxy to use. Currently, the library supports the following values: AN_SERV_SOCKS4, AN_SERV_SOCKS5 and AN_SERV_HTTPS. AN_SERV_SSL is retained for compatibility and is the same as AN_SERV_HTTPS.

packet_family is the packet family to use for connections to the proxy. This can be AN_PF_INET for an IP-based connection, or AN_PF_INET6 for an IPv6 based connection, if Antinat has been compiled with IPv6 support.

proxy_hostname is the hostname, in NULL-terminated character format, that should be used to connect to. This parameter cannot be NULL. There is no mechanism to specify the location of the proxy server in sockaddr structures; all future applications should use hostnames in preference for increased flexibility.

port is the port number, in host byte order format, of the proxy server. Most SOCKS servers use port 1080. HTTPS servers often use a variety of ports, including 8080.  

RETURN VALUE

This call returns AN_ERROR_SUCCESS to indicate successful completion.  

ERRORS

AN_ERROR_INVALIDARG
The socket handle is invalid, or the hostname is invalid.
AN_ERROR_NOMEM
There was not enough memory remaining to allocate space to store the proxy hostname.
AN_ERROR_NOTSUPPORTED
An attempt was made to specify a proxy server type not supported by this library. Note that this function cannot be used to establish direct connections; use the an_unset_proxy(3) function instead.
 

SEE ALSO

an_new_connection(3), an_set_proxy_url(3), an_unset_proxy(3)  

AUTHOR

Malcolm Smith <[email protected]>


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUE
ERRORS
SEE ALSO
AUTHOR

Time: 14:19:44 GMT, January 09, 2005