comparison src/sslconn.h @ 7274:448e39ace278

[gaim-migrate @ 7851] Added a parameter to gaim_ssl_connect() to specify an optional error callback. MSN takes advantage of it, but since I can't reproduce the errors here, I'm not positive it works. It should though! Famous last words. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Wed, 15 Oct 2003 06:32:13 +0000
parents 8105c9cd573f
children fa6395637e2c
comparison
equal deleted inserted replaced
7273:d152ea377e4a 7274:448e39ace278
25 25
26 #include "proxy.h" 26 #include "proxy.h"
27 27
28 #define GAIM_SSL_DEFAULT_PORT 443 28 #define GAIM_SSL_DEFAULT_PORT 443
29 29
30 typedef enum
31 {
32 GAIM_SSL_HANDSHAKE_FAILED = 1
33
34 } GaimSslErrorType;
35
30 typedef struct _GaimSslConnection GaimSslConnection; 36 typedef struct _GaimSslConnection GaimSslConnection;
31 37
32 typedef void (*GaimSslInputFunction)(gpointer, GaimSslConnection *, 38 typedef void (*GaimSslInputFunction)(gpointer, GaimSslConnection *,
33 GaimInputCondition); 39 GaimInputCondition);
40 typedef void (*GaimSslErrorFunction)(GaimSslConnection *, GaimSslErrorType,
41 gpointer);
34 42
35 struct _GaimSslConnection 43 struct _GaimSslConnection
36 { 44 {
37 char *host; 45 char *host;
38 int port; 46 int port;
39 void *connect_cb_data; 47 void *connect_cb_data;
40 GaimSslInputFunction connect_cb; 48 GaimSslInputFunction connect_cb;
49 GaimSslErrorFunction error_cb;
41 void *recv_cb_data; 50 void *recv_cb_data;
42 GaimSslInputFunction recv_cb; 51 GaimSslInputFunction recv_cb;
43 52
44 int fd; 53 int fd;
45 int inpa; 54 int inpa;
80 gboolean gaim_ssl_is_supported(void); 89 gboolean gaim_ssl_is_supported(void);
81 90
82 /** 91 /**
83 * Makes a SSL connection to the specified host and port. 92 * Makes a SSL connection to the specified host and port.
84 * 93 *
85 * @param account The account making the connection. 94 * @param account The account making the connection.
86 * @param host The destination host. 95 * @param host The destination host.
87 * @param port The destination port. 96 * @param port The destination port.
88 * @param func The SSL input handler function. 97 * @param func The SSL input handler function.
89 * @param data User-defined data. 98 * @param error_func The SSL error handler function.
99 * @param data User-defined data.
90 * 100 *
91 * @return The SSL connection handle. 101 * @return The SSL connection handle.
92 */ 102 */
93 GaimSslConnection *gaim_ssl_connect(GaimAccount *account, const char *host, 103 GaimSslConnection *gaim_ssl_connect(GaimAccount *account, const char *host,
94 int port, GaimSslInputFunction func, 104 int port, GaimSslInputFunction func,
105 GaimSslErrorFunction error_func,
95 void *data); 106 void *data);
107
108 /**
109 * Makes a SSL connection using an already open file descriptor.
110 *
111 * @param account The account making the connection.
112 * @param fd The file descriptor.
113 * @param func The SSL input handler function.
114 * @param error_func The SSL error handler function.
115 * @param data User-defined data.
116 *
117 * @return The SSL connection handle.
118 */
119 GaimSslConnection *gaim_ssl_connect_fd(GaimAccount *account, int fd,
120 GaimSslInputFunction func,
121 GaimSslErrorFunction error_func,
122 void *data);
96 123
97 /** 124 /**
98 * Adds an input watcher for the specified SSL connection. 125 * Adds an input watcher for the specified SSL connection.
99 * 126 *
100 * @param gsc The SSL connection handle. 127 * @param gsc The SSL connection handle.
101 * @param func The callback function. 128 * @param func The callback function.
102 * @param data User-defined data. 129 * @param data User-defined data.
103 */ 130 */
104 void gaim_ssl_input_add(GaimSslConnection *gsc, GaimSslInputFunction func, 131 void gaim_ssl_input_add(GaimSslConnection *gsc, GaimSslInputFunction func,
105 void *data); 132 void *data);
106
107 /**
108 * Makes a SSL connection using an already open file descriptor.
109 *
110 * @param account The account making the connection.
111 * @param fd The file descriptor.
112 * @param func The SSL input handler function.
113 * @param data User-defined data.
114 *
115 * @return The SSL connection handle.
116 */
117 GaimSslConnection *gaim_ssl_connect_fd(GaimAccount *account, int fd,
118 GaimSslInputFunction func, void *data);
119 133
120 /** 134 /**
121 * Closes a SSL connection. 135 * Closes a SSL connection.
122 * 136 *
123 * @param gsc The SSL connection to close. 137 * @param gsc The SSL connection to close.