1#ifndef HEADER_CURL_SSLGEN_H
2#define HEADER_CURL_SSLGEN_H
3/***************************************************************************
4 *                                  _   _ ____  _
5 *  Project                     ___| | | |  _ \| |
6 *                             / __| | | | |_) | |
7 *                            | (__| |_| |  _ <| |___
8 *                             \___|\___/|_| \_\_____|
9 *
10 * Copyright (C) 1998 - 2011, Daniel Stenberg, <daniel@haxx.se>, et al.
11 *
12 * This software is licensed as described in the file COPYING, which
13 * you should have received as part of this distribution. The terms
14 * are also available at http://curl.haxx.se/docs/copyright.html.
15 *
16 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 * copies of the Software, and permit persons to whom the Software is
18 * furnished to do so, under the terms of the COPYING file.
19 *
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
22 *
23 ***************************************************************************/
24#include "setup.h"
25
26bool Curl_ssl_config_matches(struct ssl_config_data* data,
27                             struct ssl_config_data* needle);
28bool Curl_clone_ssl_config(struct ssl_config_data* source,
29                           struct ssl_config_data* dest);
30void Curl_free_ssl_config(struct ssl_config_data* sslc);
31
32#ifdef USE_SSL
33int Curl_ssl_init(void);
34void Curl_ssl_cleanup(void);
35CURLcode Curl_ssl_connect(struct connectdata *conn, int sockindex);
36CURLcode Curl_ssl_connect_nonblocking(struct connectdata *conn,
37                                      int sockindex,
38                                      bool *done);
39/* tell the SSL stuff to close down all open information regarding
40   connections (and thus session ID caching etc) */
41void Curl_ssl_close_all(struct SessionHandle *data);
42void Curl_ssl_close(struct connectdata *conn, int sockindex);
43CURLcode Curl_ssl_shutdown(struct connectdata *conn, int sockindex);
44CURLcode Curl_ssl_set_engine(struct SessionHandle *data, const char *engine);
45/* Sets engine as default for all SSL operations */
46CURLcode Curl_ssl_set_engine_default(struct SessionHandle *data);
47struct curl_slist *Curl_ssl_engines_list(struct SessionHandle *data);
48
49/* init the SSL session ID cache */
50CURLcode Curl_ssl_initsessions(struct SessionHandle *, long);
51size_t Curl_ssl_version(char *buffer, size_t size);
52bool Curl_ssl_data_pending(const struct connectdata *conn,
53                           int connindex);
54int Curl_ssl_check_cxn(struct connectdata *conn);
55void Curl_ssl_free_certinfo(struct SessionHandle *data);
56
57/* Functions to be used by SSL library adaptation functions */
58
59/* extract a session ID */
60int Curl_ssl_getsessionid(struct connectdata *conn,
61                          void **ssl_sessionid,
62                          size_t *idsize) /* set 0 if unknown */;
63/* add a new session ID */
64CURLcode Curl_ssl_addsessionid(struct connectdata *conn,
65                               void *ssl_sessionid,
66                               size_t idsize);
67/* Kill a single session ID entry in the cache */
68int Curl_ssl_kill_session(struct curl_ssl_session *session);
69/* delete a session from the cache */
70void Curl_ssl_delsessionid(struct connectdata *conn, void *ssl_sessionid);
71
72#define SSL_SHUTDOWN_TIMEOUT 10000 /* ms */
73
74#else
75/* When SSL support is not present, just define away these function calls */
76#define Curl_ssl_init() 1
77#define Curl_ssl_cleanup() Curl_nop_stmt
78#define Curl_ssl_connect(x,y) CURLE_NOT_BUILT_IN
79#define Curl_ssl_close_all(x) Curl_nop_stmt
80#define Curl_ssl_close(x,y) Curl_nop_stmt
81#define Curl_ssl_shutdown(x,y) CURLE_NOT_BUILT_IN
82#define Curl_ssl_set_engine(x,y) CURLE_NOT_BUILT_IN
83#define Curl_ssl_set_engine_default(x) CURLE_NOT_BUILT_IN
84#define Curl_ssl_engines_list(x) NULL
85#define Curl_ssl_send(a,b,c,d,e) -1
86#define Curl_ssl_recv(a,b,c,d,e) -1
87#define Curl_ssl_initsessions(x,y) CURLE_OK
88#define Curl_ssl_version(x,y) 0
89#define Curl_ssl_data_pending(x,y) 0
90#define Curl_ssl_check_cxn(x) 0
91#define Curl_ssl_free_certinfo(x) Curl_nop_stmt
92#define Curl_ssl_connect_nonblocking(x,y,z) CURLE_NOT_BUILT_IN
93#define Curl_ssl_kill_session(x) 0
94#endif
95
96#endif /* HEADER_CURL_SSLGEN_H */
97