sslgen.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #ifndef __SSLGEN_H
  2. #define __SSLGEN_H
  3. /***************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) 1998 - 2008, Daniel Stenberg, <[email protected]>, 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$
  24. ***************************************************************************/
  25. bool Curl_ssl_config_matches(struct ssl_config_data* data,
  26. struct ssl_config_data* needle);
  27. bool Curl_clone_ssl_config(struct ssl_config_data* source,
  28. struct ssl_config_data* dest);
  29. void Curl_free_ssl_config(struct ssl_config_data* sslc);
  30. #ifdef USE_SSL
  31. int Curl_ssl_init(void);
  32. void Curl_ssl_cleanup(void);
  33. CURLcode Curl_ssl_connect(struct connectdata *conn, int sockindex);
  34. CURLcode Curl_ssl_connect_nonblocking(struct connectdata *conn,
  35. int sockindex,
  36. bool *done);
  37. /* tell the SSL stuff to close down all open information regarding
  38. connections (and thus session ID caching etc) */
  39. void Curl_ssl_close_all(struct SessionHandle *data);
  40. void Curl_ssl_close(struct connectdata *conn, int sockindex);
  41. CURLcode Curl_ssl_shutdown(struct connectdata *conn, int sockindex);
  42. CURLcode Curl_ssl_set_engine(struct SessionHandle *data, const char *engine);
  43. /* Sets engine as default for all SSL operations */
  44. CURLcode Curl_ssl_set_engine_default(struct SessionHandle *data);
  45. struct curl_slist *Curl_ssl_engines_list(struct SessionHandle *data);
  46. ssize_t Curl_ssl_send(struct connectdata *conn,
  47. int sockindex,
  48. const void *mem,
  49. size_t len);
  50. ssize_t Curl_ssl_recv(struct connectdata *conn, /* connection data */
  51. int sockindex, /* socketindex */
  52. char *mem, /* store read data here */
  53. size_t len); /* max amount to read */
  54. /* init the SSL session ID cache */
  55. CURLcode Curl_ssl_initsessions(struct SessionHandle *, long);
  56. size_t Curl_ssl_version(char *buffer, size_t size);
  57. bool Curl_ssl_data_pending(const struct connectdata *conn,
  58. int connindex);
  59. int Curl_ssl_check_cxn(struct connectdata *conn);
  60. #else
  61. /* When SSL support is not present, just define away these function calls */
  62. #define Curl_ssl_init() 1
  63. #define Curl_ssl_cleanup() do { } while (0)
  64. #define Curl_ssl_connect(x,y) CURLE_FAILED_INIT
  65. #define Curl_ssl_connect_nonblocking(x,y,z) (z=z, CURLE_FAILED_INIT)
  66. #define Curl_ssl_close_all(x)
  67. #define Curl_ssl_close(x,y)
  68. #define Curl_ssl_shutdown(x,y) CURLE_FAILED_INIT
  69. #define Curl_ssl_set_engine(x,y) CURLE_FAILED_INIT
  70. #define Curl_ssl_set_engine_default(x) CURLE_FAILED_INIT
  71. #define Curl_ssl_engines_list(x) NULL
  72. #define Curl_ssl_send(a,b,c,d) -1
  73. #define Curl_ssl_recv(a,b,c,d) -1
  74. #define Curl_ssl_initsessions(x,y) CURLE_OK
  75. #define Curl_ssl_version(x,y) 0
  76. #define Curl_ssl_data_pending(x,y) 0
  77. #define Curl_ssl_check_cxn(x) 0
  78. #endif
  79. /* extract a session ID */
  80. int Curl_ssl_getsessionid(struct connectdata *conn,
  81. void **ssl_sessionid,
  82. size_t *idsize) /* set 0 if unknown */;
  83. /* add a new session ID */
  84. CURLcode Curl_ssl_addsessionid(struct connectdata *conn,
  85. void *ssl_sessionid,
  86. size_t idsize);
  87. #if !defined(USE_SSL) && !defined(SSLGEN_C)
  88. /* set up blank macros for none-SSL builds */
  89. #define Curl_ssl_close_all(x)
  90. #endif
  91. #define SSL_SHUTDOWN_TIMEOUT 10000 /* ms */
  92. #endif