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 
00195 void purple_global_proxy_set_info(PurpleProxyInfo *info);
00196 
00199 /**************************************************************************/
00201 /**************************************************************************/
00209 void *purple_proxy_get_handle(void);
00210 
00214 void purple_proxy_init(void);
00215 
00219 void purple_proxy_uninit(void);
00220 
00228 PurpleProxyInfo *purple_proxy_get_setup(PurpleAccount *account);
00229 
00254 PurpleProxyConnectData *purple_proxy_connect(void *handle,
00255             PurpleAccount *account,
00256             const char *host, int port,
00257             PurpleProxyConnectFunction connect_cb, gpointer data);
00258 
00283 PurpleProxyConnectData *purple_proxy_connect_udp(void *handle,
00284             PurpleAccount *account,
00285             const char *host, int port,
00286             PurpleProxyConnectFunction connect_cb, gpointer data);
00287 
00309 PurpleProxyConnectData *purple_proxy_connect_socks5(void *handle,
00310             PurpleProxyInfo *gpi,
00311             const char *host, int port,
00312             PurpleProxyConnectFunction connect_cb, gpointer data);
00313 
00323 void purple_proxy_connect_cancel(PurpleProxyConnectData *connect_data);
00324 
00325 /*
00326  * Closes all proxy connections registered with the specified handle.
00327  *
00328  * @param handle The handle.
00329  */
00330 void purple_proxy_connect_cancel_with_handle(void *handle);
00331 
00334 #ifdef __cplusplus
00335 }
00336 #endif
00337 
00338 #endif /* _PURPLE_PROXY_H_ */