sslgen.h 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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$
  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. void Curl_ssl_free_certinfo(struct SessionHandle *data);
  61. /* Functions to be used by SSL library adaptation functions */
  62. /* extract a session ID */
  63. int Curl_ssl_getsessionid(struct connectdata *conn,
  64. void **ssl_sessionid,
  65. size_t *idsize) /* set 0 if unknown */;
  66. /* add a new session ID */
  67. CURLcode Curl_ssl_addsessionid(struct connectdata *conn,
  68. void *ssl_sessionid,
  69. size_t idsize);
  70. #define SSL_SHUTDOWN_TIMEOUT 10000 /* ms */
  71. #else
  72. /* When SSL support is not present, just define away these function calls */
  73. #define Curl_ssl_init() 1
  74. #define Curl_ssl_cleanup() do { } while (0)
  75. #define Curl_ssl_connect(x,y) CURLE_FAILED_INIT
  76. #define Curl_ssl_close_all(x)
  77. #define Curl_ssl_close(x,y)
  78. #define Curl_ssl_shutdown(x,y) CURLE_FAILED_INIT
  79. #define Curl_ssl_set_engine(x,y) CURLE_FAILED_INIT
  80. #define Curl_ssl_set_engine_default(x) CURLE_FAILED_INIT
  81. #define Curl_ssl_engines_list(x) NULL
  82. #define Curl_ssl_send(a,b,c,d) -1
  83. #define Curl_ssl_recv(a,b,c,d) -1
  84. #define Curl_ssl_initsessions(x,y) CURLE_OK
  85. #define Curl_ssl_version(x,y) 0
  86. #define Curl_ssl_data_pending(x,y) 0
  87. #define Curl_ssl_check_cxn(x) 0
  88. #define Curl_ssl_free_certinfo(x)
  89. #endif
  90. #endif /* USE_SSL */