schannel.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. #ifndef HEADER_CURL_SCHANNEL_H
  2. #define HEADER_CURL_SCHANNEL_H
  3. /***************************************************************************
  4. * _ _ ____ _
  5. * Project ___| | | | _ \| |
  6. * / __| | | | |_) | |
  7. * | (__| |_| | _ <| |___
  8. * \___|\___/|_| \_\_____|
  9. *
  10. * Copyright (C) 2012, Marc Hoersken, <[email protected]>, et al.
  11. * Copyright (C) 2012 - 2015, Daniel Stenberg, <[email protected]>, et al.
  12. *
  13. * This software is licensed as described in the file COPYING, which
  14. * you should have received as part of this distribution. The terms
  15. * are also available at https://curl.haxx.se/docs/copyright.html.
  16. *
  17. * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  18. * copies of the Software, and permit persons to whom the Software is
  19. * furnished to do so, under the terms of the COPYING file.
  20. *
  21. * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  22. * KIND, either express or implied.
  23. *
  24. ***************************************************************************/
  25. #include "curl_setup.h"
  26. #ifdef USE_SCHANNEL
  27. #include "urldata.h"
  28. #ifndef UNISP_NAME_A
  29. #define UNISP_NAME_A "Microsoft Unified Security Protocol Provider"
  30. #endif
  31. #ifndef UNISP_NAME_W
  32. #define UNISP_NAME_W L"Microsoft Unified Security Protocol Provider"
  33. #endif
  34. #ifndef UNISP_NAME
  35. #ifdef UNICODE
  36. #define UNISP_NAME UNISP_NAME_W
  37. #else
  38. #define UNISP_NAME UNISP_NAME_A
  39. #endif
  40. #endif
  41. #ifndef SP_PROT_SSL2_CLIENT
  42. #define SP_PROT_SSL2_CLIENT 0x00000008
  43. #endif
  44. #ifndef SP_PROT_SSL3_CLIENT
  45. #define SP_PROT_SSL3_CLIENT 0x00000008
  46. #endif
  47. #ifndef SP_PROT_TLS1_CLIENT
  48. #define SP_PROT_TLS1_CLIENT 0x00000080
  49. #endif
  50. #ifndef SP_PROT_TLS1_0_CLIENT
  51. #define SP_PROT_TLS1_0_CLIENT SP_PROT_TLS1_CLIENT
  52. #endif
  53. #ifndef SP_PROT_TLS1_1_CLIENT
  54. #define SP_PROT_TLS1_1_CLIENT 0x00000200
  55. #endif
  56. #ifndef SP_PROT_TLS1_2_CLIENT
  57. #define SP_PROT_TLS1_2_CLIENT 0x00000800
  58. #endif
  59. #ifndef SECBUFFER_ALERT
  60. #define SECBUFFER_ALERT 17
  61. #endif
  62. /* Both schannel buffer sizes must be > 0 */
  63. #define CURL_SCHANNEL_BUFFER_INIT_SIZE 4096
  64. #define CURL_SCHANNEL_BUFFER_FREE_SIZE 1024
  65. CURLcode Curl_schannel_connect(struct connectdata *conn, int sockindex);
  66. CURLcode Curl_schannel_connect_nonblocking(struct connectdata *conn,
  67. int sockindex,
  68. bool *done);
  69. bool Curl_schannel_data_pending(const struct connectdata *conn, int sockindex);
  70. void Curl_schannel_close(struct connectdata *conn, int sockindex);
  71. int Curl_schannel_shutdown(struct connectdata *conn, int sockindex);
  72. void Curl_schannel_session_free(void *ptr);
  73. int Curl_schannel_init(void);
  74. void Curl_schannel_cleanup(void);
  75. size_t Curl_schannel_version(char *buffer, size_t size);
  76. int Curl_schannel_random(unsigned char *entropy, size_t length);
  77. /* Set the API backend definition to Schannel */
  78. #define CURL_SSL_BACKEND CURLSSLBACKEND_SCHANNEL
  79. /* this backend supports CURLOPT_CERTINFO */
  80. #define have_curlssl_certinfo 1
  81. /* API setup for Schannel */
  82. #define curlssl_init Curl_schannel_init
  83. #define curlssl_cleanup Curl_schannel_cleanup
  84. #define curlssl_connect Curl_schannel_connect
  85. #define curlssl_connect_nonblocking Curl_schannel_connect_nonblocking
  86. #define curlssl_session_free Curl_schannel_session_free
  87. #define curlssl_close_all(x) ((void)x)
  88. #define curlssl_close Curl_schannel_close
  89. #define curlssl_shutdown Curl_schannel_shutdown
  90. #define curlssl_set_engine(x,y) ((void)x, (void)y, CURLE_NOT_BUILT_IN)
  91. #define curlssl_set_engine_default(x) ((void)x, CURLE_NOT_BUILT_IN)
  92. #define curlssl_engines_list(x) ((void)x, (struct curl_slist *)NULL)
  93. #define curlssl_version Curl_schannel_version
  94. #define curlssl_check_cxn(x) ((void)x, -1)
  95. #define curlssl_data_pending Curl_schannel_data_pending
  96. #define curlssl_random(x,y,z) ((void)x, Curl_schannel_random(y,z))
  97. #endif /* USE_SCHANNEL */
  98. #endif /* HEADER_CURL_SCHANNEL_H */