curl_schannel.h 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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, <info@marc-hoersken.de>, et al.
  11. * Copyright (C) 2012 - 2014, Daniel Stenberg, <daniel@haxx.se>, 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 http://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. #ifndef ISC_RET_REPLAY_DETECT
  63. #define ISC_RET_REPLAY_DETECT 0x00000004
  64. #endif
  65. #ifndef ISC_RET_SEQUENCE_DETECT
  66. #define ISC_RET_SEQUENCE_DETECT 0x00000008
  67. #endif
  68. #ifndef ISC_RET_CONFIDENTIALITY
  69. #define ISC_RET_CONFIDENTIALITY 0x00000010
  70. #endif
  71. #ifndef ISC_RET_ALLOCATED_MEMORY
  72. #define ISC_RET_ALLOCATED_MEMORY 0x00000100
  73. #endif
  74. #ifndef ISC_RET_STREAM
  75. #define ISC_RET_STREAM 0x00008000
  76. #endif
  77. #define CURL_SCHANNEL_BUFFER_INIT_SIZE 4096
  78. #define CURL_SCHANNEL_BUFFER_FREE_SIZE 1024
  79. #define CURL_SCHANNEL_BUFFER_STEP_FACTOR 2
  80. CURLcode Curl_schannel_connect(struct connectdata *conn, int sockindex);
  81. CURLcode Curl_schannel_connect_nonblocking(struct connectdata *conn,
  82. int sockindex,
  83. bool *done);
  84. bool Curl_schannel_data_pending(const struct connectdata *conn, int sockindex);
  85. void Curl_schannel_close(struct connectdata *conn, int sockindex);
  86. int Curl_schannel_shutdown(struct connectdata *conn, int sockindex);
  87. void Curl_schannel_session_free(void *ptr);
  88. int Curl_schannel_init(void);
  89. void Curl_schannel_cleanup(void);
  90. size_t Curl_schannel_version(char *buffer, size_t size);
  91. int Curl_schannel_random(unsigned char *entropy, size_t length);
  92. /* API setup for Schannel */
  93. #define curlssl_init Curl_schannel_init
  94. #define curlssl_cleanup Curl_schannel_cleanup
  95. #define curlssl_connect Curl_schannel_connect
  96. #define curlssl_connect_nonblocking Curl_schannel_connect_nonblocking
  97. #define curlssl_session_free Curl_schannel_session_free
  98. #define curlssl_close_all(x) (x=x, CURLE_NOT_BUILT_IN)
  99. #define curlssl_close Curl_schannel_close
  100. #define curlssl_shutdown Curl_schannel_shutdown
  101. #define curlssl_set_engine(x,y) (x=x, y=y, CURLE_NOT_BUILT_IN)
  102. #define curlssl_set_engine_default(x) (x=x, CURLE_NOT_BUILT_IN)
  103. #define curlssl_engines_list(x) (x=x, (struct curl_slist *)NULL)
  104. #define curlssl_version Curl_schannel_version
  105. #define curlssl_check_cxn(x) (x=x, -1)
  106. #define curlssl_data_pending Curl_schannel_data_pending
  107. #define CURL_SSL_BACKEND CURLSSLBACKEND_SCHANNEL
  108. #define curlssl_random(x,y,z) ((void)x, Curl_schannel_random(y,z))
  109. #endif /* USE_SCHANNEL */
  110. #endif /* HEADER_CURL_SCHANNEL_H */