pidgin 2.14.14dev
Loading...
Searching...
No Matches
proxy.h File Reference

Proxy API. More...

#include <glib.h>
#include "eventloop.h"
#include "account.h"
Include dependency graph for proxy.h:
This graph shows which files directly or indirectly include this file:

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 , PURPLE_PROXY_TOR
}
 A type of proxy connection. More...
 

Functions

Proxy structure API <br>
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 <br>
PurpleProxyInfopurple_global_proxy_get_info (void)
 Returns purple's global proxy information.
 
void purple_global_proxy_set_info (PurpleProxyInfo *info)
 Set purple's global proxy information.
 
Proxy API <br>
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_udp (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_account (void *handle, PurpleAccount *account, PurpleProxyInfo *gpi, const char *host, int port, PurpleProxyConnectFunction connect_cb, gpointer data)
 Makes a connection through a SOCKS5 proxy.
 
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.

Typedef Documentation

◆ PurpleProxyConnectData

typedef struct _PurpleProxyConnectData PurpleProxyConnectData

Definition at line 61 of file proxy.h.

◆ PurpleProxyConnectFunction

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

Definition at line 63 of file proxy.h.

Enumeration Type Documentation

◆ PurpleProxyType

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.


PURPLE_PROXY_TOR 

Use a Tor proxy (SOCKS 5 really)

Definition at line 35 of file proxy.h.

Function Documentation

◆ purple_global_proxy_get_info()

PurpleProxyInfo * purple_global_proxy_get_info ( void  )

Returns purple's global proxy information.

Returns
The global proxy information.

◆ purple_global_proxy_set_info()

void purple_global_proxy_set_info ( PurpleProxyInfo info)

Set purple's global proxy information.

Parameters
infoThe proxy information.
Since
2.6.0

◆ purple_proxy_connect()

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
handleA 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.
accountThe account making the connection.
hostThe destination host.
portThe destination port.
connect_cbThe 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).
dataUser-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.

◆ purple_proxy_connect_cancel()

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.

◆ purple_proxy_connect_socks5()

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
handleA 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.
gpiThe PurpleProxyInfo specifying the proxy settings
hostThe destination host.
portThe destination port.
connect_cbThe 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).
dataUser-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.
Deprecated:
Use purple_proxy_connect_socks5_account instead

◆ purple_proxy_connect_socks5_account()

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

Makes a connection through a SOCKS5 proxy.

Note that if the account that is making the connection uses a proxy, this connection to a SOCKS5 proxy will be made through the account proxy.

Parameters
handleA 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.
accountThe account making the connection.
gpiThe PurpleProxyInfo specifying the proxy settings
hostThe destination host.
portThe destination port.
connect_cbThe 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).
dataUser-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.

◆ purple_proxy_connect_udp()

PurpleProxyConnectData * purple_proxy_connect_udp ( 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 UDP connection, whether through a proxy or not.

Parameters
handleA 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.
accountThe account making the connection.
hostThe destination host.
portThe destination port.
connect_cbThe 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).
dataUser-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.

◆ purple_proxy_get_handle()

void * purple_proxy_get_handle ( void  )

Returns the proxy subsystem handle.

Returns
The proxy subsystem handle.

◆ purple_proxy_get_setup()

PurpleProxyInfo * purple_proxy_get_setup ( PurpleAccount account)

Returns configuration of a proxy.

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

◆ purple_proxy_info_destroy()

void purple_proxy_info_destroy ( PurpleProxyInfo info)

Destroys a proxy information structure.

Parameters
infoThe proxy information structure to destroy.

◆ purple_proxy_info_get_host()

const char * purple_proxy_info_get_host ( const PurpleProxyInfo info)

Returns the proxy's host.

Parameters
infoThe proxy information.
Returns
The host.

◆ purple_proxy_info_get_password()

const char * purple_proxy_info_get_password ( const PurpleProxyInfo info)

Returns the proxy's password.

Parameters
infoThe proxy information.
Returns
The password.

◆ purple_proxy_info_get_port()

int purple_proxy_info_get_port ( const PurpleProxyInfo info)

Returns the proxy's port.

Parameters
infoThe proxy information.
Returns
The port.

◆ purple_proxy_info_get_type()

PurpleProxyType purple_proxy_info_get_type ( const PurpleProxyInfo info)

Returns the proxy's type.

Parameters
infoThe proxy information.
Returns
The type.

◆ purple_proxy_info_get_username()

const char * purple_proxy_info_get_username ( const PurpleProxyInfo info)

Returns the proxy's username.

Parameters
infoThe proxy information.
Returns
The username.

◆ purple_proxy_info_new()

PurpleProxyInfo * purple_proxy_info_new ( void  )

Creates a proxy information structure.

Returns
The proxy information structure.

◆ purple_proxy_info_set_host()

void purple_proxy_info_set_host ( PurpleProxyInfo info,
const char *  host 
)

Sets the proxy host.

Parameters
infoThe proxy information.
hostThe host.

◆ purple_proxy_info_set_password()

void purple_proxy_info_set_password ( PurpleProxyInfo info,
const char *  password 
)

Sets the proxy password.

Parameters
infoThe proxy information.
passwordThe password.

◆ purple_proxy_info_set_port()

void purple_proxy_info_set_port ( PurpleProxyInfo info,
int  port 
)

Sets the proxy port.

Parameters
infoThe proxy information.
portThe port.

◆ purple_proxy_info_set_type()

void purple_proxy_info_set_type ( PurpleProxyInfo info,
PurpleProxyType  type 
)

Sets the type of proxy.

Parameters
infoThe proxy information.
typeThe proxy type.

◆ purple_proxy_info_set_username()

void purple_proxy_info_set_username ( PurpleProxyInfo info,
const char *  username 
)

Sets the proxy username.

Parameters
infoThe proxy information.
usernameThe username.