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 {
46 
50 typedef struct
51 {
54  char *host;
55  int port;
56  char *username;
57  char *password;
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 /**************************************************************************/
83 
90 
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 
139 
147 const char *purple_proxy_info_get_host(const PurpleProxyInfo *info);
148 
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 /**************************************************************************/
189 
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 
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_ */