Mercurial > pidgin.yaz
comparison libpurple/sslconn.h @ 15823: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 | 516f14bef90e |
comparison
equal
deleted
inserted
replaced
15822:84b0f9b23ede | 15823:32c366eeeb99 |
---|---|
1 /** | 1 /** |
2 * @file sslconn.h SSL API | 2 * @file sslconn.h SSL 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_SSLCONN_H_ | 25 #ifndef _PURPLE_SSLCONN_H_ |
26 #define _GAIM_SSLCONN_H_ | 26 #define _PURPLE_SSLCONN_H_ |
27 | 27 |
28 #include "proxy.h" | 28 #include "proxy.h" |
29 | 29 |
30 #define GAIM_SSL_DEFAULT_PORT 443 | 30 #define PURPLE_SSL_DEFAULT_PORT 443 |
31 | 31 |
32 typedef enum | 32 typedef enum |
33 { | 33 { |
34 GAIM_SSL_HANDSHAKE_FAILED = 1, | 34 PURPLE_SSL_HANDSHAKE_FAILED = 1, |
35 GAIM_SSL_CONNECT_FAILED = 2 | 35 PURPLE_SSL_CONNECT_FAILED = 2 |
36 } GaimSslErrorType; | 36 } PurpleSslErrorType; |
37 | 37 |
38 typedef struct _GaimSslConnection GaimSslConnection; | 38 typedef struct _PurpleSslConnection PurpleSslConnection; |
39 | 39 |
40 typedef void (*GaimSslInputFunction)(gpointer, GaimSslConnection *, | 40 typedef void (*PurpleSslInputFunction)(gpointer, PurpleSslConnection *, |
41 GaimInputCondition); | 41 PurpleInputCondition); |
42 typedef void (*GaimSslErrorFunction)(GaimSslConnection *, GaimSslErrorType, | 42 typedef void (*PurpleSslErrorFunction)(PurpleSslConnection *, PurpleSslErrorType, |
43 gpointer); | 43 gpointer); |
44 | 44 |
45 struct _GaimSslConnection | 45 struct _PurpleSslConnection |
46 { | 46 { |
47 char *host; | 47 char *host; |
48 int port; | 48 int port; |
49 void *connect_cb_data; | 49 void *connect_cb_data; |
50 GaimSslInputFunction connect_cb; | 50 PurpleSslInputFunction connect_cb; |
51 GaimSslErrorFunction error_cb; | 51 PurpleSslErrorFunction error_cb; |
52 void *recv_cb_data; | 52 void *recv_cb_data; |
53 GaimSslInputFunction recv_cb; | 53 PurpleSslInputFunction recv_cb; |
54 | 54 |
55 int fd; | 55 int fd; |
56 int inpa; | 56 int inpa; |
57 GaimProxyConnectData *connect_data; | 57 PurpleProxyConnectData *connect_data; |
58 | 58 |
59 void *private_data; | 59 void *private_data; |
60 }; | 60 }; |
61 | 61 |
62 /** | 62 /** |
66 */ | 66 */ |
67 typedef struct | 67 typedef struct |
68 { | 68 { |
69 gboolean (*init)(void); | 69 gboolean (*init)(void); |
70 void (*uninit)(void); | 70 void (*uninit)(void); |
71 void (*connectfunc)(GaimSslConnection *gsc); | 71 void (*connectfunc)(PurpleSslConnection *gsc); |
72 void (*close)(GaimSslConnection *gsc); | 72 void (*close)(PurpleSslConnection *gsc); |
73 size_t (*read)(GaimSslConnection *gsc, void *data, size_t len); | 73 size_t (*read)(PurpleSslConnection *gsc, void *data, size_t len); |
74 size_t (*write)(GaimSslConnection *gsc, const void *data, size_t len); | 74 size_t (*write)(PurpleSslConnection *gsc, const void *data, size_t len); |
75 | 75 |
76 } GaimSslOps; | 76 } PurpleSslOps; |
77 | 77 |
78 #ifdef __cplusplus | 78 #ifdef __cplusplus |
79 extern "C" { | 79 extern "C" { |
80 #endif | 80 #endif |
81 | 81 |
87 /** | 87 /** |
88 * Returns whether or not SSL is currently supported. | 88 * Returns whether or not SSL is currently supported. |
89 * | 89 * |
90 * @return TRUE if SSL is supported, or FALSE otherwise. | 90 * @return TRUE if SSL is supported, or FALSE otherwise. |
91 */ | 91 */ |
92 gboolean gaim_ssl_is_supported(void); | 92 gboolean purple_ssl_is_supported(void); |
93 | 93 |
94 /** | 94 /** |
95 * Makes a SSL connection to the specified host and port. The caller | 95 * Makes a SSL connection to the specified host and port. The caller |
96 * should keep track of the returned value and use it to cancel the | 96 * should keep track of the returned value and use it to cancel the |
97 * connection, if needed. | 97 * connection, if needed. |
99 * @param account The account making the connection. | 99 * @param account The account making the connection. |
100 * @param host The destination host. | 100 * @param host The destination host. |
101 * @param port The destination port. | 101 * @param port The destination port. |
102 * @param func The SSL input handler function. | 102 * @param func The SSL input handler function. |
103 * @param error_func The SSL error handler function. This function | 103 * @param error_func The SSL error handler function. This function |
104 * should NOT call gaim_ssl_close(). In the event | 104 * should NOT call purple_ssl_close(). In the event |
105 * of an error the GaimSslConnection will be | 105 * of an error the PurpleSslConnection will be |
106 * destroyed for you. | 106 * destroyed for you. |
107 * @param data User-defined data. | 107 * @param data User-defined data. |
108 * | 108 * |
109 * @return The SSL connection handle. | 109 * @return The SSL connection handle. |
110 */ | 110 */ |
111 GaimSslConnection *gaim_ssl_connect(GaimAccount *account, const char *host, | 111 PurpleSslConnection *purple_ssl_connect(PurpleAccount *account, const char *host, |
112 int port, GaimSslInputFunction func, | 112 int port, PurpleSslInputFunction func, |
113 GaimSslErrorFunction error_func, | 113 PurpleSslErrorFunction error_func, |
114 void *data); | 114 void *data); |
115 | 115 |
116 /** | 116 /** |
117 * Makes a SSL connection using an already open file descriptor. | 117 * Makes a SSL connection using an already open file descriptor. |
118 * | 118 * |
122 * @param error_func The SSL error handler function. | 122 * @param error_func The SSL error handler function. |
123 * @param data User-defined data. | 123 * @param data User-defined data. |
124 * | 124 * |
125 * @return The SSL connection handle. | 125 * @return The SSL connection handle. |
126 */ | 126 */ |
127 GaimSslConnection *gaim_ssl_connect_fd(GaimAccount *account, int fd, | 127 PurpleSslConnection *purple_ssl_connect_fd(PurpleAccount *account, int fd, |
128 GaimSslInputFunction func, | 128 PurpleSslInputFunction func, |
129 GaimSslErrorFunction error_func, | 129 PurpleSslErrorFunction error_func, |
130 void *data); | 130 void *data); |
131 | 131 |
132 /** | 132 /** |
133 * Adds an input watcher for the specified SSL connection. | 133 * Adds an input watcher for the specified SSL connection. |
134 * | 134 * |
135 * @param gsc The SSL connection handle. | 135 * @param gsc The SSL connection handle. |
136 * @param func The callback function. | 136 * @param func The callback function. |
137 * @param data User-defined data. | 137 * @param data User-defined data. |
138 */ | 138 */ |
139 void gaim_ssl_input_add(GaimSslConnection *gsc, GaimSslInputFunction func, | 139 void purple_ssl_input_add(PurpleSslConnection *gsc, PurpleSslInputFunction func, |
140 void *data); | 140 void *data); |
141 | 141 |
142 /** | 142 /** |
143 * Closes a SSL connection. | 143 * Closes a SSL connection. |
144 * | 144 * |
145 * @param gsc The SSL connection to close. | 145 * @param gsc The SSL connection to close. |
146 */ | 146 */ |
147 void gaim_ssl_close(GaimSslConnection *gsc); | 147 void purple_ssl_close(PurpleSslConnection *gsc); |
148 | 148 |
149 /** | 149 /** |
150 * Reads data from an SSL connection. | 150 * Reads data from an SSL connection. |
151 * | 151 * |
152 * @param gsc The SSL connection handle. | 152 * @param gsc The SSL connection handle. |
153 * @param buffer The destination buffer. | 153 * @param buffer The destination buffer. |
154 * @param len The maximum number of bytes to read. | 154 * @param len The maximum number of bytes to read. |
155 * | 155 * |
156 * @return The number of bytes read. | 156 * @return The number of bytes read. |
157 */ | 157 */ |
158 size_t gaim_ssl_read(GaimSslConnection *gsc, void *buffer, size_t len); | 158 size_t purple_ssl_read(PurpleSslConnection *gsc, void *buffer, size_t len); |
159 | 159 |
160 /** | 160 /** |
161 * Writes data to an SSL connection. | 161 * Writes data to an SSL connection. |
162 * | 162 * |
163 * @param gsc The SSL connection handle. | 163 * @param gsc The SSL connection handle. |
164 * @param buffer The buffer to write. | 164 * @param buffer The buffer to write. |
165 * @param len The length of the data to write. | 165 * @param len The length of the data to write. |
166 * | 166 * |
167 * @return The number of bytes written. | 167 * @return The number of bytes written. |
168 */ | 168 */ |
169 size_t gaim_ssl_write(GaimSslConnection *gsc, const void *buffer, size_t len); | 169 size_t purple_ssl_write(PurpleSslConnection *gsc, const void *buffer, size_t len); |
170 | 170 |
171 /*@}*/ | 171 /*@}*/ |
172 | 172 |
173 /**************************************************************************/ | 173 /**************************************************************************/ |
174 /** @name Subsystem API */ | 174 /** @name Subsystem API */ |
178 /** | 178 /** |
179 * Sets the current SSL operations structure. | 179 * Sets the current SSL operations structure. |
180 * | 180 * |
181 * @param ops The SSL operations structure to assign. | 181 * @param ops The SSL operations structure to assign. |
182 */ | 182 */ |
183 void gaim_ssl_set_ops(GaimSslOps *ops); | 183 void purple_ssl_set_ops(PurpleSslOps *ops); |
184 | 184 |
185 /** | 185 /** |
186 * Returns the current SSL operations structure. | 186 * Returns the current SSL operations structure. |
187 * | 187 * |
188 * @return The SSL operations structure. | 188 * @return The SSL operations structure. |
189 */ | 189 */ |
190 GaimSslOps *gaim_ssl_get_ops(void); | 190 PurpleSslOps *purple_ssl_get_ops(void); |
191 | 191 |
192 /** | 192 /** |
193 * Initializes the SSL subsystem. | 193 * Initializes the SSL subsystem. |
194 */ | 194 */ |
195 void gaim_ssl_init(void); | 195 void purple_ssl_init(void); |
196 | 196 |
197 /** | 197 /** |
198 * Uninitializes the SSL subsystem. | 198 * Uninitializes the SSL subsystem. |
199 */ | 199 */ |
200 void gaim_ssl_uninit(void); | 200 void purple_ssl_uninit(void); |
201 | 201 |
202 /*@}*/ | 202 /*@}*/ |
203 | 203 |
204 #ifdef __cplusplus | 204 #ifdef __cplusplus |
205 } | 205 } |
206 #endif | 206 #endif |
207 | 207 |
208 #endif /* _GAIM_SSLCONN_H_ */ | 208 #endif /* _PURPLE_SSLCONN_H_ */ |