Wed, 06 Feb 2008 18:06:44 +0000
Simplified version of the newest patch on #4533 to not try Yahoo protocol
version 15 file transfer on Yahoo Japan.
| 6703 | 1 | /** |
| 2 | * @file sslconn.h SSL API | |
| 3 | * @ingroup core | |
|
20147
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
4 | */ |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
5 | |
|
66f05a854eee
applied changes from 8a731bbd0197fbcc91a705c2d8f528154216defa
Richard Laager <rlaager@pidgin.im>
parents:
19859
diff
changeset
|
6 | /* purple |
| 6703 | 7 | * |
| 15884 | 8 | * Purple is the legal property of its developers, whose names are too numerous |
| 8046 | 9 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 10 | * source distribution. | |
| 6703 | 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 | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18487
diff
changeset
|
24 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 6703 | 25 | */ |
| 15884 | 26 | #ifndef _PURPLE_SSLCONN_H_ |
| 27 | #define _PURPLE_SSLCONN_H_ | |
| 6703 | 28 | |
|
20371
ff774b09aabc
Bunch of documentation tidying for the ssl api, and add a doxycomment to
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
29 | /** Possible SSL errors. */ |
|
7274
42ec5f56e32a
[gaim-migrate @ 7851]
Christian Hammond <chipx86@chipx86.com>
parents:
6783
diff
changeset
|
30 | typedef enum |
|
42ec5f56e32a
[gaim-migrate @ 7851]
Christian Hammond <chipx86@chipx86.com>
parents:
6783
diff
changeset
|
31 | { |
| 15884 | 32 | PURPLE_SSL_HANDSHAKE_FAILED = 1, |
|
18474
7f5cf3fa528d
- Add PURPLE_SSL_CERTIFICATE_INVALID error code
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18464
diff
changeset
|
33 | PURPLE_SSL_CONNECT_FAILED = 2, |
|
7f5cf3fa528d
- Add PURPLE_SSL_CERTIFICATE_INVALID error code
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18464
diff
changeset
|
34 | PURPLE_SSL_CERTIFICATE_INVALID = 3 |
| 15884 | 35 | } PurpleSslErrorType; |
|
7274
42ec5f56e32a
[gaim-migrate @ 7851]
Christian Hammond <chipx86@chipx86.com>
parents:
6783
diff
changeset
|
36 | |
|
20443
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
37 | #include "certificate.h" |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
38 | #include "proxy.h" |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
39 | |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
40 | #define PURPLE_SSL_DEFAULT_PORT 443 |
|
7487bb69ae76
Create purple_connection_ssl_error(), which converts a PurpleSslErrorType
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
41 | |
| 15884 | 42 | typedef struct _PurpleSslConnection PurpleSslConnection; |
|
6738
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
43 | |
| 15884 | 44 | typedef void (*PurpleSslInputFunction)(gpointer, PurpleSslConnection *, |
| 45 | PurpleInputCondition); | |
| 46 | typedef void (*PurpleSslErrorFunction)(PurpleSslConnection *, PurpleSslErrorType, | |
|
7274
42ec5f56e32a
[gaim-migrate @ 7851]
Christian Hammond <chipx86@chipx86.com>
parents:
6783
diff
changeset
|
47 | gpointer); |
|
6738
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
48 | |
| 15884 | 49 | struct _PurpleSslConnection |
|
6738
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
50 | { |
|
17314
db5063b444df
Partial documentation on SslConnection struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17313
diff
changeset
|
51 | /** Hostname to which the SSL connection will be made */ |
|
6738
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
52 | char *host; |
|
17314
db5063b444df
Partial documentation on SslConnection struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17313
diff
changeset
|
53 | /** Port to connect to */ |
|
6738
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
54 | int port; |
|
17315
b6976c48ec78
More documenting
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17314
diff
changeset
|
55 | /** Data to pass to PurpleSslConnection::connect_cb() */ |
| 6764 | 56 | void *connect_cb_data; |
|
17315
b6976c48ec78
More documenting
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17314
diff
changeset
|
57 | /** Callback triggered once the SSL handshake is complete */ |
| 15884 | 58 | PurpleSslInputFunction connect_cb; |
|
17316
a511aef67b4f
- Completed SslConnection fields docs
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17315
diff
changeset
|
59 | /** Callback triggered if there is an error during connection */ |
| 15884 | 60 | PurpleSslErrorFunction error_cb; |
|
17315
b6976c48ec78
More documenting
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17314
diff
changeset
|
61 | /** Data passed to PurpleSslConnection::recv_cb() */ |
| 6764 | 62 | void *recv_cb_data; |
|
17316
a511aef67b4f
- Completed SslConnection fields docs
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17315
diff
changeset
|
63 | /** User-defined callback executed when the SSL connection receives data */ |
| 15884 | 64 | PurpleSslInputFunction recv_cb; |
|
6738
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
65 | |
|
17314
db5063b444df
Partial documentation on SslConnection struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17313
diff
changeset
|
66 | /** File descriptor used to refer to the socket */ |
|
6738
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
67 | int fd; |
|
17316
a511aef67b4f
- Completed SslConnection fields docs
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17315
diff
changeset
|
68 | /** Glib event source ID; used to refer to the received data callback |
|
a511aef67b4f
- Completed SslConnection fields docs
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17315
diff
changeset
|
69 | * in the glib eventloop */ |
|
6738
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
70 | int inpa; |
|
17316
a511aef67b4f
- Completed SslConnection fields docs
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17315
diff
changeset
|
71 | /** Data related to the underlying TCP connection */ |
| 15884 | 72 | PurpleProxyConnectData *connect_data; |
|
6738
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
73 | |
|
17314
db5063b444df
Partial documentation on SslConnection struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17313
diff
changeset
|
74 | /** Internal connection data managed by the SSL backend (GnuTLS/LibNSS/whatever) */ |
|
6738
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
75 | void *private_data; |
|
18464
7fb7cb707a19
- Add verifier field to SslConnection
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18451
diff
changeset
|
76 | |
|
7fb7cb707a19
- Add verifier field to SslConnection
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18451
diff
changeset
|
77 | /** Verifier to use in authenticating the peer */ |
|
7fb7cb707a19
- Add verifier field to SslConnection
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18451
diff
changeset
|
78 | PurpleCertificateVerifier *verifier; |
|
6738
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
79 | }; |
|
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
80 | |
|
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
81 | /** |
|
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
82 | * SSL implementation operations structure. |
|
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
83 | * |
|
17315
b6976c48ec78
More documenting
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17314
diff
changeset
|
84 | * Every SSL implementation must provide all of these and register it via purple_ssl_set_ops() |
|
17313
c8b649e48d4f
Clarify documentation
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17312
diff
changeset
|
85 | * These should not be called directly! Instead, use the purple_ssl_* functions. |
|
6738
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
86 | */ |
|
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
87 | typedef struct |
|
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
88 | { |
|
17312
ba4bc8d967f8
Documented the SslOps structure
William Ehlhardt <williamehlhardt@gmail.com>
parents:
16743
diff
changeset
|
89 | /** Initializes the SSL system provided. |
|
20371
ff774b09aabc
Bunch of documentation tidying for the ssl api, and add a doxycomment to
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
90 | * @return @a TRUE if initialization succeeded |
|
ff774b09aabc
Bunch of documentation tidying for the ssl api, and add a doxycomment to
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
91 | * @see purple_ssl_init |
|
ff774b09aabc
Bunch of documentation tidying for the ssl api, and add a doxycomment to
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
92 | */ |
|
6738
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
93 | gboolean (*init)(void); |
|
20371
ff774b09aabc
Bunch of documentation tidying for the ssl api, and add a doxycomment to
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
94 | /** Unloads the SSL system. Inverse of PurpleSslOps::init. |
|
ff774b09aabc
Bunch of documentation tidying for the ssl api, and add a doxycomment to
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
95 | * @see purple_ssl_uninit |
|
ff774b09aabc
Bunch of documentation tidying for the ssl api, and add a doxycomment to
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
96 | */ |
|
6738
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
97 | void (*uninit)(void); |
|
20371
ff774b09aabc
Bunch of documentation tidying for the ssl api, and add a doxycomment to
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
98 | /** Sets up the SSL connection for a #PurpleSslConnection once |
|
ff774b09aabc
Bunch of documentation tidying for the ssl api, and add a doxycomment to
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
99 | * the TCP connection has been established |
|
ff774b09aabc
Bunch of documentation tidying for the ssl api, and add a doxycomment to
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
100 | * @see purple_ssl_connect |
|
ff774b09aabc
Bunch of documentation tidying for the ssl api, and add a doxycomment to
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
101 | */ |
| 15884 | 102 | void (*connectfunc)(PurpleSslConnection *gsc); |
|
17313
c8b649e48d4f
Clarify documentation
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17312
diff
changeset
|
103 | /** Destroys the internal data of the SSL connection provided. |
|
c8b649e48d4f
Clarify documentation
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17312
diff
changeset
|
104 | * Freeing gsc itself is left to purple_ssl_close() |
|
20371
ff774b09aabc
Bunch of documentation tidying for the ssl api, and add a doxycomment to
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
105 | * @see purple_ssl_close |
|
17313
c8b649e48d4f
Clarify documentation
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17312
diff
changeset
|
106 | */ |
| 15884 | 107 | void (*close)(PurpleSslConnection *gsc); |
|
17312
ba4bc8d967f8
Documented the SslOps structure
William Ehlhardt <williamehlhardt@gmail.com>
parents:
16743
diff
changeset
|
108 | /** Reads data from a connection (like POSIX read()) |
|
20371
ff774b09aabc
Bunch of documentation tidying for the ssl api, and add a doxycomment to
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
109 | * @param gsc Connection context |
|
ff774b09aabc
Bunch of documentation tidying for the ssl api, and add a doxycomment to
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
110 | * @param data Pointer to buffer to drop data into |
|
ff774b09aabc
Bunch of documentation tidying for the ssl api, and add a doxycomment to
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
111 | * @param len Maximum number of bytes to read |
|
ff774b09aabc
Bunch of documentation tidying for the ssl api, and add a doxycomment to
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
112 | * @return Number of bytes actually written into @a data (which may be |
|
ff774b09aabc
Bunch of documentation tidying for the ssl api, and add a doxycomment to
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
113 | * less than @a len), or <0 on error |
|
ff774b09aabc
Bunch of documentation tidying for the ssl api, and add a doxycomment to
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
114 | * @see purple_ssl_read |
|
17312
ba4bc8d967f8
Documented the SslOps structure
William Ehlhardt <williamehlhardt@gmail.com>
parents:
16743
diff
changeset
|
115 | */ |
| 15884 | 116 | size_t (*read)(PurpleSslConnection *gsc, void *data, size_t len); |
|
17312
ba4bc8d967f8
Documented the SslOps structure
William Ehlhardt <williamehlhardt@gmail.com>
parents:
16743
diff
changeset
|
117 | /** Writes data to a connection (like POSIX send()) |
|
20371
ff774b09aabc
Bunch of documentation tidying for the ssl api, and add a doxycomment to
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
118 | * @param gsc Connection context |
|
ff774b09aabc
Bunch of documentation tidying for the ssl api, and add a doxycomment to
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
119 | * @param data Data buffer to send data from |
|
ff774b09aabc
Bunch of documentation tidying for the ssl api, and add a doxycomment to
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
120 | * @param len Number of bytes to send from buffer |
|
ff774b09aabc
Bunch of documentation tidying for the ssl api, and add a doxycomment to
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
121 | * @return The number of bytes written to @a data (may be less than |
|
ff774b09aabc
Bunch of documentation tidying for the ssl api, and add a doxycomment to
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
122 | * @a len) or <0 on error |
|
ff774b09aabc
Bunch of documentation tidying for the ssl api, and add a doxycomment to
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
123 | * @see purple_ssl_write |
|
17312
ba4bc8d967f8
Documented the SslOps structure
William Ehlhardt <williamehlhardt@gmail.com>
parents:
16743
diff
changeset
|
124 | */ |
| 15884 | 125 | size_t (*write)(PurpleSslConnection *gsc, const void *data, size_t len); |
|
18246
212bfb9c9cc7
- Expose get_peer_certificates in the SslOps struct, and modify gnutls
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17430
diff
changeset
|
126 | /** Obtains the certificate chain provided by the peer |
|
212bfb9c9cc7
- Expose get_peer_certificates in the SslOps struct, and modify gnutls
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17430
diff
changeset
|
127 | * |
|
212bfb9c9cc7
- Expose get_peer_certificates in the SslOps struct, and modify gnutls
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17430
diff
changeset
|
128 | * @param gsc Connection context |
|
212bfb9c9cc7
- Expose get_peer_certificates in the SslOps struct, and modify gnutls
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17430
diff
changeset
|
129 | * @return A newly allocated list containing the certificates |
|
212bfb9c9cc7
- Expose get_peer_certificates in the SslOps struct, and modify gnutls
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17430
diff
changeset
|
130 | * the peer provided. |
|
18464
7fb7cb707a19
- Add verifier field to SslConnection
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18451
diff
changeset
|
131 | * @see PurpleCertificate |
|
18246
212bfb9c9cc7
- Expose get_peer_certificates in the SslOps struct, and modify gnutls
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17430
diff
changeset
|
132 | * @todo Decide whether the ordering of certificates in this |
|
212bfb9c9cc7
- Expose get_peer_certificates in the SslOps struct, and modify gnutls
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17430
diff
changeset
|
133 | * list can be guaranteed. |
|
212bfb9c9cc7
- Expose get_peer_certificates in the SslOps struct, and modify gnutls
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17430
diff
changeset
|
134 | */ |
|
212bfb9c9cc7
- Expose get_peer_certificates in the SslOps struct, and modify gnutls
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17430
diff
changeset
|
135 | GList * (* get_peer_certificates)(PurpleSslConnection * gsc); |
|
212bfb9c9cc7
- Expose get_peer_certificates in the SslOps struct, and modify gnutls
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17430
diff
changeset
|
136 | |
|
16743
1ce5ffe12e2a
Initial addition of padding for ui_ops and other class-like structs
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
137 | void (*_purple_reserved2)(void); |
|
1ce5ffe12e2a
Initial addition of padding for ui_ops and other class-like structs
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
138 | void (*_purple_reserved3)(void); |
|
1ce5ffe12e2a
Initial addition of padding for ui_ops and other class-like structs
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
139 | void (*_purple_reserved4)(void); |
| 15884 | 140 | } PurpleSslOps; |
|
6738
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
141 | |
| 6703 | 142 | #ifdef __cplusplus |
| 143 | extern "C" { | |
| 144 | #endif | |
| 145 | ||
| 146 | /**************************************************************************/ | |
| 147 | /** @name SSL API */ | |
| 148 | /**************************************************************************/ | |
| 149 | /*@{*/ | |
| 150 | ||
| 151 | /** | |
| 152 | * Returns whether or not SSL is currently supported. | |
| 153 | * | |
|
20371
ff774b09aabc
Bunch of documentation tidying for the ssl api, and add a doxycomment to
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
154 | * @return @a TRUE if SSL is supported, or @a FALSE otherwise. |
| 6703 | 155 | */ |
| 15884 | 156 | gboolean purple_ssl_is_supported(void); |
| 6703 | 157 | |
| 158 | /** | |
|
20371
ff774b09aabc
Bunch of documentation tidying for the ssl api, and add a doxycomment to
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
159 | * Returns a human-readable string for an SSL error. |
|
18487
0730e45141fd
- Add purple_ssl_strerror for handy error description power!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18474
diff
changeset
|
160 | * |
|
0730e45141fd
- Add purple_ssl_strerror for handy error description power!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18474
diff
changeset
|
161 | * @param error Error code |
|
0730e45141fd
- Add purple_ssl_strerror for handy error description power!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18474
diff
changeset
|
162 | * @return Human-readable error explanation |
|
0730e45141fd
- Add purple_ssl_strerror for handy error description power!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18474
diff
changeset
|
163 | */ |
|
0730e45141fd
- Add purple_ssl_strerror for handy error description power!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18474
diff
changeset
|
164 | const gchar * purple_ssl_strerror(PurpleSslErrorType error); |
|
0730e45141fd
- Add purple_ssl_strerror for handy error description power!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18474
diff
changeset
|
165 | |
|
0730e45141fd
- Add purple_ssl_strerror for handy error description power!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18474
diff
changeset
|
166 | /** |
|
14312
6ce4512aa9a8
[gaim-migrate @ 16932]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
167 | * Makes a SSL connection to the specified host and port. The caller |
|
6ce4512aa9a8
[gaim-migrate @ 16932]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
168 | * should keep track of the returned value and use it to cancel the |
|
6ce4512aa9a8
[gaim-migrate @ 16932]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
169 | * connection, if needed. |
| 6703 | 170 | * |
|
7274
42ec5f56e32a
[gaim-migrate @ 7851]
Christian Hammond <chipx86@chipx86.com>
parents:
6783
diff
changeset
|
171 | * @param account The account making the connection. |
|
42ec5f56e32a
[gaim-migrate @ 7851]
Christian Hammond <chipx86@chipx86.com>
parents:
6783
diff
changeset
|
172 | * @param host The destination host. |
|
42ec5f56e32a
[gaim-migrate @ 7851]
Christian Hammond <chipx86@chipx86.com>
parents:
6783
diff
changeset
|
173 | * @param port The destination port. |
|
42ec5f56e32a
[gaim-migrate @ 7851]
Christian Hammond <chipx86@chipx86.com>
parents:
6783
diff
changeset
|
174 | * @param func The SSL input handler function. |
|
14312
6ce4512aa9a8
[gaim-migrate @ 16932]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
175 | * @param error_func The SSL error handler function. This function |
|
20371
ff774b09aabc
Bunch of documentation tidying for the ssl api, and add a doxycomment to
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
176 | * should <strong>NOT</strong> call purple_ssl_close(). In |
|
ff774b09aabc
Bunch of documentation tidying for the ssl api, and add a doxycomment to
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
177 | * the event of an error the #PurpleSslConnection will be |
|
14312
6ce4512aa9a8
[gaim-migrate @ 16932]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
178 | * destroyed for you. |
|
7274
42ec5f56e32a
[gaim-migrate @ 7851]
Christian Hammond <chipx86@chipx86.com>
parents:
6783
diff
changeset
|
179 | * @param data User-defined data. |
| 6703 | 180 | * |
| 181 | * @return The SSL connection handle. | |
| 182 | */ | |
| 15884 | 183 | PurpleSslConnection *purple_ssl_connect(PurpleAccount *account, const char *host, |
| 184 | int port, PurpleSslInputFunction func, | |
| 185 | PurpleSslErrorFunction error_func, | |
| 6703 | 186 | void *data); |
| 187 | ||
|
20808
e3524e9d502c
Honor a PURPLE_DISABLE_DEPRECATED define to allow plugins to catch
Richard Laager <rlaager@pidgin.im>
parents:
20371
diff
changeset
|
188 | #ifndef PURPLE_DISABLE_DEPRECATED |
| 6703 | 189 | /** |
|
7274
42ec5f56e32a
[gaim-migrate @ 7851]
Christian Hammond <chipx86@chipx86.com>
parents:
6783
diff
changeset
|
190 | * Makes a SSL connection using an already open file descriptor. |
|
20371
ff774b09aabc
Bunch of documentation tidying for the ssl api, and add a doxycomment to
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
191 | * |
|
ff774b09aabc
Bunch of documentation tidying for the ssl api, and add a doxycomment to
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
192 | * @deprecated Use purple_ssl_connect_with_host_fd() instead. |
|
7274
42ec5f56e32a
[gaim-migrate @ 7851]
Christian Hammond <chipx86@chipx86.com>
parents:
6783
diff
changeset
|
193 | * |
|
42ec5f56e32a
[gaim-migrate @ 7851]
Christian Hammond <chipx86@chipx86.com>
parents:
6783
diff
changeset
|
194 | * @param account The account making the connection. |
|
42ec5f56e32a
[gaim-migrate @ 7851]
Christian Hammond <chipx86@chipx86.com>
parents:
6783
diff
changeset
|
195 | * @param fd The file descriptor. |
|
42ec5f56e32a
[gaim-migrate @ 7851]
Christian Hammond <chipx86@chipx86.com>
parents:
6783
diff
changeset
|
196 | * @param func The SSL input handler function. |
|
42ec5f56e32a
[gaim-migrate @ 7851]
Christian Hammond <chipx86@chipx86.com>
parents:
6783
diff
changeset
|
197 | * @param error_func The SSL error handler function. |
|
42ec5f56e32a
[gaim-migrate @ 7851]
Christian Hammond <chipx86@chipx86.com>
parents:
6783
diff
changeset
|
198 | * @param data User-defined data. |
|
42ec5f56e32a
[gaim-migrate @ 7851]
Christian Hammond <chipx86@chipx86.com>
parents:
6783
diff
changeset
|
199 | * |
|
42ec5f56e32a
[gaim-migrate @ 7851]
Christian Hammond <chipx86@chipx86.com>
parents:
6783
diff
changeset
|
200 | * @return The SSL connection handle. |
|
42ec5f56e32a
[gaim-migrate @ 7851]
Christian Hammond <chipx86@chipx86.com>
parents:
6783
diff
changeset
|
201 | */ |
| 15884 | 202 | PurpleSslConnection *purple_ssl_connect_fd(PurpleAccount *account, int fd, |
| 203 | PurpleSslInputFunction func, | |
| 204 | PurpleSslErrorFunction error_func, | |
|
18449
2d2df64f4303
applied changes from f9186fabb483b56a9d7e8fb7241b2520e9930413
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18246
diff
changeset
|
205 | void *data); |
|
20808
e3524e9d502c
Honor a PURPLE_DISABLE_DEPRECATED define to allow plugins to catch
Richard Laager <rlaager@pidgin.im>
parents:
20371
diff
changeset
|
206 | #endif |
|
18449
2d2df64f4303
applied changes from f9186fabb483b56a9d7e8fb7241b2520e9930413
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18246
diff
changeset
|
207 | |
|
2d2df64f4303
applied changes from f9186fabb483b56a9d7e8fb7241b2520e9930413
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18246
diff
changeset
|
208 | /** |
|
20940
925d3d68b3af
Doxygen @since tags for libpurple and pidgin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20371
diff
changeset
|
209 | * Makes a SSL connection using an already open file descriptor. |
|
925d3d68b3af
Doxygen @since tags for libpurple and pidgin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20371
diff
changeset
|
210 | * |
|
925d3d68b3af
Doxygen @since tags for libpurple and pidgin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20371
diff
changeset
|
211 | * @param account The account making the connection. |
|
925d3d68b3af
Doxygen @since tags for libpurple and pidgin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20371
diff
changeset
|
212 | * @param fd The file descriptor. |
|
925d3d68b3af
Doxygen @since tags for libpurple and pidgin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20371
diff
changeset
|
213 | * @param func The SSL input handler function. |
|
925d3d68b3af
Doxygen @since tags for libpurple and pidgin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20371
diff
changeset
|
214 | * @param error_func The SSL error handler function. |
|
925d3d68b3af
Doxygen @since tags for libpurple and pidgin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20371
diff
changeset
|
215 | * @param host The hostname of the other peer (to verify the CN) |
|
925d3d68b3af
Doxygen @since tags for libpurple and pidgin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20371
diff
changeset
|
216 | * @param data User-defined data. |
|
925d3d68b3af
Doxygen @since tags for libpurple and pidgin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20371
diff
changeset
|
217 | * |
|
925d3d68b3af
Doxygen @since tags for libpurple and pidgin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20371
diff
changeset
|
218 | * @return The SSL connection handle. |
|
925d3d68b3af
Doxygen @since tags for libpurple and pidgin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20371
diff
changeset
|
219 | * |
|
925d3d68b3af
Doxygen @since tags for libpurple and pidgin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20371
diff
changeset
|
220 | * @since 2.2.0 |
|
925d3d68b3af
Doxygen @since tags for libpurple and pidgin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20371
diff
changeset
|
221 | */ |
|
18449
2d2df64f4303
applied changes from f9186fabb483b56a9d7e8fb7241b2520e9930413
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18246
diff
changeset
|
222 | PurpleSslConnection *purple_ssl_connect_with_host_fd(PurpleAccount *account, int fd, |
|
2d2df64f4303
applied changes from f9186fabb483b56a9d7e8fb7241b2520e9930413
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18246
diff
changeset
|
223 | PurpleSslInputFunction func, |
|
2d2df64f4303
applied changes from f9186fabb483b56a9d7e8fb7241b2520e9930413
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18246
diff
changeset
|
224 | PurpleSslErrorFunction error_func, |
|
2d2df64f4303
applied changes from f9186fabb483b56a9d7e8fb7241b2520e9930413
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18246
diff
changeset
|
225 | const char *host, |
|
2d2df64f4303
applied changes from f9186fabb483b56a9d7e8fb7241b2520e9930413
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18246
diff
changeset
|
226 | void *data); |
|
7274
42ec5f56e32a
[gaim-migrate @ 7851]
Christian Hammond <chipx86@chipx86.com>
parents:
6783
diff
changeset
|
227 | |
|
42ec5f56e32a
[gaim-migrate @ 7851]
Christian Hammond <chipx86@chipx86.com>
parents:
6783
diff
changeset
|
228 | /** |
| 6764 | 229 | * Adds an input watcher for the specified SSL connection. |
|
17344
158859c42ae9
Add note on use of purple_ssl_input_add
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17316
diff
changeset
|
230 | * Once the SSL handshake is complete, use this to watch for actual data across it. |
| 6764 | 231 | * |
| 232 | * @param gsc The SSL connection handle. | |
| 233 | * @param func The callback function. | |
| 234 | * @param data User-defined data. | |
| 235 | */ | |
| 15884 | 236 | void purple_ssl_input_add(PurpleSslConnection *gsc, PurpleSslInputFunction func, |
|
7274
42ec5f56e32a
[gaim-migrate @ 7851]
Christian Hammond <chipx86@chipx86.com>
parents:
6783
diff
changeset
|
237 | void *data); |
|
6762
2349053f14aa
[gaim-migrate @ 7294]
Christian Hammond <chipx86@chipx86.com>
parents:
6738
diff
changeset
|
238 | |
|
2349053f14aa
[gaim-migrate @ 7294]
Christian Hammond <chipx86@chipx86.com>
parents:
6738
diff
changeset
|
239 | /** |
| 6703 | 240 | * Closes a SSL connection. |
| 241 | * | |
| 242 | * @param gsc The SSL connection to close. | |
| 243 | */ | |
| 15884 | 244 | void purple_ssl_close(PurpleSslConnection *gsc); |
| 6703 | 245 | |
| 246 | /** | |
| 247 | * Reads data from an SSL connection. | |
| 248 | * | |
| 249 | * @param gsc The SSL connection handle. | |
| 250 | * @param buffer The destination buffer. | |
| 251 | * @param len The maximum number of bytes to read. | |
| 252 | * | |
| 253 | * @return The number of bytes read. | |
| 254 | */ | |
| 15884 | 255 | size_t purple_ssl_read(PurpleSslConnection *gsc, void *buffer, size_t len); |
| 6703 | 256 | |
| 257 | /** | |
| 258 | * Writes data to an SSL connection. | |
| 259 | * | |
|
6720
cdc5348dd848
[gaim-migrate @ 7247]
Christian Hammond <chipx86@chipx86.com>
parents:
6703
diff
changeset
|
260 | * @param gsc The SSL connection handle. |
|
cdc5348dd848
[gaim-migrate @ 7247]
Christian Hammond <chipx86@chipx86.com>
parents:
6703
diff
changeset
|
261 | * @param buffer The buffer to write. |
|
cdc5348dd848
[gaim-migrate @ 7247]
Christian Hammond <chipx86@chipx86.com>
parents:
6703
diff
changeset
|
262 | * @param len The length of the data to write. |
| 6703 | 263 | * |
| 264 | * @return The number of bytes written. | |
| 265 | */ | |
| 15884 | 266 | size_t purple_ssl_write(PurpleSslConnection *gsc, const void *buffer, size_t len); |
| 6703 | 267 | |
|
18451
304d2fa12f6a
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18449
diff
changeset
|
268 | /** |
|
304d2fa12f6a
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18449
diff
changeset
|
269 | * Obtains the peer's presented certificates |
|
304d2fa12f6a
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18449
diff
changeset
|
270 | * |
|
304d2fa12f6a
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18449
diff
changeset
|
271 | * @param gsc The SSL connection handle |
|
304d2fa12f6a
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18449
diff
changeset
|
272 | * |
|
304d2fa12f6a
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18449
diff
changeset
|
273 | * @return The peer certificate chain, in the order of certificate, issuer, |
|
20371
ff774b09aabc
Bunch of documentation tidying for the ssl api, and add a doxycomment to
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
274 | * issuer's issuer, etc. @a NULL if no certificates have been provided, |
|
20940
925d3d68b3af
Doxygen @since tags for libpurple and pidgin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20371
diff
changeset
|
275 | * |
|
925d3d68b3af
Doxygen @since tags for libpurple and pidgin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20371
diff
changeset
|
276 | * @since 2.2.0 |
|
18451
304d2fa12f6a
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18449
diff
changeset
|
277 | */ |
|
304d2fa12f6a
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18449
diff
changeset
|
278 | GList * purple_ssl_get_peer_certificates(PurpleSslConnection *gsc); |
|
304d2fa12f6a
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18449
diff
changeset
|
279 | |
| 6703 | 280 | /*@}*/ |
| 281 | ||
| 282 | /**************************************************************************/ | |
| 283 | /** @name Subsystem API */ | |
| 284 | /**************************************************************************/ | |
| 285 | /*@{*/ | |
| 286 | ||
| 287 | /** | |
|
6738
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
288 | * Sets the current SSL operations structure. |
|
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
289 | * |
|
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
290 | * @param ops The SSL operations structure to assign. |
|
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
291 | */ |
| 15884 | 292 | void purple_ssl_set_ops(PurpleSslOps *ops); |
|
6738
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
293 | |
|
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
294 | /** |
|
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
295 | * Returns the current SSL operations structure. |
|
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
296 | * |
|
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
297 | * @return The SSL operations structure. |
|
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
298 | */ |
| 15884 | 299 | PurpleSslOps *purple_ssl_get_ops(void); |
|
6738
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
300 | |
|
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
301 | /** |
| 6703 | 302 | * Initializes the SSL subsystem. |
| 303 | */ | |
| 15884 | 304 | void purple_ssl_init(void); |
| 6703 | 305 | |
| 306 | /** | |
| 307 | * Uninitializes the SSL subsystem. | |
| 308 | */ | |
| 15884 | 309 | void purple_ssl_uninit(void); |
| 6703 | 310 | |
| 311 | /*@}*/ | |
| 312 | ||
| 313 | #ifdef __cplusplus | |
| 314 | } | |
| 315 | #endif | |
| 316 | ||
| 15884 | 317 | #endif /* _PURPLE_SSLCONN_H_ */ |