proxy.h
Go to the documentation of this file.
/* purple
*
* Purple is the legal property of its developers, whose names are too numerous
* to list here. Please refer to the COPYRIGHT file distributed with this
* source distribution.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
#ifndef _PURPLE_PROXY_H_
#define _PURPLE_PROXY_H_
#include <glib.h>
#include "eventloop.h"
typedef enum
{
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
} PurpleProxyType;
typedef struct
{
PurpleProxyType type;
char *host;
int port;
char *username;
char *password;
} PurpleProxyInfo;
typedef struct _PurpleProxyConnectData PurpleProxyConnectData;
typedef void (*PurpleProxyConnectFunction)(gpointer data, gint source, const gchar *error_message);
#include "account.h"
#ifdef __cplusplus
extern "C" {
#endif
/**************************************************************************/
/**************************************************************************/
PurpleProxyInfo *purple_proxy_info_new(void);
void purple_proxy_info_destroy(PurpleProxyInfo *info);
void purple_proxy_info_set_type(PurpleProxyInfo *info, PurpleProxyType type);
void purple_proxy_info_set_host(PurpleProxyInfo *info, const char *host);
void purple_proxy_info_set_port(PurpleProxyInfo *info, int port);
void purple_proxy_info_set_username(PurpleProxyInfo *info, const char *username);
void purple_proxy_info_set_password(PurpleProxyInfo *info, const char *password);
PurpleProxyType purple_proxy_info_get_type(const PurpleProxyInfo *info);
const char *purple_proxy_info_get_host(const PurpleProxyInfo *info);
int purple_proxy_info_get_port(const PurpleProxyInfo *info);
const char *purple_proxy_info_get_username(const PurpleProxyInfo *info);
const char *purple_proxy_info_get_password(const PurpleProxyInfo *info);
/**************************************************************************/
/**************************************************************************/
PurpleProxyInfo *purple_global_proxy_get_info(void);
void purple_global_proxy_set_info(PurpleProxyInfo *info);
/**************************************************************************/
/**************************************************************************/
void *purple_proxy_get_handle(void);
void purple_proxy_init(void);
void purple_proxy_uninit(void);
PurpleProxyInfo *purple_proxy_get_setup(PurpleAccount *account);
PurpleProxyConnectData *purple_proxy_connect(void *handle,
PurpleAccount *account,
const char *host, int port,
PurpleProxyConnectFunction connect_cb, gpointer data);
PurpleProxyConnectData *purple_proxy_connect_udp(void *handle,
PurpleAccount *account,
const char *host, int port,
PurpleProxyConnectFunction connect_cb, gpointer data);
PurpleProxyConnectData *purple_proxy_connect_socks5_account(void *handle,
PurpleAccount *account, PurpleProxyInfo *gpi,
const char *host, int port,
PurpleProxyConnectFunction connect_cb, gpointer data);
#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PROXY_C_)
PurpleProxyConnectData *purple_proxy_connect_socks5(void *handle,
PurpleProxyInfo *gpi,
const char *host, int port,
PurpleProxyConnectFunction connect_cb, gpointer data);
#endif
void purple_proxy_connect_cancel(PurpleProxyConnectData *connect_data);
/*
* Closes all proxy connections registered with the specified handle.
*
* @param handle The handle.
*/
void purple_proxy_connect_cancel_with_handle(void *handle);
#ifdef __cplusplus
}
#endif
#endif /* _PURPLE_PROXY_H_ */
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.
purple_proxy_connect_cancel
void purple_proxy_connect_cancel(PurpleProxyConnectData *connect_data)
Cancel an in-progress connection attempt.
purple_proxy_info_set_host
void purple_proxy_info_set_host(PurpleProxyInfo *info, const char *host)
Sets the proxy host.
purple_proxy_info_destroy
void purple_proxy_info_destroy(PurpleProxyInfo *info)
Destroys a proxy information structure.
eventloop.h
Purple Event Loop API.
purple_proxy_info_new
PurpleProxyInfo * purple_proxy_info_new(void)
Creates a proxy information structure.
purple_proxy_info_set_username
void purple_proxy_info_set_username(PurpleProxyInfo *info, const char *username)
Sets the proxy username.
PurpleProxyInfo::password
char * password
The password.
Definition: proxy.h:57
_PurpleAccount
Structure representing an account.
Definition: account.h:126
purple_proxy_info_get_host
const char * purple_proxy_info_get_host(const PurpleProxyInfo *info)
Returns the proxy&#39;s host.
PURPLE_PROXY_USE_GLOBAL
Use the global proxy information.
Definition: proxy.h:37
PurpleProxyInfo::username
char * username
The username.
Definition: proxy.h:56
PURPLE_PROXY_HTTP
HTTP proxy.
Definition: proxy.h:39
purple_global_proxy_set_info
void purple_global_proxy_set_info(PurpleProxyInfo *info)
Set purple&#39;s global proxy information.
PURPLE_PROXY_SOCKS4
SOCKS 4 proxy.
Definition: proxy.h:40
purple_proxy_info_set_type
void purple_proxy_info_set_type(PurpleProxyInfo *info, PurpleProxyType type)
Sets the type of proxy.
purple_proxy_info_get_port
int purple_proxy_info_get_port(const PurpleProxyInfo *info)
Returns the proxy&#39;s port.
PURPLE_PROXY_USE_ENVVAR
Use environmental settings.
Definition: proxy.h:42
purple_global_proxy_get_info
PurpleProxyInfo * purple_global_proxy_get_info(void)
Returns purple&#39;s global proxy information.
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.
purple_proxy_uninit
void purple_proxy_uninit(void)
Uninitializes the proxy subsystem.
PURPLE_PROXY_TOR
Use a Tor proxy (SOCKS 5 really)
Definition: proxy.h:43
purple_proxy_info_get_username
const char * purple_proxy_info_get_username(const PurpleProxyInfo *info)
Returns the proxy&#39;s username.
PURPLE_PROXY_SOCKS5
SOCKS 5 proxy.
Definition: proxy.h:41
PurpleProxyInfo::type
PurpleProxyType type
The proxy type.
Definition: proxy.h:52
account.h
Account API.
PurpleProxyInfo::host
char * host
The host.
Definition: proxy.h:54
purple_proxy_get_handle
void * purple_proxy_get_handle(void)
Returns the proxy subsystem handle.
PURPLE_PROXY_NONE
No proxy.
Definition: proxy.h:38
purple_proxy_init
void purple_proxy_init(void)
Initializes the proxy subsystem.
PurpleProxyInfo::port
int port
The port number.
Definition: proxy.h:55
purple_proxy_info_set_port
void purple_proxy_info_set_port(PurpleProxyInfo *info, int port)
Sets the proxy port.
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.
purple_proxy_info_get_type
PurpleProxyType purple_proxy_info_get_type(const PurpleProxyInfo *info)
Returns the proxy&#39;s type.
purple_proxy_info_get_password
const char * purple_proxy_info_get_password(const PurpleProxyInfo *info)
Returns the proxy&#39;s password.
purple_proxy_get_setup
PurpleProxyInfo * purple_proxy_get_setup(PurpleAccount *account)
Returns configuration of a proxy.
PurpleProxyInfo
Information on proxy settings.
Definition: proxy.h:50
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.
PurpleProxyType
PurpleProxyType
A type of proxy connection.
Definition: proxy.h:35
purple_proxy_info_set_password
void purple_proxy_info_set_password(PurpleProxyInfo *info, const char *password)
Sets the proxy password.