pidgin 2.14.13
sslconn.h
Go to the documentation of this file.
1
6/* purple
7 *
8 * Purple is the legal property of its developers, whose names are too numerous
9 * to list here. Please refer to the COPYRIGHT file distributed with this
10 * source distribution.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
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
25 */
26#ifndef _PURPLE_SSLCONN_H_
27#define _PURPLE_SSLCONN_H_
28
30typedef enum
31{
32 PURPLE_SSL_HANDSHAKE_FAILED = 1,
33 PURPLE_SSL_CONNECT_FAILED = 2,
34 PURPLE_SSL_CERTIFICATE_INVALID = 3
36
37#include "certificate.h"
38#include "proxy.h"
39
40#define PURPLE_SSL_DEFAULT_PORT 443
41
44
45typedef void (*PurpleSslInputFunction)(gpointer, PurpleSslConnection *,
47typedef void (*PurpleSslErrorFunction)(PurpleSslConnection *, PurpleSslErrorType,
48 gpointer);
49
51{
53 char *host;
55 int port;
59 PurpleSslInputFunction connect_cb;
61 PurpleSslErrorFunction error_cb;
65 PurpleSslInputFunction recv_cb;
66
68 int fd;
71 guint inpa;
73 PurpleProxyConnectData *connect_data;
74
77
80};
81
88typedef struct
89{
94 gboolean (*init)(void);
98 void (*uninit)(void);
103 void (*connectfunc)(PurpleSslConnection *gsc);
108 void (*close)(PurpleSslConnection *gsc);
117 size_t (*read)(PurpleSslConnection *gsc, void *data, size_t len);
126 size_t (*write)(PurpleSslConnection *gsc, const void *data, size_t len);
136 GList * (* get_peer_certificates)(PurpleSslConnection * gsc);
137
138 void (*_purple_reserved2)(void);
139 void (*_purple_reserved3)(void);
140 void (*_purple_reserved4)(void);
142
143#ifdef __cplusplus
144extern "C" {
145#endif
146
147/**************************************************************************/
149/**************************************************************************/
158
166
185 int port, PurpleSslInputFunction func,
186 PurpleSslErrorFunction error_func,
187 void *data);
188
209 int port, PurpleSslInputFunction func,
210 PurpleSslErrorFunction error_func,
211 const char *ssl_host,
212 void *data);
213
214#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_SSLCONN_C_)
229 PurpleSslInputFunction func,
230 PurpleSslErrorFunction error_func,
231 void *data);
232#endif
233
249 PurpleSslInputFunction func,
250 PurpleSslErrorFunction error_func,
251 const char *host,
252 void *data);
253
262void purple_ssl_input_add(PurpleSslConnection *gsc, PurpleSslInputFunction func,
263 void *data);
264
271
281size_t purple_ssl_read(PurpleSslConnection *gsc, void *buffer, size_t len);
282
292size_t purple_ssl_write(PurpleSslConnection *gsc, const void *buffer, size_t len);
293
305
308/**************************************************************************/
310/**************************************************************************/
319
326
331
336
339#ifdef __cplusplus
340}
341#endif
342
343#endif /* _PURPLE_SSLCONN_H_ */
Public-Key Certificate API.
PurpleInputCondition
An input condition.
Definition: eventloop.h:39
Proxy API.
void purple_ssl_input_add(PurpleSslConnection *gsc, PurpleSslInputFunction func, void *data)
Adds an input watcher for the specified SSL connection.
PurpleSslConnection * purple_ssl_connect_with_ssl_cn(PurpleAccount *account, const char *host, int port, PurpleSslInputFunction func, PurpleSslErrorFunction error_func, const char *ssl_host, void *data)
Makes a SSL connection to the specified host and port, using the separate name to verify with the cer...
size_t purple_ssl_read(PurpleSslConnection *gsc, void *buffer, size_t len)
Reads data from an SSL connection.
gboolean purple_ssl_is_supported(void)
Returns whether or not SSL is currently supported.
PurpleSslErrorType
Possible SSL errors.
Definition: sslconn.h:31
size_t purple_ssl_write(PurpleSslConnection *gsc, const void *buffer, size_t len)
Writes data to an SSL connection.
void purple_ssl_uninit(void)
Uninitializes the SSL subsystem.
PurpleSslOps * purple_ssl_get_ops(void)
Returns the current SSL operations structure.
PurpleSslConnection * purple_ssl_connect(PurpleAccount *account, const char *host, int port, PurpleSslInputFunction func, PurpleSslErrorFunction error_func, void *data)
Makes a SSL connection to the specified host and port.
const gchar * purple_ssl_strerror(PurpleSslErrorType error)
Returns a human-readable string for an SSL error.
void purple_ssl_set_ops(PurpleSslOps *ops)
Sets the current SSL operations structure.
void purple_ssl_init(void)
Initializes the SSL subsystem.
void purple_ssl_close(PurpleSslConnection *gsc)
Closes a SSL connection.
PurpleSslConnection * purple_ssl_connect_fd(PurpleAccount *account, int fd, PurpleSslInputFunction func, PurpleSslErrorFunction error_func, void *data)
Makes a SSL connection using an already open file descriptor.
PurpleSslConnection * purple_ssl_connect_with_host_fd(PurpleAccount *account, int fd, PurpleSslInputFunction func, PurpleSslErrorFunction error_func, const char *host, void *data)
Makes a SSL connection using an already open file descriptor.
GList * purple_ssl_get_peer_certificates(PurpleSslConnection *gsc)
Obtains the peer's presented certificates.
SSL implementation operations structure.
Definition: sslconn.h:89
Structure representing an account.
Definition: account.h:170
A set of operations used to provide logic for verifying a Certificate's authenticity.
Definition: certificate.h:363
guint inpa
Glib event source ID; used to refer to the received data callback in the glib eventloop.
Definition: sslconn.h:71
PurpleSslErrorFunction error_cb
Callback triggered if there is an error during connection.
Definition: sslconn.h:61
char * host
Hostname to which the SSL connection will be made.
Definition: sslconn.h:53
PurpleSslInputFunction recv_cb
User-defined callback executed when the SSL connection receives data.
Definition: sslconn.h:65
PurpleSslInputFunction connect_cb
Callback triggered once the SSL handshake is complete.
Definition: sslconn.h:59
void * connect_cb_data
Data to pass to PurpleSslConnection::connect_cb()
Definition: sslconn.h:57
int port
Port to connect to.
Definition: sslconn.h:55
void * private_data
Internal connection data managed by the SSL backend (GnuTLS/LibNSS/whatever)
Definition: sslconn.h:76
int fd
File descriptor used to refer to the socket.
Definition: sslconn.h:68
PurpleProxyConnectData * connect_data
Data related to the underlying TCP connection.
Definition: sslconn.h:73
PurpleCertificateVerifier * verifier
Verifier to use in authenticating the peer.
Definition: sslconn.h:79
void * recv_cb_data
Data passed to PurpleSslConnection::recv_cb()
Definition: sslconn.h:63