github.com/krum110487/go-htaccess@v0.0.0-20240316004156-60641c8e7598/tests/data/apache_2_4_58/include/mod_ssl.h (about)

     1  /* Licensed to the Apache Software Foundation (ASF) under one or more
     2   * contributor license agreements.  See the NOTICE file distributed with
     3   * this work for additional information regarding copyright ownership.
     4   * The ASF licenses this file to You under the Apache License, Version 2.0
     5   * (the "License"); you may not use this file except in compliance with
     6   * the License.  You may obtain a copy of the License at
     7   *
     8   *     http://www.apache.org/licenses/LICENSE-2.0
     9   *
    10   * Unless required by applicable law or agreed to in writing, software
    11   * distributed under the License is distributed on an "AS IS" BASIS,
    12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   * See the License for the specific language governing permissions and
    14   * limitations under the License.
    15   */
    16  
    17  /**
    18   * @file mod_ssl.h
    19   * @brief SSL extension module for Apache
    20   *
    21   * @defgroup MOD_SSL mod_ssl
    22   * @ingroup  APACHE_MODS
    23   * @{
    24   */
    25  
    26  #ifndef __MOD_SSL_H__
    27  #define __MOD_SSL_H__
    28  
    29  #include "httpd.h"
    30  #include "http_config.h"
    31  #include "apr_optional.h"
    32  #include "apr_tables.h" /* for apr_array_header_t */
    33  
    34  /* Create a set of SSL_DECLARE(type), SSL_DECLARE_NONSTD(type) and
    35   * SSL_DECLARE_DATA with appropriate export and import tags for the platform
    36   */
    37  #if !defined(WIN32)
    38  #define SSL_DECLARE(type)            type
    39  #define SSL_DECLARE_NONSTD(type)     type
    40  #define SSL_DECLARE_DATA
    41  #elif defined(SSL_DECLARE_STATIC)
    42  #define SSL_DECLARE(type)            type __stdcall
    43  #define SSL_DECLARE_NONSTD(type)     type
    44  #define SSL_DECLARE_DATA
    45  #elif defined(SSL_DECLARE_EXPORT)
    46  #define SSL_DECLARE(type)            __declspec(dllexport) type __stdcall
    47  #define SSL_DECLARE_NONSTD(type)     __declspec(dllexport) type
    48  #define SSL_DECLARE_DATA             __declspec(dllexport)
    49  #else
    50  #define SSL_DECLARE(type)            __declspec(dllimport) type __stdcall
    51  #define SSL_DECLARE_NONSTD(type)     __declspec(dllimport) type
    52  #define SSL_DECLARE_DATA             __declspec(dllimport)
    53  #endif
    54  
    55  /** The ssl_var_lookup() optional function retrieves SSL environment
    56   * variables. */
    57  APR_DECLARE_OPTIONAL_FN(char *, ssl_var_lookup,
    58                          (apr_pool_t *, server_rec *,
    59                           conn_rec *, request_rec *,
    60                           char *));
    61  
    62  /** The ssl_ext_list() optional function attempts to build an array
    63   * of all the values contained in the named X.509 extension. The
    64   * returned array will be created in the supplied pool.
    65   * The client certificate is used if peer is non-zero; the server
    66   * certificate is used otherwise.
    67   * Extension specifies the extensions to use as a string. This can be
    68   * one of the "known" long or short names, or a numeric OID,
    69   * e.g. "1.2.3.4", 'nsComment' and 'DN' are all valid.
    70   * A pointer to an apr_array_header_t structure is returned if at
    71   * least one matching extension is found, NULL otherwise.
    72   */
    73  APR_DECLARE_OPTIONAL_FN(apr_array_header_t *, ssl_ext_list,
    74                          (apr_pool_t *p, conn_rec *c, int peer,
    75                           const char *extension));
    76  
    77  /** An optional function which returns non-zero if the given connection
    78   * is using SSL/TLS. */
    79  APR_DECLARE_OPTIONAL_FN(int, ssl_is_https, (conn_rec *));
    80  
    81  /** The ssl_proxy_enable() and ssl_engine_{set,disable}() optional
    82   * functions are used by mod_proxy to enable use of SSL for outgoing
    83   * connections. */
    84  
    85  APR_DECLARE_OPTIONAL_FN(int, ssl_proxy_enable, (conn_rec *));
    86  APR_DECLARE_OPTIONAL_FN(int, ssl_engine_disable, (conn_rec *));
    87  APR_DECLARE_OPTIONAL_FN(int, ssl_engine_set, (conn_rec *,
    88                                                ap_conf_vector_t *,
    89                                                int proxy, int enable));
    90                                                
    91  /* Check for availability of new hooks */
    92  #define SSL_CERT_HOOKS
    93  #ifdef SSL_CERT_HOOKS
    94  
    95  /** Lets others add certificate and key files to the given server.
    96   * For each cert a key must also be added.
    97   * @param cert_file and array of const char* with the path to the certificate chain
    98   * @param key_file and array of const char* with the path to the private key file
    99   */
   100  APR_DECLARE_EXTERNAL_HOOK(ssl, SSL, int, add_cert_files,
   101                            (server_rec *s, apr_pool_t *p, 
   102                             apr_array_header_t *cert_files,
   103                             apr_array_header_t *key_files))
   104  
   105  /** In case no certificates are available for a server, this
   106   * lets other modules add a fallback certificate for the time
   107   * being. Regular requests against this server will be answered
   108   * with a 503. 
   109   * @param cert_file and array of const char* with the path to the certificate chain
   110   * @param key_file and array of const char* with the path to the private key file
   111   */
   112  APR_DECLARE_EXTERNAL_HOOK(ssl, SSL, int, add_fallback_cert_files,
   113                            (server_rec *s, apr_pool_t *p, 
   114                             apr_array_header_t *cert_files,
   115                             apr_array_header_t *key_files))
   116  
   117  #endif /* SSL_CERT_HOOKS */
   118  
   119  #endif /* __MOD_SSL_H__ */
   120  /** @} */