1 #ifndef __SSLGEN_H 2 #define __SSLGEN_H 3 /*************************************************************************** 4 * _ _ ____ _ 5 * Project ___| | | | _ \| | 6 * / __| | | | |_) | | 7 * | (__| |_| | _ <| |___ 8 * \___|\___/|_| \_\_____| 9 * 10 * Copyright (C) 1998 - 2008, 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 * $Id: sslgen.h,v 1.17 2008-11-11 22:19:27 bagder Exp $ 24 ***************************************************************************/ 25 26 bool Curl_ssl_config_matches(struct ssl_config_data* data, 27 struct ssl_config_data* needle); 28 bool Curl_clone_ssl_config(struct ssl_config_data* source, 29 struct ssl_config_data* dest); 30 void Curl_free_ssl_config(struct ssl_config_data* sslc); 31 32 #ifdef USE_SSL 33 int Curl_ssl_init(void); 34 void Curl_ssl_cleanup(void); 35 CURLcode Curl_ssl_connect(struct connectdata *conn, int sockindex); 36 CURLcode 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) */ 41 void Curl_ssl_close_all(struct SessionHandle *data); 42 void Curl_ssl_close(struct connectdata *conn, int sockindex); 43 CURLcode Curl_ssl_shutdown(struct connectdata *conn, int sockindex); 44 CURLcode Curl_ssl_set_engine(struct SessionHandle *data, const char *engine); 45 /* Sets engine as default for all SSL operations */ 46 CURLcode Curl_ssl_set_engine_default(struct SessionHandle *data); 47 struct curl_slist *Curl_ssl_engines_list(struct SessionHandle *data); 48 ssize_t Curl_ssl_send(struct connectdata *conn, 49 int sockindex, 50 const void *mem, 51 size_t len); 52 ssize_t Curl_ssl_recv(struct connectdata *conn, /* connection data */ 53 int sockindex, /* socketindex */ 54 char *mem, /* store read data here */ 55 size_t len); /* max amount to read */ 56 /* init the SSL session ID cache */ 57 CURLcode Curl_ssl_initsessions(struct SessionHandle *, long); 58 size_t Curl_ssl_version(char *buffer, size_t size); 59 bool Curl_ssl_data_pending(const struct connectdata *conn, 60 int connindex); 61 int Curl_ssl_check_cxn(struct connectdata *conn); 62 void Curl_ssl_free_certinfo(struct SessionHandle *data); 63 64 /* Functions to be used by SSL library adaptation functions */ 65 66 /* extract a session ID */ 67 int Curl_ssl_getsessionid(struct connectdata *conn, 68 void **ssl_sessionid, 69 size_t *idsize) /* set 0 if unknown */; 70 /* add a new session ID */ 71 CURLcode Curl_ssl_addsessionid(struct connectdata *conn, 72 void *ssl_sessionid, 73 size_t idsize); 74 75 #define SSL_SHUTDOWN_TIMEOUT 10000 /* ms */ 76 77 #else 78 /* When SSL support is not present, just define away these function calls */ 79 #define Curl_ssl_init() 1 80 #define Curl_ssl_cleanup() do { } while (0) 81 #define Curl_ssl_connect(x,y) CURLE_FAILED_INIT 82 #define Curl_ssl_close_all(x) 83 #define Curl_ssl_close(x,y) 84 #define Curl_ssl_shutdown(x,y) CURLE_FAILED_INIT 85 #define Curl_ssl_set_engine(x,y) CURLE_FAILED_INIT 86 #define Curl_ssl_set_engine_default(x) CURLE_FAILED_INIT 87 #define Curl_ssl_engines_list(x) NULL 88 #define Curl_ssl_send(a,b,c,d) -1 89 #define Curl_ssl_recv(a,b,c,d) -1 90 #define Curl_ssl_initsessions(x,y) CURLE_OK 91 #define Curl_ssl_version(x,y) 0 92 #define Curl_ssl_data_pending(x,y) 0 93 #define Curl_ssl_check_cxn(x) 0 94 #define Curl_ssl_free_certinfo(x) 95 96 #endif 97 98 #endif /* USE_SSL */ 99