proxy.h

Go to the documentation of this file.
00001 
00025 #ifndef _PURPLE_PROXY_H_
00026 #define _PURPLE_PROXY_H_
00027 
00028 #include <glib.h>
00029 #include "eventloop.h"
00030 
00034 typedef enum
00035 {
00036     PURPLE_PROXY_USE_GLOBAL = -1,  
00037     PURPLE_PROXY_NONE = 0,         
00038     PURPLE_PROXY_HTTP,             
00039     PURPLE_PROXY_SOCKS4,           
00040     PURPLE_PROXY_SOCKS5,           
00041     PURPLE_PROXY_USE_ENVVAR        
00043 } PurpleProxyType;
00044 
00048 typedef struct
00049 {
00050     PurpleProxyType type;   
00052     char *host;           
00053     int   port;           
00054     char *username;       
00055     char *password;       
00057 } PurpleProxyInfo;
00058 
00059 typedef struct _PurpleProxyConnectData PurpleProxyConnectData;
00060 
00061 typedef void (*PurpleProxyConnectFunction)(gpointer data, gint source, const gchar *error_message);
00062 
00063 
00064 #include "account.h"
00065 
00066 #ifdef __cplusplus
00067 extern "C" {
00068 #endif
00069 
00070 /**************************************************************************/
00072 /**************************************************************************/
00080 PurpleProxyInfo *purple_proxy_info_new(void);
00081 
00087 void purple_proxy_info_destroy(PurpleProxyInfo *info);
00088 
00095 void purple_proxy_info_set_type(PurpleProxyInfo *info, PurpleProxyType type);
00096 
00103 void purple_proxy_info_set_host(PurpleProxyInfo *info, const char *host);
00104 
00111 void purple_proxy_info_set_port(PurpleProxyInfo *info, int port);
00112 
00119 void purple_proxy_info_set_username(PurpleProxyInfo *info, const char *username);
00120 
00127 void purple_proxy_info_set_password(PurpleProxyInfo *info, const char *password);
00128 
00136 PurpleProxyType purple_proxy_info_get_type(const PurpleProxyInfo *info);
00137 
00145 const char *purple_proxy_info_get_host(const PurpleProxyInfo *info);
00146 
00154 int purple_proxy_info_get_port(const PurpleProxyInfo *info);
00155 
00163 const char *purple_proxy_info_get_username(const PurpleProxyInfo *info);
00164 
00172 const char *purple_proxy_info_get_password(const PurpleProxyInfo *info);
00173 
00176 /**************************************************************************/
00178 /**************************************************************************/
00186 PurpleProxyInfo *purple_global_proxy_get_info(void);
00187 
00190 /**************************************************************************/
00192 /**************************************************************************/
00200 void *purple_proxy_get_handle(void);
00201 
00205 void purple_proxy_init(void);
00206 
00210 void purple_proxy_uninit(void);
00211 
00219 PurpleProxyInfo *purple_proxy_get_setup(PurpleAccount *account);
00220 
00245 PurpleProxyConnectData *purple_proxy_connect(void *handle,
00246             PurpleAccount *account,
00247             const char *host, int port,
00248             PurpleProxyConnectFunction connect_cb, gpointer data);
00249 
00271 PurpleProxyConnectData *purple_proxy_connect_socks5(void *handle,
00272             PurpleProxyInfo *gpi,
00273             const char *host, int port,
00274             PurpleProxyConnectFunction connect_cb, gpointer data);
00275 
00285 void purple_proxy_connect_cancel(PurpleProxyConnectData *connect_data);
00286 
00287 /*
00288  * Closes all proxy connections registered with the specified handle.
00289  *
00290  * @param handle The handle.
00291  */
00292 void purple_proxy_connect_cancel_with_handle(void *handle);
00293 
00296 #ifdef __cplusplus
00297 }
00298 #endif
00299 
00300 #endif /* _PURPLE_PROXY_H_ */