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        
00044 } PurpleProxyType;
00045 
00049 typedef struct
00050 {
00051     PurpleProxyType type;   
00053     char *host;           
00054     int   port;           
00055     char *username;       
00056     char *password;       
00058 } PurpleProxyInfo;
00059 
00060 typedef struct _PurpleProxyConnectData PurpleProxyConnectData;
00061 
00062 typedef void (*PurpleProxyConnectFunction)(gpointer data, gint source, const gchar *error_message);
00063 
00064 
00065 #include "account.h"
00066 
00067 #ifdef __cplusplus
00068 extern "C" {
00069 #endif
00070 
00071 /**************************************************************************/
00073 /**************************************************************************/
00081 PurpleProxyInfo *purple_proxy_info_new(void);
00082 
00088 void purple_proxy_info_destroy(PurpleProxyInfo *info);
00089 
00096 void purple_proxy_info_set_type(PurpleProxyInfo *info, PurpleProxyType type);
00097 
00104 void purple_proxy_info_set_host(PurpleProxyInfo *info, const char *host);
00105 
00112 void purple_proxy_info_set_port(PurpleProxyInfo *info, int port);
00113 
00120 void purple_proxy_info_set_username(PurpleProxyInfo *info, const char *username);
00121 
00128 void purple_proxy_info_set_password(PurpleProxyInfo *info, const char *password);
00129 
00137 PurpleProxyType purple_proxy_info_get_type(const PurpleProxyInfo *info);
00138 
00146 const char *purple_proxy_info_get_host(const PurpleProxyInfo *info);
00147 
00155 int purple_proxy_info_get_port(const PurpleProxyInfo *info);
00156 
00164 const char *purple_proxy_info_get_username(const PurpleProxyInfo *info);
00165 
00173 const char *purple_proxy_info_get_password(const PurpleProxyInfo *info);
00174 
00177 /**************************************************************************/
00179 /**************************************************************************/
00187 PurpleProxyInfo *purple_global_proxy_get_info(void);
00188 
00191 /**************************************************************************/
00193 /**************************************************************************/
00201 void *purple_proxy_get_handle(void);
00202 
00206 void purple_proxy_init(void);
00207 
00211 void purple_proxy_uninit(void);
00212 
00220 PurpleProxyInfo *purple_proxy_get_setup(PurpleAccount *account);
00221 
00246 PurpleProxyConnectData *purple_proxy_connect(void *handle,
00247             PurpleAccount *account,
00248             const char *host, int port,
00249             PurpleProxyConnectFunction connect_cb, gpointer data);
00250 
00272 PurpleProxyConnectData *purple_proxy_connect_socks5(void *handle,
00273             PurpleProxyInfo *gpi,
00274             const char *host, int port,
00275             PurpleProxyConnectFunction connect_cb, gpointer data);
00276 
00286 void purple_proxy_connect_cancel(PurpleProxyConnectData *connect_data);
00287 
00288 /*
00289  * Closes all proxy connections registered with the specified handle.
00290  *
00291  * @param handle The handle.
00292  */
00293 void purple_proxy_connect_cancel_with_handle(void *handle);
00294 
00297 #ifdef __cplusplus
00298 }
00299 #endif
00300 
00301 #endif /* _PURPLE_PROXY_H_ */