comparison libpurple/proxy.h @ 15822:32c366eeeb99

sed -ie 's/gaim/purple/g'
author Sean Egan <seanegan@gmail.com>
date Mon, 19 Mar 2007 07:01:17 +0000
parents 5fe8042783c1
children 36b09c6f7957
comparison
equal deleted inserted replaced
15821:84b0f9b23ede 15822:32c366eeeb99
1 /** 1 /**
2 * @file proxy.h Proxy API 2 * @file proxy.h Proxy API
3 * @ingroup core 3 * @ingroup core
4 * 4 *
5 * gaim 5 * purple
6 * 6 *
7 * Gaim is the legal property of its developers, whose names are too numerous 7 * Purple is the legal property of its developers, whose names are too numerous
8 * to list here. Please refer to the COPYRIGHT file distributed with this 8 * to list here. Please refer to the COPYRIGHT file distributed with this
9 * source distribution. 9 * source distribution.
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by 12 * it under the terms of the GNU General Public License as published by
20 * 20 *
21 * You should have received a copy of the GNU General Public License 21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software 22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */ 24 */
25 #ifndef _GAIM_PROXY_H_ 25 #ifndef _PURPLE_PROXY_H_
26 #define _GAIM_PROXY_H_ 26 #define _PURPLE_PROXY_H_
27 27
28 #include <glib.h> 28 #include <glib.h>
29 #include "eventloop.h" 29 #include "eventloop.h"
30 30
31 /** 31 /**
32 * A type of proxy connection. 32 * A type of proxy connection.
33 */ 33 */
34 typedef enum 34 typedef enum
35 { 35 {
36 GAIM_PROXY_USE_GLOBAL = -1, /**< Use the global proxy information. */ 36 PURPLE_PROXY_USE_GLOBAL = -1, /**< Use the global proxy information. */
37 GAIM_PROXY_NONE = 0, /**< No proxy. */ 37 PURPLE_PROXY_NONE = 0, /**< No proxy. */
38 GAIM_PROXY_HTTP, /**< HTTP proxy. */ 38 PURPLE_PROXY_HTTP, /**< HTTP proxy. */
39 GAIM_PROXY_SOCKS4, /**< SOCKS 4 proxy. */ 39 PURPLE_PROXY_SOCKS4, /**< SOCKS 4 proxy. */
40 GAIM_PROXY_SOCKS5, /**< SOCKS 5 proxy. */ 40 PURPLE_PROXY_SOCKS5, /**< SOCKS 5 proxy. */
41 GAIM_PROXY_USE_ENVVAR /**< Use environmental settings. */ 41 PURPLE_PROXY_USE_ENVVAR /**< Use environmental settings. */
42 42
43 } GaimProxyType; 43 } PurpleProxyType;
44 44
45 /** 45 /**
46 * Information on proxy settings. 46 * Information on proxy settings.
47 */ 47 */
48 typedef struct 48 typedef struct
49 { 49 {
50 GaimProxyType type; /**< The proxy type. */ 50 PurpleProxyType type; /**< The proxy type. */
51 51
52 char *host; /**< The host. */ 52 char *host; /**< The host. */
53 int port; /**< The port number. */ 53 int port; /**< The port number. */
54 char *username; /**< The username. */ 54 char *username; /**< The username. */
55 char *password; /**< The password. */ 55 char *password; /**< The password. */
56 56
57 } GaimProxyInfo; 57 } PurpleProxyInfo;
58 58
59 typedef struct _GaimProxyConnectData GaimProxyConnectData; 59 typedef struct _PurpleProxyConnectData PurpleProxyConnectData;
60 60
61 typedef void (*GaimProxyConnectFunction)(gpointer data, gint source, const gchar *error_message); 61 typedef void (*PurpleProxyConnectFunction)(gpointer data, gint source, const gchar *error_message);
62 62
63 63
64 #include "account.h" 64 #include "account.h"
65 65
66 #ifdef __cplusplus 66 #ifdef __cplusplus
75 /** 75 /**
76 * Creates a proxy information structure. 76 * Creates a proxy information structure.
77 * 77 *
78 * @return The proxy information structure. 78 * @return The proxy information structure.
79 */ 79 */
80 GaimProxyInfo *gaim_proxy_info_new(void); 80 PurpleProxyInfo *purple_proxy_info_new(void);
81 81
82 /** 82 /**
83 * Destroys a proxy information structure. 83 * Destroys a proxy information structure.
84 * 84 *
85 * @param info The proxy information structure to destroy. 85 * @param info The proxy information structure to destroy.
86 */ 86 */
87 void gaim_proxy_info_destroy(GaimProxyInfo *info); 87 void purple_proxy_info_destroy(PurpleProxyInfo *info);
88 88
89 /** 89 /**
90 * Sets the type of proxy. 90 * Sets the type of proxy.
91 * 91 *
92 * @param info The proxy information. 92 * @param info The proxy information.
93 * @param type The proxy type. 93 * @param type The proxy type.
94 */ 94 */
95 void gaim_proxy_info_set_type(GaimProxyInfo *info, GaimProxyType type); 95 void purple_proxy_info_set_type(PurpleProxyInfo *info, PurpleProxyType type);
96 96
97 /** 97 /**
98 * Sets the proxy host. 98 * Sets the proxy host.
99 * 99 *
100 * @param info The proxy information. 100 * @param info The proxy information.
101 * @param host The host. 101 * @param host The host.
102 */ 102 */
103 void gaim_proxy_info_set_host(GaimProxyInfo *info, const char *host); 103 void purple_proxy_info_set_host(PurpleProxyInfo *info, const char *host);
104 104
105 /** 105 /**
106 * Sets the proxy port. 106 * Sets the proxy port.
107 * 107 *
108 * @param info The proxy information. 108 * @param info The proxy information.
109 * @param port The port. 109 * @param port The port.
110 */ 110 */
111 void gaim_proxy_info_set_port(GaimProxyInfo *info, int port); 111 void purple_proxy_info_set_port(PurpleProxyInfo *info, int port);
112 112
113 /** 113 /**
114 * Sets the proxy username. 114 * Sets the proxy username.
115 * 115 *
116 * @param info The proxy information. 116 * @param info The proxy information.
117 * @param username The username. 117 * @param username The username.
118 */ 118 */
119 void gaim_proxy_info_set_username(GaimProxyInfo *info, const char *username); 119 void purple_proxy_info_set_username(PurpleProxyInfo *info, const char *username);
120 120
121 /** 121 /**
122 * Sets the proxy password. 122 * Sets the proxy password.
123 * 123 *
124 * @param info The proxy information. 124 * @param info The proxy information.
125 * @param password The password. 125 * @param password The password.
126 */ 126 */
127 void gaim_proxy_info_set_password(GaimProxyInfo *info, const char *password); 127 void purple_proxy_info_set_password(PurpleProxyInfo *info, const char *password);
128 128
129 /** 129 /**
130 * Returns the proxy's type. 130 * Returns the proxy's type.
131 * 131 *
132 * @param info The proxy information. 132 * @param info The proxy information.
133 * 133 *
134 * @return The type. 134 * @return The type.
135 */ 135 */
136 GaimProxyType gaim_proxy_info_get_type(const GaimProxyInfo *info); 136 PurpleProxyType purple_proxy_info_get_type(const PurpleProxyInfo *info);
137 137
138 /** 138 /**
139 * Returns the proxy's host. 139 * Returns the proxy's host.
140 * 140 *
141 * @param info The proxy information. 141 * @param info The proxy information.
142 * 142 *
143 * @return The host. 143 * @return The host.
144 */ 144 */
145 const char *gaim_proxy_info_get_host(const GaimProxyInfo *info); 145 const char *purple_proxy_info_get_host(const PurpleProxyInfo *info);
146 146
147 /** 147 /**
148 * Returns the proxy's port. 148 * Returns the proxy's port.
149 * 149 *
150 * @param info The proxy information. 150 * @param info The proxy information.
151 * 151 *
152 * @return The port. 152 * @return The port.
153 */ 153 */
154 int gaim_proxy_info_get_port(const GaimProxyInfo *info); 154 int purple_proxy_info_get_port(const PurpleProxyInfo *info);
155 155
156 /** 156 /**
157 * Returns the proxy's username. 157 * Returns the proxy's username.
158 * 158 *
159 * @param info The proxy information. 159 * @param info The proxy information.
160 * 160 *
161 * @return The username. 161 * @return The username.
162 */ 162 */
163 const char *gaim_proxy_info_get_username(const GaimProxyInfo *info); 163 const char *purple_proxy_info_get_username(const PurpleProxyInfo *info);
164 164
165 /** 165 /**
166 * Returns the proxy's password. 166 * Returns the proxy's password.
167 * 167 *
168 * @param info The proxy information. 168 * @param info The proxy information.
169 * 169 *
170 * @return The password. 170 * @return The password.
171 */ 171 */
172 const char *gaim_proxy_info_get_password(const GaimProxyInfo *info); 172 const char *purple_proxy_info_get_password(const PurpleProxyInfo *info);
173 173
174 /*@}*/ 174 /*@}*/
175 175
176 /**************************************************************************/ 176 /**************************************************************************/
177 /** @name Global Proxy API */ 177 /** @name Global Proxy API */
178 /**************************************************************************/ 178 /**************************************************************************/
179 /*@{*/ 179 /*@{*/
180 180
181 /** 181 /**
182 * Returns gaim's global proxy information. 182 * Returns purple's global proxy information.
183 * 183 *
184 * @return The global proxy information. 184 * @return The global proxy information.
185 */ 185 */
186 GaimProxyInfo *gaim_global_proxy_get_info(void); 186 PurpleProxyInfo *purple_global_proxy_get_info(void);
187 187
188 /*@}*/ 188 /*@}*/
189 189
190 /**************************************************************************/ 190 /**************************************************************************/
191 /** @name Proxy API */ 191 /** @name Proxy API */
195 /** 195 /**
196 * Returns the proxy subsystem handle. 196 * Returns the proxy subsystem handle.
197 * 197 *
198 * @return The proxy subsystem handle. 198 * @return The proxy subsystem handle.
199 */ 199 */
200 void *gaim_proxy_get_handle(void); 200 void *purple_proxy_get_handle(void);
201 201
202 /** 202 /**
203 * Initializes the proxy subsystem. 203 * Initializes the proxy subsystem.
204 */ 204 */
205 void gaim_proxy_init(void); 205 void purple_proxy_init(void);
206 206
207 /** 207 /**
208 * Uninitializes the proxy subsystem. 208 * Uninitializes the proxy subsystem.
209 */ 209 */
210 void gaim_proxy_uninit(void); 210 void purple_proxy_uninit(void);
211 211
212 /** 212 /**
213 * Returns configuration of a proxy. 213 * Returns configuration of a proxy.
214 * 214 *
215 * @param account The account for which the configuration is needed. 215 * @param account The account for which the configuration is needed.
216 * 216 *
217 * @return The configuration of a proxy. 217 * @return The configuration of a proxy.
218 */ 218 */
219 GaimProxyInfo *gaim_proxy_get_setup(GaimAccount *account); 219 PurpleProxyInfo *purple_proxy_get_setup(PurpleAccount *account);
220 220
221 /** 221 /**
222 * Makes a connection to the specified host and port. Note that this 222 * Makes a connection to the specified host and port. Note that this
223 * function name can be misleading--although it is called "proxy 223 * function name can be misleading--although it is called "proxy
224 * connect," it is used for establishing any outgoing TCP connection, 224 * connect," it is used for establishing any outgoing TCP connection,
225 * whether through a proxy or not. 225 * whether through a proxy or not.
226 * 226 *
227 * @param handle A handle that should be associated with this 227 * @param handle A handle that should be associated with this
228 * connection attempt. The handle can be used 228 * connection attempt. The handle can be used
229 * to cancel the connection attempt using the 229 * to cancel the connection attempt using the
230 * gaim_proxy_connect_cancel_with_handle() 230 * purple_proxy_connect_cancel_with_handle()
231 * function. 231 * function.
232 * @param account The account making the connection. 232 * @param account The account making the connection.
233 * @param host The destination host. 233 * @param host The destination host.
234 * @param port The destination port. 234 * @param port The destination port.
235 * @param connect_cb The function to call when the connection is 235 * @param connect_cb The function to call when the connection is
240 * 240 *
241 * @return NULL if there was an error, or a reference to a data 241 * @return NULL if there was an error, or a reference to a data
242 * structure that can be used to cancel the pending 242 * structure that can be used to cancel the pending
243 * connection, if needed. 243 * connection, if needed.
244 */ 244 */
245 GaimProxyConnectData *gaim_proxy_connect(void *handle, 245 PurpleProxyConnectData *purple_proxy_connect(void *handle,
246 GaimAccount *account, 246 PurpleAccount *account,
247 const char *host, int port, 247 const char *host, int port,
248 GaimProxyConnectFunction connect_cb, gpointer data); 248 PurpleProxyConnectFunction connect_cb, gpointer data);
249 249
250 /** 250 /**
251 * Makes a connection through a SOCKS5 proxy. 251 * Makes a connection through a SOCKS5 proxy.
252 * 252 *
253 * @param gpi The GaimProxyInfo specifying the proxy settings 253 * @param gpi The PurpleProxyInfo specifying the proxy settings
254 * @param host The destination host. 254 * @param host The destination host.
255 * @param port The destination port. 255 * @param port The destination port.
256 * @param connect_cb The function to call when the connection is 256 * @param connect_cb The function to call when the connection is
257 * established. If the connection failed then 257 * established. If the connection failed then
258 * fd will be -1 and error message will be set 258 * fd will be -1 and error message will be set
261 * 261 *
262 * @return NULL if there was an error, or a reference to a data 262 * @return NULL if there was an error, or a reference to a data
263 * structure that can be used to cancel the pending 263 * structure that can be used to cancel the pending
264 * connection, if needed. 264 * connection, if needed.
265 */ 265 */
266 GaimProxyConnectData *gaim_proxy_connect_socks5(void *handle, 266 PurpleProxyConnectData *purple_proxy_connect_socks5(void *handle,
267 GaimProxyInfo *gpi, 267 PurpleProxyInfo *gpi,
268 const char *host, int port, 268 const char *host, int port,
269 GaimProxyConnectFunction connect_cb, gpointer data); 269 PurpleProxyConnectFunction connect_cb, gpointer data);
270 270
271 /** 271 /**
272 * Cancel an in-progress connection attempt. This should be called 272 * Cancel an in-progress connection attempt. This should be called
273 * by the PRPL if the user disables an account while it is still 273 * by the PRPL if the user disables an account while it is still
274 * performing the initial sign on. Or when establishing a file 274 * performing the initial sign on. Or when establishing a file
275 * transfer, if we attempt to connect to a remote user but they 275 * transfer, if we attempt to connect to a remote user but they
276 * are behind a firewall then the PRPL can cancel the connection 276 * are behind a firewall then the PRPL can cancel the connection
277 * attempt early rather than just letting the OS's TCP/IP stack 277 * attempt early rather than just letting the OS's TCP/IP stack
278 * time-out the connection. 278 * time-out the connection.
279 */ 279 */
280 void gaim_proxy_connect_cancel(GaimProxyConnectData *connect_data); 280 void purple_proxy_connect_cancel(PurpleProxyConnectData *connect_data);
281 281
282 /* 282 /*
283 * Closes all proxy connections registered with the specified handle. 283 * Closes all proxy connections registered with the specified handle.
284 * 284 *
285 * @param handle The handle. 285 * @param handle The handle.
286 */ 286 */
287 void gaim_proxy_connect_cancel_with_handle(void *handle); 287 void purple_proxy_connect_cancel_with_handle(void *handle);
288 288
289 /*@}*/ 289 /*@}*/
290 290
291 #ifdef __cplusplus 291 #ifdef __cplusplus
292 } 292 }
293 #endif 293 #endif
294 294
295 #endif /* _GAIM_PROXY_H_ */ 295 #endif /* _PURPLE_PROXY_H_ */