proxy.h File Reference

Proxy API. More...

#include <glib.h>
#include "eventloop.h"
#include "account.h"

Go to the source code of this file.

Data Structures

struct  PurpleProxyInfo
 Information on proxy settings. More...

Typedefs

typedef struct
_PurpleProxyConnectData 
PurpleProxyConnectData
typedef void(* PurpleProxyConnectFunction )(gpointer data, gint source, const gchar *error_message)

Enumerations

enum  PurpleProxyType {
  PURPLE_PROXY_USE_GLOBAL = -1, PURPLE_PROXY_NONE = 0, PURPLE_PROXY_HTTP, PURPLE_PROXY_SOCKS4,
  PURPLE_PROXY_SOCKS5, PURPLE_PROXY_USE_ENVVAR
}
 A type of proxy connection. More...

Functions

Proxy structure API
PurpleProxyInfopurple_proxy_info_new (void)
 Creates a proxy information structure.
void purple_proxy_info_destroy (PurpleProxyInfo *info)
 Destroys a proxy information structure.
void purple_proxy_info_set_type (PurpleProxyInfo *info, PurpleProxyType type)
 Sets the type of proxy.
void purple_proxy_info_set_host (PurpleProxyInfo *info, const char *host)
 Sets the proxy host.
void purple_proxy_info_set_port (PurpleProxyInfo *info, int port)
 Sets the proxy port.
void purple_proxy_info_set_username (PurpleProxyInfo *info, const char *username)
 Sets the proxy username.
void purple_proxy_info_set_password (PurpleProxyInfo *info, const char *password)
 Sets the proxy password.
PurpleProxyType purple_proxy_info_get_type (const PurpleProxyInfo *info)
 Returns the proxy's type.
const char * purple_proxy_info_get_host (const PurpleProxyInfo *info)
 Returns the proxy's host.
int purple_proxy_info_get_port (const PurpleProxyInfo *info)
 Returns the proxy's port.
const char * purple_proxy_info_get_username (const PurpleProxyInfo *info)
 Returns the proxy's username.
const char * purple_proxy_info_get_password (const PurpleProxyInfo *info)
 Returns the proxy's password.
Global Proxy API
PurpleProxyInfopurple_global_proxy_get_info (void)
 Returns purple's global proxy information.
Proxy API
void * purple_proxy_get_handle (void)
 Returns the proxy subsystem handle.
void purple_proxy_init (void)
 Initializes the proxy subsystem.
void purple_proxy_uninit (void)
 Uninitializes the proxy subsystem.
PurpleProxyInfopurple_proxy_get_setup (PurpleAccount *account)
 Returns configuration of a proxy.
PurpleProxyConnectData * purple_proxy_connect (void *handle, PurpleAccount *account, const char *host, int port, PurpleProxyConnectFunction connect_cb, gpointer data)
 Makes a connection to the specified host and port.
PurpleProxyConnectData * purple_proxy_connect_socks5 (void *handle, PurpleProxyInfo *gpi, const char *host, int port, PurpleProxyConnectFunction connect_cb, gpointer data)
 Makes a connection through a SOCKS5 proxy.
void purple_proxy_connect_cancel (PurpleProxyConnectData *connect_data)
 Cancel an in-progress connection attempt.
void purple_proxy_connect_cancel_with_handle (void *handle)


Detailed Description

Proxy API.

Definition in file proxy.h.


Enumeration Type Documentation

A type of proxy connection.

Enumerator:
PURPLE_PROXY_USE_GLOBAL  Use the global proxy information.

PURPLE_PROXY_NONE  No proxy.

PURPLE_PROXY_HTTP  HTTP proxy.

PURPLE_PROXY_SOCKS4  SOCKS 4 proxy.

PURPLE_PROXY_SOCKS5  SOCKS 5 proxy.

PURPLE_PROXY_USE_ENVVAR  Use environmental settings.

Definition at line 35 of file proxy.h.


Function Documentation

PurpleProxyInfo* purple_global_proxy_get_info ( void   ) 

Returns purple's global proxy information.

Returns:
The global proxy information.

PurpleProxyConnectData* purple_proxy_connect ( void *  handle,
PurpleAccount account,
const char *  host,
int  port,
PurpleProxyConnectFunction  connect_cb,
gpointer  data 
)

Makes a connection to the specified host and port.

Note that this function name can be misleading--although it is called "proxy connect," it is used for establishing any outgoing TCP connection, whether through a proxy or not.

Parameters:
handle A handle that should be associated with this connection attempt. The handle can be used to cancel the connection attempt using the purple_proxy_connect_cancel_with_handle() function.
account The account making the connection.
host The destination host.
port The destination port.
connect_cb The function to call when the connection is established. If the connection failed then fd will be -1 and error message will be set to something descriptive (hopefully).
data User-defined data.
Returns:
NULL if there was an error, or a reference to an opaque data structure that can be used to cancel the pending connection, if needed.

void purple_proxy_connect_cancel ( PurpleProxyConnectData *  connect_data  ) 

Cancel an in-progress connection attempt.

This should be called by the PRPL if the user disables an account while it is still performing the initial sign on. Or when establishing a file transfer, if we attempt to connect to a remote user but they are behind a firewall then the PRPL can cancel the connection attempt early rather than just letting the OS's TCP/IP stack time-out the connection.

PurpleProxyConnectData* purple_proxy_connect_socks5 ( void *  handle,
PurpleProxyInfo gpi,
const char *  host,
int  port,
PurpleProxyConnectFunction  connect_cb,
gpointer  data 
)

Makes a connection through a SOCKS5 proxy.

Parameters:
handle A handle that should be associated with this connection attempt. The handle can be used to cancel the connection attempt using the purple_proxy_connect_cancel_with_handle() function.
gpi The PurpleProxyInfo specifying the proxy settings
host The destination host.
port The destination port.
connect_cb The function to call when the connection is established. If the connection failed then fd will be -1 and error message will be set to something descriptive (hopefully).
data User-defined data.
Returns:
NULL if there was an error, or a reference to an opaque data structure that can be used to cancel the pending connection, if needed.

void* purple_proxy_get_handle ( void   ) 

Returns the proxy subsystem handle.

Returns:
The proxy subsystem handle.

PurpleProxyInfo* purple_proxy_get_setup ( PurpleAccount account  ) 

Returns configuration of a proxy.

Parameters:
account The account for which the configuration is needed.
Returns:
The configuration of a proxy.

void purple_proxy_info_destroy ( PurpleProxyInfo info  ) 

Destroys a proxy information structure.

Parameters:
info The proxy information structure to destroy.

const char* purple_proxy_info_get_host ( const PurpleProxyInfo info  ) 

Returns the proxy's host.

Parameters:
info The proxy information.
Returns:
The host.

const char* purple_proxy_info_get_password ( const PurpleProxyInfo info  ) 

Returns the proxy's password.

Parameters:
info The proxy information.
Returns:
The password.

int purple_proxy_info_get_port ( const PurpleProxyInfo info  ) 

Returns the proxy's port.

Parameters:
info The proxy information.
Returns:
The port.

PurpleProxyType purple_proxy_info_get_type ( const PurpleProxyInfo info  ) 

Returns the proxy's type.

Parameters:
info The proxy information.
Returns:
The type.

const char* purple_proxy_info_get_username ( const PurpleProxyInfo info  ) 

Returns the proxy's username.

Parameters:
info The proxy information.
Returns:
The username.

PurpleProxyInfo* purple_proxy_info_new ( void   ) 

Creates a proxy information structure.

Returns:
The proxy information structure.

void purple_proxy_info_set_host ( PurpleProxyInfo info,
const char *  host 
)

Sets the proxy host.

Parameters:
info The proxy information.
host The host.

void purple_proxy_info_set_password ( PurpleProxyInfo info,
const char *  password 
)

Sets the proxy password.

Parameters:
info The proxy information.
password The password.

void purple_proxy_info_set_port ( PurpleProxyInfo info,
int  port 
)

Sets the proxy port.

Parameters:
info The proxy information.
port The port.

void purple_proxy_info_set_type ( PurpleProxyInfo info,
PurpleProxyType  type 
)

Sets the type of proxy.

Parameters:
info The proxy information.
type The proxy type.

void purple_proxy_info_set_username ( PurpleProxyInfo info,
const char *  username 
)

Sets the proxy username.

Parameters:
info The proxy information.
username The username.