Sun, 25 Sep 2011 18:56:58 +0000
Clean the API documentation in preparation for 3.0.0 by removing all the old @since tags.
| 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 | |
|
25630
f9fb8da4b5ec
Sprinkle some @copydoc directives around to shut up some doxygen whining.
Etan Reisner <deryni@pidgin.im>
parents:
24569
diff
changeset
|
42 | /** @copydoc _PurpleSslConnection */ |
| 15884 | 43 | typedef struct _PurpleSslConnection PurpleSslConnection; |
|
6738
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
44 | |
| 15884 | 45 | typedef void (*PurpleSslInputFunction)(gpointer, PurpleSslConnection *, |
| 46 | PurpleInputCondition); | |
| 47 | typedef void (*PurpleSslErrorFunction)(PurpleSslConnection *, PurpleSslErrorType, | |
|
7274
42ec5f56e32a
[gaim-migrate @ 7851]
Christian Hammond <chipx86@chipx86.com>
parents:
6783
diff
changeset
|
48 | gpointer); |
|
6738
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
49 | |
| 15884 | 50 | struct _PurpleSslConnection |
|
6738
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
51 | { |
|
17314
db5063b444df
Partial documentation on SslConnection struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17313
diff
changeset
|
52 | /** Hostname to which the SSL connection will be made */ |
|
6738
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
53 | char *host; |
|
17314
db5063b444df
Partial documentation on SslConnection struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17313
diff
changeset
|
54 | /** Port to connect to */ |
|
6738
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
55 | int port; |
|
17315
b6976c48ec78
More documenting
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17314
diff
changeset
|
56 | /** Data to pass to PurpleSslConnection::connect_cb() */ |
| 6764 | 57 | void *connect_cb_data; |
|
17315
b6976c48ec78
More documenting
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17314
diff
changeset
|
58 | /** Callback triggered once the SSL handshake is complete */ |
| 15884 | 59 | PurpleSslInputFunction connect_cb; |
|
17316
a511aef67b4f
- Completed SslConnection fields docs
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17315
diff
changeset
|
60 | /** Callback triggered if there is an error during connection */ |
| 15884 | 61 | PurpleSslErrorFunction error_cb; |
|
17315
b6976c48ec78
More documenting
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17314
diff
changeset
|
62 | /** Data passed to PurpleSslConnection::recv_cb() */ |
| 6764 | 63 | void *recv_cb_data; |
|
17316
a511aef67b4f
- Completed SslConnection fields docs
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17315
diff
changeset
|
64 | /** User-defined callback executed when the SSL connection receives data */ |
| 15884 | 65 | PurpleSslInputFunction recv_cb; |
|
6738
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
66 | |
|
17314
db5063b444df
Partial documentation on SslConnection struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17313
diff
changeset
|
67 | /** File descriptor used to refer to the socket */ |
|
6738
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
68 | int fd; |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
24569
diff
changeset
|
69 | /** Glib event source ID; used to refer to the received data callback |
|
17316
a511aef67b4f
- Completed SslConnection fields docs
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17315
diff
changeset
|
70 | * in the glib eventloop */ |
|
24262
51ba71b5e5e2
The variable we use to keep track of the watcher of the ssl connection
Mark Doliner <markdoliner@pidgin.im>
parents:
21211
diff
changeset
|
71 | guint inpa; |
|
17316
a511aef67b4f
- Completed SslConnection fields docs
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17315
diff
changeset
|
72 | /** Data related to the underlying TCP connection */ |
| 15884 | 73 | PurpleProxyConnectData *connect_data; |
|
6738
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
74 | |
|
17314
db5063b444df
Partial documentation on SslConnection struct
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17313
diff
changeset
|
75 | /** 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
|
76 | void *private_data; |
|
18464
7fb7cb707a19
- Add verifier field to SslConnection
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18451
diff
changeset
|
77 | |
|
7fb7cb707a19
- Add verifier field to SslConnection
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18451
diff
changeset
|
78 | /** Verifier to use in authenticating the peer */ |
|
7fb7cb707a19
- Add verifier field to SslConnection
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18451
diff
changeset
|
79 | PurpleCertificateVerifier *verifier; |
|
6738
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 | /** |
|
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
83 | * SSL implementation operations structure. |
|
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
84 | * |
|
17315
b6976c48ec78
More documenting
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17314
diff
changeset
|
85 | * 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
|
86 | * 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
|
87 | */ |
|
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
88 | typedef struct |
|
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
89 | { |
|
17312
ba4bc8d967f8
Documented the SslOps structure
William Ehlhardt <williamehlhardt@gmail.com>
parents:
16743
diff
changeset
|
90 | /** 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
|
91 | * @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
|
92 | * @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
|
93 | */ |
|
6738
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
94 | 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
|
95 | /** 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
|
96 | * @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
|
97 | */ |
|
6738
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
98 | 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
|
99 | /** 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
|
100 | * 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
|
101 | * @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
|
102 | */ |
| 15884 | 103 | void (*connectfunc)(PurpleSslConnection *gsc); |
|
17313
c8b649e48d4f
Clarify documentation
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17312
diff
changeset
|
104 | /** Destroys the internal data of the SSL connection provided. |
|
c8b649e48d4f
Clarify documentation
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17312
diff
changeset
|
105 | * 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
|
106 | * @see purple_ssl_close |
|
17313
c8b649e48d4f
Clarify documentation
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17312
diff
changeset
|
107 | */ |
| 15884 | 108 | void (*close)(PurpleSslConnection *gsc); |
|
17312
ba4bc8d967f8
Documented the SslOps structure
William Ehlhardt <williamehlhardt@gmail.com>
parents:
16743
diff
changeset
|
109 | /** 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
|
110 | * @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
|
111 | * @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
|
112 | * @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
|
113 | * @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
|
114 | * 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
|
115 | * @see purple_ssl_read |
|
17312
ba4bc8d967f8
Documented the SslOps structure
William Ehlhardt <williamehlhardt@gmail.com>
parents:
16743
diff
changeset
|
116 | */ |
| 15884 | 117 | 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
|
118 | /** 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
|
119 | * @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
|
120 | * @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
|
121 | * @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
|
122 | * @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
|
123 | * @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
|
124 | * @see purple_ssl_write |
|
17312
ba4bc8d967f8
Documented the SslOps structure
William Ehlhardt <williamehlhardt@gmail.com>
parents:
16743
diff
changeset
|
125 | */ |
| 15884 | 126 | 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
|
127 | /** 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
|
128 | * |
|
212bfb9c9cc7
- Expose get_peer_certificates in the SslOps struct, and modify gnutls
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17430
diff
changeset
|
129 | * @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
|
130 | * @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
|
131 | * the peer provided. |
|
18464
7fb7cb707a19
- Add verifier field to SslConnection
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18451
diff
changeset
|
132 | * @see PurpleCertificate |
|
18246
212bfb9c9cc7
- Expose get_peer_certificates in the SslOps struct, and modify gnutls
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17430
diff
changeset
|
133 | * @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
|
134 | * 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
|
135 | */ |
|
212bfb9c9cc7
- Expose get_peer_certificates in the SslOps struct, and modify gnutls
William Ehlhardt <williamehlhardt@gmail.com>
parents:
17430
diff
changeset
|
136 | GList * (* get_peer_certificates)(PurpleSslConnection * gsc); |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
24569
diff
changeset
|
137 | |
|
16743
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_reserved2)(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_reserved3)(void); |
|
1ce5ffe12e2a
Initial addition of padding for ui_ops and other class-like structs
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
140 | void (*_purple_reserved4)(void); |
| 15884 | 141 | } PurpleSslOps; |
|
6738
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
142 | |
| 6703 | 143 | #ifdef __cplusplus |
| 144 | extern "C" { | |
| 145 | #endif | |
| 146 | ||
| 147 | /**************************************************************************/ | |
| 148 | /** @name SSL API */ | |
| 149 | /**************************************************************************/ | |
| 150 | /*@{*/ | |
| 151 | ||
| 152 | /** | |
| 153 | * Returns whether or not SSL is currently supported. | |
| 154 | * | |
|
20371
ff774b09aabc
Bunch of documentation tidying for the ssl api, and add a doxycomment to
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
155 | * @return @a TRUE if SSL is supported, or @a FALSE otherwise. |
| 6703 | 156 | */ |
| 15884 | 157 | gboolean purple_ssl_is_supported(void); |
| 6703 | 158 | |
| 159 | /** | |
|
20371
ff774b09aabc
Bunch of documentation tidying for the ssl api, and add a doxycomment to
Will Thompson <resiak@pidgin.im>
parents:
20147
diff
changeset
|
160 | * 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
|
161 | * |
|
0730e45141fd
- Add purple_ssl_strerror for handy error description power!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18474
diff
changeset
|
162 | * @param error Error code |
|
0730e45141fd
- Add purple_ssl_strerror for handy error description power!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18474
diff
changeset
|
163 | * @return Human-readable error explanation |
|
0730e45141fd
- Add purple_ssl_strerror for handy error description power!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18474
diff
changeset
|
164 | */ |
|
0730e45141fd
- Add purple_ssl_strerror for handy error description power!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18474
diff
changeset
|
165 | 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
|
166 | |
|
0730e45141fd
- Add purple_ssl_strerror for handy error description power!
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18474
diff
changeset
|
167 | /** |
|
14312
6ce4512aa9a8
[gaim-migrate @ 16932]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
168 | * 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
|
169 | * 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
|
170 | * connection, if needed. |
| 6703 | 171 | * |
|
7274
42ec5f56e32a
[gaim-migrate @ 7851]
Christian Hammond <chipx86@chipx86.com>
parents:
6783
diff
changeset
|
172 | * @param account The account making the connection. |
|
42ec5f56e32a
[gaim-migrate @ 7851]
Christian Hammond <chipx86@chipx86.com>
parents:
6783
diff
changeset
|
173 | * @param host The destination host. |
|
42ec5f56e32a
[gaim-migrate @ 7851]
Christian Hammond <chipx86@chipx86.com>
parents:
6783
diff
changeset
|
174 | * @param port The destination port. |
|
42ec5f56e32a
[gaim-migrate @ 7851]
Christian Hammond <chipx86@chipx86.com>
parents:
6783
diff
changeset
|
175 | * @param func The SSL input handler function. |
|
14312
6ce4512aa9a8
[gaim-migrate @ 16932]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
176 | * @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
|
177 | * 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
|
178 | * the event of an error the #PurpleSslConnection will be |
|
14312
6ce4512aa9a8
[gaim-migrate @ 16932]
Mark Doliner <markdoliner@pidgin.im>
parents:
14254
diff
changeset
|
179 | * destroyed for you. |
|
7274
42ec5f56e32a
[gaim-migrate @ 7851]
Christian Hammond <chipx86@chipx86.com>
parents:
6783
diff
changeset
|
180 | * @param data User-defined data. |
| 6703 | 181 | * |
| 182 | * @return The SSL connection handle. | |
| 183 | */ | |
| 15884 | 184 | PurpleSslConnection *purple_ssl_connect(PurpleAccount *account, const char *host, |
| 185 | int port, PurpleSslInputFunction func, | |
| 186 | PurpleSslErrorFunction error_func, | |
| 6703 | 187 | void *data); |
| 188 | ||
|
27813
7989c9bb5000
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <darkrain42@pidgin.im>
parents:
25911
diff
changeset
|
189 | /** |
|
7989c9bb5000
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <darkrain42@pidgin.im>
parents:
25911
diff
changeset
|
190 | * Makes a SSL connection to the specified host and port, using the separate |
|
7989c9bb5000
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <darkrain42@pidgin.im>
parents:
25911
diff
changeset
|
191 | * name to verify with the certificate. The caller should keep track of the |
|
7989c9bb5000
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <darkrain42@pidgin.im>
parents:
25911
diff
changeset
|
192 | * returned value and use it to cancel the connection, if needed. |
|
7989c9bb5000
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <darkrain42@pidgin.im>
parents:
25911
diff
changeset
|
193 | * |
|
7989c9bb5000
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <darkrain42@pidgin.im>
parents:
25911
diff
changeset
|
194 | * @param account The account making the connection. |
|
7989c9bb5000
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <darkrain42@pidgin.im>
parents:
25911
diff
changeset
|
195 | * @param host The destination host. |
|
7989c9bb5000
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <darkrain42@pidgin.im>
parents:
25911
diff
changeset
|
196 | * @param port The destination port. |
|
7989c9bb5000
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <darkrain42@pidgin.im>
parents:
25911
diff
changeset
|
197 | * @param func The SSL input handler function. |
|
7989c9bb5000
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <darkrain42@pidgin.im>
parents:
25911
diff
changeset
|
198 | * @param error_func The SSL error handler function. This function |
|
7989c9bb5000
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <darkrain42@pidgin.im>
parents:
25911
diff
changeset
|
199 | * should <strong>NOT</strong> call purple_ssl_close(). In |
|
7989c9bb5000
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <darkrain42@pidgin.im>
parents:
25911
diff
changeset
|
200 | * the event of an error the #PurpleSslConnection will be |
|
7989c9bb5000
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <darkrain42@pidgin.im>
parents:
25911
diff
changeset
|
201 | * destroyed for you. |
|
7989c9bb5000
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <darkrain42@pidgin.im>
parents:
25911
diff
changeset
|
202 | * @param ssl_host The hostname of the other peer (to verify the CN) |
|
7989c9bb5000
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <darkrain42@pidgin.im>
parents:
25911
diff
changeset
|
203 | * @param data User-defined data. |
|
7989c9bb5000
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <darkrain42@pidgin.im>
parents:
25911
diff
changeset
|
204 | * |
|
7989c9bb5000
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <darkrain42@pidgin.im>
parents:
25911
diff
changeset
|
205 | * @return The SSL connection handle. |
|
7989c9bb5000
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <darkrain42@pidgin.im>
parents:
25911
diff
changeset
|
206 | */ |
|
7989c9bb5000
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <darkrain42@pidgin.im>
parents:
25911
diff
changeset
|
207 | PurpleSslConnection *purple_ssl_connect_with_ssl_cn(PurpleAccount *account, const char *host, |
|
7989c9bb5000
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <darkrain42@pidgin.im>
parents:
25911
diff
changeset
|
208 | int port, PurpleSslInputFunction func, |
|
7989c9bb5000
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <darkrain42@pidgin.im>
parents:
25911
diff
changeset
|
209 | PurpleSslErrorFunction error_func, |
|
7989c9bb5000
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <darkrain42@pidgin.im>
parents:
25911
diff
changeset
|
210 | const char *ssl_host, |
|
7989c9bb5000
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <darkrain42@pidgin.im>
parents:
25911
diff
changeset
|
211 | void *data); |
|
7989c9bb5000
Add purple_ssl_connect_with_ssl_cn, which takes a host to connect to
Paul Aurich <darkrain42@pidgin.im>
parents:
25911
diff
changeset
|
212 | |
|
18449
2d2df64f4303
applied changes from f9186fabb483b56a9d7e8fb7241b2520e9930413
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18246
diff
changeset
|
213 | /** |
|
20940
925d3d68b3af
Doxygen @since tags for libpurple and pidgin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20371
diff
changeset
|
214 | * 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
|
215 | * |
|
925d3d68b3af
Doxygen @since tags for libpurple and pidgin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20371
diff
changeset
|
216 | * @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
|
217 | * @param fd The file descriptor. |
|
925d3d68b3af
Doxygen @since tags for libpurple and pidgin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20371
diff
changeset
|
218 | * @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
|
219 | * @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
|
220 | * @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
|
221 | * @param data User-defined data. |
|
925d3d68b3af
Doxygen @since tags for libpurple and pidgin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20371
diff
changeset
|
222 | * |
|
925d3d68b3af
Doxygen @since tags for libpurple and pidgin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20371
diff
changeset
|
223 | * @return The SSL connection handle. |
|
925d3d68b3af
Doxygen @since tags for libpurple and pidgin.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20371
diff
changeset
|
224 | */ |
|
18449
2d2df64f4303
applied changes from f9186fabb483b56a9d7e8fb7241b2520e9930413
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18246
diff
changeset
|
225 | 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
|
226 | PurpleSslInputFunction func, |
|
2d2df64f4303
applied changes from f9186fabb483b56a9d7e8fb7241b2520e9930413
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18246
diff
changeset
|
227 | PurpleSslErrorFunction error_func, |
|
2d2df64f4303
applied changes from f9186fabb483b56a9d7e8fb7241b2520e9930413
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18246
diff
changeset
|
228 | const char *host, |
|
2d2df64f4303
applied changes from f9186fabb483b56a9d7e8fb7241b2520e9930413
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18246
diff
changeset
|
229 | void *data); |
|
7274
42ec5f56e32a
[gaim-migrate @ 7851]
Christian Hammond <chipx86@chipx86.com>
parents:
6783
diff
changeset
|
230 | |
|
42ec5f56e32a
[gaim-migrate @ 7851]
Christian Hammond <chipx86@chipx86.com>
parents:
6783
diff
changeset
|
231 | /** |
| 6764 | 232 | * 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
|
233 | * Once the SSL handshake is complete, use this to watch for actual data across it. |
| 6764 | 234 | * |
| 235 | * @param gsc The SSL connection handle. | |
| 236 | * @param func The callback function. | |
| 237 | * @param data User-defined data. | |
| 238 | */ | |
| 15884 | 239 | void purple_ssl_input_add(PurpleSslConnection *gsc, PurpleSslInputFunction func, |
|
7274
42ec5f56e32a
[gaim-migrate @ 7851]
Christian Hammond <chipx86@chipx86.com>
parents:
6783
diff
changeset
|
240 | void *data); |
|
6762
2349053f14aa
[gaim-migrate @ 7294]
Christian Hammond <chipx86@chipx86.com>
parents:
6738
diff
changeset
|
241 | |
|
2349053f14aa
[gaim-migrate @ 7294]
Christian Hammond <chipx86@chipx86.com>
parents:
6738
diff
changeset
|
242 | /** |
| 6703 | 243 | * Closes a SSL connection. |
| 244 | * | |
| 245 | * @param gsc The SSL connection to close. | |
| 246 | */ | |
| 15884 | 247 | void purple_ssl_close(PurpleSslConnection *gsc); |
| 6703 | 248 | |
| 249 | /** | |
| 250 | * Reads data from an SSL connection. | |
| 251 | * | |
| 252 | * @param gsc The SSL connection handle. | |
| 253 | * @param buffer The destination buffer. | |
| 254 | * @param len The maximum number of bytes to read. | |
| 255 | * | |
| 256 | * @return The number of bytes read. | |
| 257 | */ | |
| 15884 | 258 | size_t purple_ssl_read(PurpleSslConnection *gsc, void *buffer, size_t len); |
| 6703 | 259 | |
| 260 | /** | |
| 261 | * Writes data to an SSL connection. | |
| 262 | * | |
|
6720
cdc5348dd848
[gaim-migrate @ 7247]
Christian Hammond <chipx86@chipx86.com>
parents:
6703
diff
changeset
|
263 | * @param gsc The SSL connection handle. |
|
cdc5348dd848
[gaim-migrate @ 7247]
Christian Hammond <chipx86@chipx86.com>
parents:
6703
diff
changeset
|
264 | * @param buffer The buffer to write. |
|
cdc5348dd848
[gaim-migrate @ 7247]
Christian Hammond <chipx86@chipx86.com>
parents:
6703
diff
changeset
|
265 | * @param len The length of the data to write. |
| 6703 | 266 | * |
| 267 | * @return The number of bytes written. | |
| 268 | */ | |
| 15884 | 269 | size_t purple_ssl_write(PurpleSslConnection *gsc, const void *buffer, size_t len); |
| 6703 | 270 | |
|
18451
304d2fa12f6a
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18449
diff
changeset
|
271 | /** |
|
304d2fa12f6a
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18449
diff
changeset
|
272 | * Obtains the peer's presented certificates |
|
304d2fa12f6a
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18449
diff
changeset
|
273 | * |
|
304d2fa12f6a
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18449
diff
changeset
|
274 | * @param gsc The SSL connection handle |
|
304d2fa12f6a
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18449
diff
changeset
|
275 | * |
|
304d2fa12f6a
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18449
diff
changeset
|
276 | * @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
|
277 | * issuer's issuer, etc. @a NULL if no certificates have been provided, |
|
18451
304d2fa12f6a
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18449
diff
changeset
|
278 | */ |
|
304d2fa12f6a
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18449
diff
changeset
|
279 | GList * purple_ssl_get_peer_certificates(PurpleSslConnection *gsc); |
|
304d2fa12f6a
- purple_ssl_get_peer_certificates
William Ehlhardt <williamehlhardt@gmail.com>
parents:
18449
diff
changeset
|
280 | |
| 6703 | 281 | /*@}*/ |
| 282 | ||
| 283 | /**************************************************************************/ | |
| 284 | /** @name Subsystem API */ | |
| 285 | /**************************************************************************/ | |
| 286 | /*@{*/ | |
| 287 | ||
| 288 | /** | |
|
6738
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
289 | * Sets the current SSL operations structure. |
|
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
290 | * |
|
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
291 | * @param ops The SSL operations structure to assign. |
|
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
292 | */ |
| 15884 | 293 | void purple_ssl_set_ops(PurpleSslOps *ops); |
|
6738
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 | /** |
|
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
296 | * Returns the current SSL operations structure. |
|
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
297 | * |
|
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
298 | * @return The SSL operations structure. |
|
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
299 | */ |
| 15884 | 300 | PurpleSslOps *purple_ssl_get_ops(void); |
|
6738
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
301 | |
|
aa797bcc69dd
[gaim-migrate @ 7270]
Christian Hammond <chipx86@chipx86.com>
parents:
6720
diff
changeset
|
302 | /** |
| 6703 | 303 | * Initializes the SSL subsystem. |
| 304 | */ | |
| 15884 | 305 | void purple_ssl_init(void); |
| 6703 | 306 | |
| 307 | /** | |
| 308 | * Uninitializes the SSL subsystem. | |
| 309 | */ | |
| 15884 | 310 | void purple_ssl_uninit(void); |
| 6703 | 311 | |
| 312 | /*@}*/ | |
| 313 | ||
| 314 | #ifdef __cplusplus | |
| 315 | } | |
| 316 | #endif | |
| 317 | ||
| 15884 | 318 | #endif /* _PURPLE_SSLCONN_H_ */ |