proxy.h

Go to the documentation of this file.
00001 
00006 /* purple
00007  *
00008  * Purple is the legal property of its developers, whose names are too numerous
00009  * to list here.  Please refer to the COPYRIGHT file distributed with this
00010  * source distribution.
00011  *
00012  * This program is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU General Public License as published by
00014  * the Free Software Foundation; either version 2 of the License, or
00015  * (at your option) any later version.
00016  *
00017  * This program is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program; if not, write to the Free Software
00024  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
00025  */
00026 #ifndef _PURPLE_PROXY_H_
00027 #define _PURPLE_PROXY_H_
00028 
00029 #include <glib.h>
00030 #include "eventloop.h"
00031 
00035 typedef enum
00036 {
00037     PURPLE_PROXY_USE_GLOBAL = -1,  
00038     PURPLE_PROXY_NONE = 0,         
00039     PURPLE_PROXY_HTTP,             
00040     PURPLE_PROXY_SOCKS4,           
00041     PURPLE_PROXY_SOCKS5,           
00042     PURPLE_PROXY_USE_ENVVAR,       
00043     PURPLE_PROXY_TOR               
00045 } PurpleProxyType;
00046 
00050 typedef struct
00051 {
00052     PurpleProxyType type;   
00054     char *host;           
00055     int   port;           
00056     char *username;       
00057     char *password;       
00059 } PurpleProxyInfo;
00060 
00061 typedef struct _PurpleProxyConnectData PurpleProxyConnectData;
00062 
00063 typedef void (*PurpleProxyConnectFunction)(gpointer data, gint source, const gchar *error_message);
00064 
00065 
00066 #include "account.h"
00067 
00068 #ifdef __cplusplus
00069 extern "C" {
00070 #endif
00071 
00072 /**************************************************************************/
00074 /**************************************************************************/
00082 PurpleProxyInfo *purple_proxy_info_new(void);
00083 
00089 void purple_proxy_info_destroy(PurpleProxyInfo *info);
00090 
00097 void purple_proxy_info_set_type(PurpleProxyInfo *info, PurpleProxyType type);
00098 
00105 void purple_proxy_info_set_host(PurpleProxyInfo *info, const char *host);
00106 
00113 void purple_proxy_info_set_port(PurpleProxyInfo *info, int port);
00114 
00121 void purple_proxy_info_set_username(PurpleProxyInfo *info, const char *username);
00122 
00129 void purple_proxy_info_set_password(PurpleProxyInfo *info, const char *password);
00130 
00138 PurpleProxyType purple_proxy_info_get_type(const PurpleProxyInfo *info);
00139 
00147 const char *purple_proxy_info_get_host(const PurpleProxyInfo *info);
00148 
00156 int purple_proxy_info_get_port(const PurpleProxyInfo *info);
00157 
00165 const char *purple_proxy_info_get_username(const PurpleProxyInfo *info);
00166 
00174 const char *purple_proxy_info_get_password(const PurpleProxyInfo *info);
00175 
00178 /**************************************************************************/
00180 /**************************************************************************/
00188 PurpleProxyInfo *purple_global_proxy_get_info(void);
00189 
00196 void purple_global_proxy_set_info(PurpleProxyInfo *info);
00197 
00200 /**************************************************************************/
00202 /**************************************************************************/
00210 void *purple_proxy_get_handle(void);
00211 
00215 void purple_proxy_init(void);
00216 
00220 void purple_proxy_uninit(void);
00221 
00229 PurpleProxyInfo *purple_proxy_get_setup(PurpleAccount *account);
00230 
00255 PurpleProxyConnectData *purple_proxy_connect(void *handle,
00256             PurpleAccount *account,
00257             const char *host, int port,
00258             PurpleProxyConnectFunction connect_cb, gpointer data);
00259 
00284 PurpleProxyConnectData *purple_proxy_connect_udp(void *handle,
00285             PurpleAccount *account,
00286             const char *host, int port,
00287             PurpleProxyConnectFunction connect_cb, gpointer data);
00288 
00314 PurpleProxyConnectData *purple_proxy_connect_socks5_account(void *handle,
00315             PurpleAccount *account, PurpleProxyInfo *gpi,
00316             const char *host, int port,
00317             PurpleProxyConnectFunction connect_cb, gpointer data);
00318 
00319 #if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_PROXY_C_)
00320 
00342 PurpleProxyConnectData *purple_proxy_connect_socks5(void *handle,
00343             PurpleProxyInfo *gpi,
00344             const char *host, int port,
00345             PurpleProxyConnectFunction connect_cb, gpointer data);
00346 #endif
00347 
00357 void purple_proxy_connect_cancel(PurpleProxyConnectData *connect_data);
00358 
00359 /*
00360  * Closes all proxy connections registered with the specified handle.
00361  *
00362  * @param handle The handle.
00363  */
00364 void purple_proxy_connect_cancel_with_handle(void *handle);
00365 
00368 #ifdef __cplusplus
00369 }
00370 #endif
00371 
00372 #endif /* _PURPLE_PROXY_H_ */