proxy.h
Go to the documentation of this file.
1
6 /* purple
7 *
8 * Purple is the legal property of its developers, whose names are too numerous
9 * to list here. Please refer to the COPYRIGHT file distributed with this
10 * source distribution.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
25 */
26 #ifndef _PURPLE_PROXY_H_
27 #define _PURPLE_PROXY_H_
28
29 #include <glib.h>
30 #include "eventloop.h"
31
35 typedef enum
36 {
37 PURPLE_PROXY_USE_GLOBAL = -1,
38 PURPLE_PROXY_NONE = 0,
39 PURPLE_PROXY_HTTP,
40 PURPLE_PROXY_SOCKS4,
41 PURPLE_PROXY_SOCKS5,
42 PURPLE_PROXY_USE_ENVVAR,
43 PURPLE_PROXY_TOR
45 } PurpleProxyType;
46
50 typedef struct
51 {
52 PurpleProxyType type;
54 char *host;
55 int port;
56 char *username;
57 char *password;
59 } PurpleProxyInfo;
60
61 typedef struct _PurpleProxyConnectData PurpleProxyConnectData;
62
63 typedef void (*PurpleProxyConnectFunction)(gpointer data, gint source, const gchar *error_message);
64
65
66 #include "account.h"
67
68 #ifdef __cplusplus
69 extern "C" {
70 #endif
71
72 /**************************************************************************/
74 /**************************************************************************/
82 PurpleProxyInfo *purple_proxy_info_new(void);
83
89 void purple_proxy_info_destroy(PurpleProxyInfo *info);
90
97 void purple_proxy_info_set_type(PurpleProxyInfo *info, PurpleProxyType type);
98
105 void purple_proxy_info_set_host(PurpleProxyInfo *info, const char *host);
106
113 void purple_proxy_info_set_port(PurpleProxyInfo *info, int port);
114
121 void purple_proxy_info_set_username(PurpleProxyInfo *info, const char *username);
122
129 void purple_proxy_info_set_password(PurpleProxyInfo *info, const char *password);
130
138 PurpleProxyType purple_proxy_info_get_type(const PurpleProxyInfo *info);
139
147 const char *purple_proxy_info_get_host(const PurpleProxyInfo *info);
148
156 int purple_proxy_info_get_port(const PurpleProxyInfo *info);
157
165 const char *purple_proxy_info_get_username(const PurpleProxyInfo *info);
166
174 const char *purple_proxy_info_get_password(const PurpleProxyInfo *info);
175
178 /**************************************************************************/
180 /**************************************************************************/
188 PurpleProxyInfo *purple_global_proxy_get_info(void);
189
196 void purple_global_proxy_set_info(PurpleProxyInfo *info);
197
200 /**************************************************************************/
202 /**************************************************************************/
210 void *purple_proxy_get_handle(void);
211
215 void purple_proxy_init(void);
216
220 void purple_proxy_uninit(void);
221
229 PurpleProxyInfo *purple_proxy_get_setup(PurpleAccount *account);
230
255 PurpleProxyConnectData *purple_proxy_connect(void *handle,
256 PurpleAccount *account,
257 const char *host, int port,
258 PurpleProxyConnectFunction connect_cb, gpointer data);
259
284 PurpleProxyConnectData *purple_proxy_connect_udp(void *handle,
285 PurpleAccount *account,
286 const char *host, int port,
287 PurpleProxyConnectFunction connect_cb, gpointer data);
288
314 PurpleProxyConnectData *purple_proxy_connect_socks5_account(void *handle,
315 PurpleAccount *account, PurpleProxyInfo *gpi,
316 const char *host, int port,
317 PurpleProxyConnectFunction connect_cb, gpointer data);
318
319 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PROXY_C_)
320
342 PurpleProxyConnectData *purple_proxy_connect_socks5(void *handle,
343 PurpleProxyInfo *gpi,
344 const char *host, int port,
345 PurpleProxyConnectFunction connect_cb, gpointer data);
346 #endif
347
357 void purple_proxy_connect_cancel(PurpleProxyConnectData *connect_data);
358
359 /*
360 * Closes all proxy connections registered with the specified handle.
361 *
362 * @param handle The handle.
363 */
364 void purple_proxy_connect_cancel_with_handle(void *handle);
365
368 #ifdef __cplusplus
369 }
370 #endif
371
372 #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:169
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.