mod_ssl.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  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. * @file mod_ssl.h
  18. * @brief SSL extension module for Apache
  19. *
  20. * @defgroup MOD_SSL mod_ssl
  21. * @ingroup APACHE_MODS
  22. * @{
  23. */
  24. #ifndef __MOD_SSL_H__
  25. #define __MOD_SSL_H__
  26. #include "httpd.h"
  27. #include "http_config.h"
  28. #include "apr_optional.h"
  29. #include "apr_tables.h" /* for apr_array_header_t */
  30. /* Create a set of SSL_DECLARE(type), SSL_DECLARE_NONSTD(type) and
  31. * SSL_DECLARE_DATA with appropriate export and import tags for the platform
  32. */
  33. #if !defined(WIN32)
  34. #define SSL_DECLARE(type) type
  35. #define SSL_DECLARE_NONSTD(type) type
  36. #define SSL_DECLARE_DATA
  37. #elif defined(SSL_DECLARE_STATIC)
  38. #define SSL_DECLARE(type) type __stdcall
  39. #define SSL_DECLARE_NONSTD(type) type
  40. #define SSL_DECLARE_DATA
  41. #elif defined(SSL_DECLARE_EXPORT)
  42. #define SSL_DECLARE(type) __declspec(dllexport) type __stdcall
  43. #define SSL_DECLARE_NONSTD(type) __declspec(dllexport) type
  44. #define SSL_DECLARE_DATA __declspec(dllexport)
  45. #else
  46. #define SSL_DECLARE(type) __declspec(dllimport) type __stdcall
  47. #define SSL_DECLARE_NONSTD(type) __declspec(dllimport) type
  48. #define SSL_DECLARE_DATA __declspec(dllimport)
  49. #endif
  50. /** The ssl_var_lookup() optional function retrieves SSL environment
  51. * variables. */
  52. APR_DECLARE_OPTIONAL_FN(char *, ssl_var_lookup,
  53. (apr_pool_t *, server_rec *,
  54. conn_rec *, request_rec *,
  55. char *));
  56. /** The ssl_ext_list() optional function attempts to build an array
  57. * of all the values contained in the named X.509 extension. The
  58. * returned array will be created in the supplied pool.
  59. * The client certificate is used if peer is non-zero; the server
  60. * certificate is used otherwise.
  61. * Extension specifies the extensions to use as a string. This can be
  62. * one of the "known" long or short names, or a numeric OID,
  63. * e.g. "1.2.3.4", 'nsComment' and 'DN' are all valid.
  64. * A pointer to an apr_array_header_t structure is returned if at
  65. * least one matching extension is found, NULL otherwise.
  66. */
  67. APR_DECLARE_OPTIONAL_FN(apr_array_header_t *, ssl_ext_list,
  68. (apr_pool_t *p, conn_rec *c, int peer,
  69. const char *extension));
  70. /** An optional function which returns non-zero if the given connection
  71. * is using SSL/TLS. */
  72. APR_DECLARE_OPTIONAL_FN(int, ssl_is_https, (conn_rec *));
  73. /** The ssl_proxy_enable() and ssl_engine_{set,disable}() optional
  74. * functions are used by mod_proxy to enable use of SSL for outgoing
  75. * connections. */
  76. APR_DECLARE_OPTIONAL_FN(int, ssl_proxy_enable, (conn_rec *));
  77. APR_DECLARE_OPTIONAL_FN(int, ssl_engine_disable, (conn_rec *));
  78. APR_DECLARE_OPTIONAL_FN(int, ssl_engine_set, (conn_rec *,
  79. ap_conf_vector_t *,
  80. int proxy, int enable));
  81. /* Check for availability of new hooks */
  82. #define SSL_CERT_HOOKS
  83. #ifdef SSL_CERT_HOOKS
  84. /** Lets others add certificate and key files to the given server.
  85. * For each cert a key must also be added.
  86. * @param cert_file and array of const char* with the path to the certificate chain
  87. * @param key_file and array of const char* with the path to the private key file
  88. */
  89. APR_DECLARE_EXTERNAL_HOOK(ssl, SSL, int, add_cert_files,
  90. (server_rec *s, apr_pool_t *p,
  91. apr_array_header_t *cert_files,
  92. apr_array_header_t *key_files))
  93. /** In case no certificates are available for a server, this
  94. * lets other modules add a fallback certificate for the time
  95. * being. Regular requests against this server will be answered
  96. * with a 503.
  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_fallback_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. #endif /* SSL_CERT_HOOKS */
  105. #endif /* __MOD_SSL_H__ */
  106. /** @} */