comparison libpurple/sslconn.h @ 21563:1b174854bb80

merge of '30fcf2f336afb635b62a5c3ed3adb3e1fa1dd2d1' and 'bb60447c0a8c79afca320f4dc689096f4788e7fa'
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sat, 17 Nov 2007 01:55:21 +0000
parents fa3c4c5dea66
children 85bed17fe5c1
comparison
equal deleted inserted replaced
20755:774f4924e74e 21563:1b174854bb80
23 * along with this program; if not, write to the Free Software 23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA 24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
25 */ 25 */
26 #ifndef _PURPLE_SSLCONN_H_ 26 #ifndef _PURPLE_SSLCONN_H_
27 #define _PURPLE_SSLCONN_H_ 27 #define _PURPLE_SSLCONN_H_
28
29 #include "certificate.h"
30 #include "proxy.h"
31
32 #define PURPLE_SSL_DEFAULT_PORT 443
33 28
34 /** Possible SSL errors. */ 29 /** Possible SSL errors. */
35 typedef enum 30 typedef enum
36 { 31 {
37 PURPLE_SSL_HANDSHAKE_FAILED = 1, 32 PURPLE_SSL_HANDSHAKE_FAILED = 1,
38 PURPLE_SSL_CONNECT_FAILED = 2, 33 PURPLE_SSL_CONNECT_FAILED = 2,
39 PURPLE_SSL_CERTIFICATE_INVALID = 3 34 PURPLE_SSL_CERTIFICATE_INVALID = 3
40 } PurpleSslErrorType; 35 } PurpleSslErrorType;
36
37 #include "certificate.h"
38 #include "proxy.h"
39
40 #define PURPLE_SSL_DEFAULT_PORT 443
41 41
42 typedef struct _PurpleSslConnection PurpleSslConnection; 42 typedef struct _PurpleSslConnection PurpleSslConnection;
43 43
44 typedef void (*PurpleSslInputFunction)(gpointer, PurpleSslConnection *, 44 typedef void (*PurpleSslInputFunction)(gpointer, PurpleSslConnection *,
45 PurpleInputCondition); 45 PurpleInputCondition);
124 */ 124 */
125 size_t (*write)(PurpleSslConnection *gsc, const void *data, size_t len); 125 size_t (*write)(PurpleSslConnection *gsc, const void *data, size_t len);
126 /** Obtains the certificate chain provided by the peer 126 /** Obtains the certificate chain provided by the peer
127 * 127 *
128 * @param gsc Connection context 128 * @param gsc Connection context
129 * @return A newly allocated list of #PurpleCertificate containing the 129 * @return A newly allocated list containing the certificates
130 * certificates the peer provided. 130 * the peer provided.
131 * @see purple_ssl_get_peer_certificates 131 * @see PurpleCertificate
132 * @todo Decide whether the ordering of certificates in this 132 * @todo Decide whether the ordering of certificates in this
133 * list can be guaranteed. 133 * list can be guaranteed.
134 */ 134 */
135 GList * (* get_peer_certificates)(PurpleSslConnection * gsc); 135 GList * (* get_peer_certificates)(PurpleSslConnection * gsc);
136 136
183 PurpleSslConnection *purple_ssl_connect(PurpleAccount *account, const char *host, 183 PurpleSslConnection *purple_ssl_connect(PurpleAccount *account, const char *host,
184 int port, PurpleSslInputFunction func, 184 int port, PurpleSslInputFunction func,
185 PurpleSslErrorFunction error_func, 185 PurpleSslErrorFunction error_func,
186 void *data); 186 void *data);
187 187
188 #ifndef PURPLE_DISABLE_DEPRECATED
188 /** 189 /**
189 * Makes a SSL connection using an already open file descriptor. 190 * Makes a SSL connection using an already open file descriptor.
190 * 191 *
191 * @deprecated Use purple_ssl_connect_with_host_fd() instead. 192 * @deprecated Use purple_ssl_connect_with_host_fd() instead.
192 * 193 *
200 */ 201 */
201 PurpleSslConnection *purple_ssl_connect_fd(PurpleAccount *account, int fd, 202 PurpleSslConnection *purple_ssl_connect_fd(PurpleAccount *account, int fd,
202 PurpleSslInputFunction func, 203 PurpleSslInputFunction func,
203 PurpleSslErrorFunction error_func, 204 PurpleSslErrorFunction error_func,
204 void *data); 205 void *data);
205 206 #endif
206 /** 207
207 * Makes a SSL connection using an already open file descriptor. 208 /**
208 * 209 * Makes a SSL connection using an already open file descriptor.
209 * @param account The account making the connection. 210 *
210 * @param fd The file descriptor. 211 * @param account The account making the connection.
211 * @param func The SSL input handler function. 212 * @param fd The file descriptor.
212 * @param error_func The SSL error handler function. 213 * @param func The SSL input handler function.
213 * @param host The hostname of the other peer (to verify the CN) 214 * @param error_func The SSL error handler function.
214 * @param data User-defined data. 215 * @param host The hostname of the other peer (to verify the CN)
215 * 216 * @param data User-defined data.
216 * @return The SSL connection handle. 217 *
217 */ 218 * @return The SSL connection handle.
219 *
220 * @since 2.2.0
221 */
218 PurpleSslConnection *purple_ssl_connect_with_host_fd(PurpleAccount *account, int fd, 222 PurpleSslConnection *purple_ssl_connect_with_host_fd(PurpleAccount *account, int fd,
219 PurpleSslInputFunction func, 223 PurpleSslInputFunction func,
220 PurpleSslErrorFunction error_func, 224 PurpleSslErrorFunction error_func,
221 const char *host, 225 const char *host,
222 void *data); 226 void *data);
266 * 270 *
267 * @param gsc The SSL connection handle 271 * @param gsc The SSL connection handle
268 * 272 *
269 * @return The peer certificate chain, in the order of certificate, issuer, 273 * @return The peer certificate chain, in the order of certificate, issuer,
270 * issuer's issuer, etc. @a NULL if no certificates have been provided, 274 * issuer's issuer, etc. @a NULL if no certificates have been provided,
275 *
276 * @since 2.2.0
271 */ 277 */
272 GList * purple_ssl_get_peer_certificates(PurpleSslConnection *gsc); 278 GList * purple_ssl_get_peer_certificates(PurpleSslConnection *gsc);
273 279
274 /*@}*/ 280 /*@}*/
275 281