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, 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
27#ifdef USE_SCHANNEL
28
29#include "urldata.h"
30
31#ifndef UNISP_NAME_A
32#define UNISP_NAME_A "Microsoft Unified Security Protocol Provider"
33#endif
34
35#ifndef UNISP_NAME_W
36#define UNISP_NAME_W L"Microsoft Unified Security Protocol Provider"
37#endif
38
39#ifndef UNISP_NAME
40#ifdef UNICODE
41#define UNISP_NAME  UNISP_NAME_W
42#else
43#define UNISP_NAME  UNISP_NAME_A
44#endif
45#endif
46
47#ifndef SP_PROT_SSL2_CLIENT
48#define SP_PROT_SSL2_CLIENT             0x00000008
49#endif
50
51#ifndef SP_PROT_SSL3_CLIENT
52#define SP_PROT_SSL3_CLIENT             0x00000008
53#endif
54
55#ifndef SP_PROT_TLS1_CLIENT
56#define SP_PROT_TLS1_CLIENT             0x00000080
57#endif
58
59#ifndef SP_PROT_TLS1_0_CLIENT
60#define SP_PROT_TLS1_0_CLIENT           SP_PROT_TLS1_CLIENT
61#endif
62
63#ifndef SP_PROT_TLS1_1_CLIENT
64#define SP_PROT_TLS1_1_CLIENT           0x00000200
65#endif
66
67#ifndef SP_PROT_TLS1_2_CLIENT
68#define SP_PROT_TLS1_2_CLIENT           0x00000800
69#endif
70
71#ifndef SECBUFFER_ALERT
72#define SECBUFFER_ALERT                 17
73#endif
74
75#ifndef ISC_RET_REPLAY_DETECT
76#define ISC_RET_REPLAY_DETECT           0x00000004
77#endif
78
79#ifndef ISC_RET_SEQUENCE_DETECT
80#define ISC_RET_SEQUENCE_DETECT         0x00000008
81#endif
82
83#ifndef ISC_RET_CONFIDENTIALITY
84#define ISC_RET_CONFIDENTIALITY         0x00000010
85#endif
86
87#ifndef ISC_RET_ALLOCATED_MEMORY
88#define ISC_RET_ALLOCATED_MEMORY        0x00000100
89#endif
90
91#ifndef ISC_RET_STREAM
92#define ISC_RET_STREAM                  0x00008000
93#endif
94
95
96#define CURL_SCHANNEL_BUFFER_INIT_SIZE   4096
97#define CURL_SCHANNEL_BUFFER_FREE_SIZE   1024
98#define CURL_SCHANNEL_BUFFER_STEP_FACTOR 2
99
100
101CURLcode Curl_schannel_connect(struct connectdata *conn, int sockindex);
102
103CURLcode Curl_schannel_connect_nonblocking(struct connectdata *conn,
104                                           int sockindex,
105                                           bool *done);
106
107bool Curl_schannel_data_pending(const struct connectdata *conn, int sockindex);
108void Curl_schannel_close(struct connectdata *conn, int sockindex);
109int Curl_schannel_shutdown(struct connectdata *conn, int sockindex);
110void Curl_schannel_session_free(void *ptr);
111
112int Curl_schannel_init(void);
113void Curl_schannel_cleanup(void);
114size_t Curl_schannel_version(char *buffer, size_t size);
115
116/* API setup for Schannel */
117#define curlssl_init Curl_schannel_init
118#define curlssl_cleanup Curl_schannel_cleanup
119#define curlssl_connect Curl_schannel_connect
120#define curlssl_connect_nonblocking Curl_schannel_connect_nonblocking
121#define curlssl_session_free Curl_schannel_session_free
122#define curlssl_close_all(x) (x=x, CURLE_NOT_BUILT_IN)
123#define curlssl_close Curl_schannel_close
124#define curlssl_shutdown Curl_schannel_shutdown
125#define curlssl_set_engine(x,y) (x=x, y=y, CURLE_NOT_BUILT_IN)
126#define curlssl_set_engine_default(x) (x=x, CURLE_NOT_BUILT_IN)
127#define curlssl_engines_list(x) (x=x, (struct curl_slist *)NULL)
128#define curlssl_version Curl_schannel_version
129#define curlssl_check_cxn(x) (x=x, -1)
130#define curlssl_data_pending Curl_schannel_data_pending
131#endif /* USE_SCHANNEL */
132#endif /* HEADER_CURL_SCHANNEL_H */
133