sslgen.h 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. #ifndef __SSLGEN_H
  2. #define __SSLGEN_H
  3. /***************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) 1998 - 2008, 2010, 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. bool Curl_ssl_config_matches(struct ssl_config_data* data,
  25. struct ssl_config_data* needle);
  26. bool Curl_clone_ssl_config(struct ssl_config_data* source,
  27. struct ssl_config_data* dest);
  28. void Curl_free_ssl_config(struct ssl_config_data* sslc);
  29. #ifdef USE_SSL
  30. int Curl_ssl_init(void);
  31. void Curl_ssl_cleanup(void);
  32. CURLcode Curl_ssl_connect(struct connectdata *conn, int sockindex);
  33. CURLcode Curl_ssl_connect_nonblocking(struct connectdata *conn,
  34. int sockindex,
  35. bool *done);
  36. /* tell the SSL stuff to close down all open information regarding
  37. connections (and thus session ID caching etc) */
  38. void Curl_ssl_close_all(struct SessionHandle *data);
  39. void Curl_ssl_close(struct connectdata *conn, int sockindex);
  40. CURLcode Curl_ssl_shutdown(struct connectdata *conn, int sockindex);
  41. CURLcode Curl_ssl_set_engine(struct SessionHandle *data, const char *engine);
  42. /* Sets engine as default for all SSL operations */
  43. CURLcode Curl_ssl_set_engine_default(struct SessionHandle *data);
  44. struct curl_slist *Curl_ssl_engines_list(struct SessionHandle *data);
  45. /* init the SSL session ID cache */
  46. CURLcode Curl_ssl_initsessions(struct SessionHandle *, long);
  47. size_t Curl_ssl_version(char *buffer, size_t size);
  48. bool Curl_ssl_data_pending(const struct connectdata *conn,
  49. int connindex);
  50. int Curl_ssl_check_cxn(struct connectdata *conn);
  51. void Curl_ssl_free_certinfo(struct SessionHandle *data);
  52. /* Functions to be used by SSL library adaptation functions */
  53. /* extract a session ID */
  54. int Curl_ssl_getsessionid(struct connectdata *conn,
  55. void **ssl_sessionid,
  56. size_t *idsize) /* set 0 if unknown */;
  57. /* add a new session ID */
  58. CURLcode Curl_ssl_addsessionid(struct connectdata *conn,
  59. void *ssl_sessionid,
  60. size_t idsize);
  61. /* delete a session from the cache */
  62. void Curl_ssl_delsessionid(struct connectdata *conn, void *ssl_sessionid);
  63. #define SSL_SHUTDOWN_TIMEOUT 10000 /* ms */
  64. #else
  65. /* When SSL support is not present, just define away these function calls */
  66. #define Curl_ssl_init() 1
  67. #define Curl_ssl_cleanup() do { } while (0)
  68. #define Curl_ssl_connect(x,y) CURLE_FAILED_INIT
  69. #define Curl_ssl_close_all(x)
  70. #define Curl_ssl_close(x,y)
  71. #define Curl_ssl_shutdown(x,y) CURLE_FAILED_INIT
  72. #define Curl_ssl_set_engine(x,y) CURLE_FAILED_INIT
  73. #define Curl_ssl_set_engine_default(x) CURLE_FAILED_INIT
  74. #define Curl_ssl_engines_list(x) NULL
  75. #define Curl_ssl_send(a,b,c,d,e) -1
  76. #define Curl_ssl_recv(a,b,c,d,e) -1
  77. #define Curl_ssl_initsessions(x,y) CURLE_OK
  78. #define Curl_ssl_version(x,y) 0
  79. #define Curl_ssl_data_pending(x,y) 0
  80. #define Curl_ssl_check_cxn(x) 0
  81. #define Curl_ssl_free_certinfo(x)
  82. #endif
  83. #endif /* USE_SSL */