Home | History | Annotate | Download | only in vtls
      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 (at) marc-hoersken.de>, et al.
     11  * Copyright (C) 2012 - 2015, Daniel Stenberg, <daniel (at) 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 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 
     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 /* Both schannel buffer sizes must be > 0 */
     76 #define CURL_SCHANNEL_BUFFER_INIT_SIZE   4096
     77 #define CURL_SCHANNEL_BUFFER_FREE_SIZE   1024
     78 
     79 
     80 CURLcode Curl_schannel_connect(struct connectdata *conn, int sockindex);
     81 
     82 CURLcode Curl_schannel_connect_nonblocking(struct connectdata *conn,
     83                                            int sockindex,
     84                                            bool *done);
     85 
     86 bool Curl_schannel_data_pending(const struct connectdata *conn, int sockindex);
     87 void Curl_schannel_close(struct connectdata *conn, int sockindex);
     88 int Curl_schannel_shutdown(struct connectdata *conn, int sockindex);
     89 void Curl_schannel_session_free(void *ptr);
     90 
     91 int Curl_schannel_init(void);
     92 void Curl_schannel_cleanup(void);
     93 size_t Curl_schannel_version(char *buffer, size_t size);
     94 
     95 int Curl_schannel_random(unsigned char *entropy, size_t length);
     96 
     97 /* Set the API backend definition to Schannel */
     98 #define CURL_SSL_BACKEND CURLSSLBACKEND_SCHANNEL
     99 
    100 /* this backend supports CURLOPT_CERTINFO */
    101 #define have_curlssl_certinfo 1
    102 
    103 /* API setup for Schannel */
    104 #define curlssl_init Curl_schannel_init
    105 #define curlssl_cleanup Curl_schannel_cleanup
    106 #define curlssl_connect Curl_schannel_connect
    107 #define curlssl_connect_nonblocking Curl_schannel_connect_nonblocking
    108 #define curlssl_session_free Curl_schannel_session_free
    109 #define curlssl_close_all(x) ((void)x)
    110 #define curlssl_close Curl_schannel_close
    111 #define curlssl_shutdown Curl_schannel_shutdown
    112 #define curlssl_set_engine(x,y) ((void)x, (void)y, CURLE_NOT_BUILT_IN)
    113 #define curlssl_set_engine_default(x) ((void)x, CURLE_NOT_BUILT_IN)
    114 #define curlssl_engines_list(x) ((void)x, (struct curl_slist *)NULL)
    115 #define curlssl_version Curl_schannel_version
    116 #define curlssl_check_cxn(x) ((void)x, -1)
    117 #define curlssl_data_pending Curl_schannel_data_pending
    118 #define curlssl_random(x,y,z) ((void)x, Curl_schannel_random(y,z))
    119 
    120 #endif /* USE_SCHANNEL */
    121 #endif /* HEADER_CURL_SCHANNEL_H */
    122