Mercurial > pidgin
comparison libpurple/sslconn.h @ 17922:43a55528ff26
propagate from branch 'im.pidgin.pidgin' (head b5c55520ae8ff7186733fd82db23a6e4452976cc)
to branch 'im.pidgin.soc.2007.finchfeat' (head 93037197c5356731d62e75b4050ca7d01b1017d6)
author | Eric Polino <aluink@pidgin.im> |
---|---|
date | Mon, 04 Jun 2007 15:12:50 +0000 |
parents | 2d2c72f70e8c |
children | e0eb1eb5b47b 988102692e39 |
comparison
equal
deleted
inserted
replaced
17827:223a4fca43a1 | 17922:43a55528ff26 |
---|---|
42 typedef void (*PurpleSslErrorFunction)(PurpleSslConnection *, PurpleSslErrorType, | 42 typedef void (*PurpleSslErrorFunction)(PurpleSslConnection *, PurpleSslErrorType, |
43 gpointer); | 43 gpointer); |
44 | 44 |
45 struct _PurpleSslConnection | 45 struct _PurpleSslConnection |
46 { | 46 { |
47 /** Hostname to which the SSL connection will be made */ | |
47 char *host; | 48 char *host; |
49 /** Port to connect to */ | |
48 int port; | 50 int port; |
51 /** Data to pass to PurpleSslConnection::connect_cb() */ | |
49 void *connect_cb_data; | 52 void *connect_cb_data; |
53 /** Callback triggered once the SSL handshake is complete */ | |
50 PurpleSslInputFunction connect_cb; | 54 PurpleSslInputFunction connect_cb; |
55 /** Callback triggered if there is an error during connection */ | |
51 PurpleSslErrorFunction error_cb; | 56 PurpleSslErrorFunction error_cb; |
57 /** Data passed to PurpleSslConnection::recv_cb() */ | |
52 void *recv_cb_data; | 58 void *recv_cb_data; |
59 /** User-defined callback executed when the SSL connection receives data */ | |
53 PurpleSslInputFunction recv_cb; | 60 PurpleSslInputFunction recv_cb; |
54 | 61 |
62 /** File descriptor used to refer to the socket */ | |
55 int fd; | 63 int fd; |
64 /** Glib event source ID; used to refer to the received data callback | |
65 * in the glib eventloop */ | |
56 int inpa; | 66 int inpa; |
67 /** Data related to the underlying TCP connection */ | |
57 PurpleProxyConnectData *connect_data; | 68 PurpleProxyConnectData *connect_data; |
58 | 69 |
70 /** Internal connection data managed by the SSL backend (GnuTLS/LibNSS/whatever) */ | |
59 void *private_data; | 71 void *private_data; |
60 }; | 72 }; |
61 | 73 |
62 /** | 74 /** |
63 * SSL implementation operations structure. | 75 * SSL implementation operations structure. |
64 * | 76 * |
65 * Every SSL implementation must provide all of these and register it. | 77 * Every SSL implementation must provide all of these and register it via purple_ssl_set_ops() |
78 * These should not be called directly! Instead, use the purple_ssl_* functions. | |
66 */ | 79 */ |
67 typedef struct | 80 typedef struct |
68 { | 81 { |
82 /** Initializes the SSL system provided. | |
83 * @return TRUE if initialization succeeded | |
84 */ | |
69 gboolean (*init)(void); | 85 gboolean (*init)(void); |
86 /** Unloads the SSL system. Inverse of init. */ | |
70 void (*uninit)(void); | 87 void (*uninit)(void); |
88 /** Sets up the SSL connection for a PurpleSslConnection once | |
89 * the TCP connection has been established */ | |
71 void (*connectfunc)(PurpleSslConnection *gsc); | 90 void (*connectfunc)(PurpleSslConnection *gsc); |
91 /** Destroys the internal data of the SSL connection provided. | |
92 * Freeing gsc itself is left to purple_ssl_close() | |
93 * | |
94 */ | |
72 void (*close)(PurpleSslConnection *gsc); | 95 void (*close)(PurpleSslConnection *gsc); |
96 /** Reads data from a connection (like POSIX read()) | |
97 * @param gsc Connection context | |
98 * @param data Pointer to buffer to drop data into | |
99 * @param len Maximum number of bytes to read | |
100 * @return Number of bytes actually written into the buffer, or <0 on error | |
101 */ | |
73 size_t (*read)(PurpleSslConnection *gsc, void *data, size_t len); | 102 size_t (*read)(PurpleSslConnection *gsc, void *data, size_t len); |
103 /** Writes data to a connection (like POSIX send()) | |
104 * @param gsc Connection context | |
105 * @param data Data buffer to send data from | |
106 * @param len Number of bytes to send from buffer | |
107 * @return The number of bytes written (may be less than len) or <0 on error | |
108 */ | |
74 size_t (*write)(PurpleSslConnection *gsc, const void *data, size_t len); | 109 size_t (*write)(PurpleSslConnection *gsc, const void *data, size_t len); |
75 | 110 |
76 void (*_purple_reserved1)(void); | 111 void (*_purple_reserved1)(void); |
77 void (*_purple_reserved2)(void); | 112 void (*_purple_reserved2)(void); |
78 void (*_purple_reserved3)(void); | 113 void (*_purple_reserved3)(void); |
133 PurpleSslErrorFunction error_func, | 168 PurpleSslErrorFunction error_func, |
134 void *data); | 169 void *data); |
135 | 170 |
136 /** | 171 /** |
137 * Adds an input watcher for the specified SSL connection. | 172 * Adds an input watcher for the specified SSL connection. |
173 * Once the SSL handshake is complete, use this to watch for actual data across it. | |
138 * | 174 * |
139 * @param gsc The SSL connection handle. | 175 * @param gsc The SSL connection handle. |
140 * @param func The callback function. | 176 * @param func The callback function. |
141 * @param data User-defined data. | 177 * @param data User-defined data. |
142 */ | 178 */ |