mod_core.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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_core.h
  18. * @brief mod_core private header file
  19. *
  20. * @defgroup MOD_CORE mod_core
  21. * @ingroup APACHE_MODS
  22. * @{
  23. */
  24. #ifndef MOD_CORE_H
  25. #define MOD_CORE_H
  26. #include "apr.h"
  27. #include "apr_buckets.h"
  28. #include "httpd.h"
  29. #include "util_filter.h"
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. /* Handles for core filters */
  34. AP_DECLARE_DATA extern ap_filter_rec_t *ap_http_input_filter_handle;
  35. AP_DECLARE_DATA extern ap_filter_rec_t *ap_http_header_filter_handle;
  36. AP_DECLARE_DATA extern ap_filter_rec_t *ap_chunk_filter_handle;
  37. AP_DECLARE_DATA extern ap_filter_rec_t *ap_http_outerror_filter_handle;
  38. AP_DECLARE_DATA extern ap_filter_rec_t *ap_byterange_filter_handle;
  39. /*
  40. * These (input) filters are internal to the mod_core operation.
  41. */
  42. apr_status_t ap_http_filter(ap_filter_t *f, apr_bucket_brigade *b,
  43. ap_input_mode_t mode, apr_read_type_e block,
  44. apr_off_t readbytes);
  45. /* HTTP/1.1 chunked transfer encoding filter. */
  46. apr_status_t ap_http_chunk_filter(ap_filter_t *f, apr_bucket_brigade *b);
  47. /* Filter to handle any error buckets on output */
  48. apr_status_t ap_http_outerror_filter(ap_filter_t *f,
  49. apr_bucket_brigade *b);
  50. char *ap_response_code_string(request_rec *r, int error_index);
  51. /**
  52. * Send the minimal part of an HTTP response header.
  53. * @param r The current request
  54. * @param bb The brigade to add the header to.
  55. * @warning Modules should be very careful about using this, and should
  56. * the default behavior. Much of the HTTP/1.1 implementation
  57. * correctness depends on the full headers.
  58. * @fn void ap_basic_http_header(request_rec *r, apr_bucket_brigade *bb)
  59. */
  60. AP_DECLARE(void) ap_basic_http_header(request_rec *r, apr_bucket_brigade *bb);
  61. /**
  62. * Send an appropriate response to an http TRACE request.
  63. * @param r The current request
  64. * @note returns DONE or the HTTP status error if it handles the TRACE,
  65. * or DECLINED if the request was not for TRACE.
  66. * request method was not TRACE.
  67. */
  68. AP_DECLARE_NONSTD(int) ap_send_http_trace(request_rec *r);
  69. /**
  70. * Send an appropriate response to an http OPTIONS request.
  71. * @param r The current request
  72. */
  73. AP_DECLARE(int) ap_send_http_options(request_rec *r);
  74. /* Used for multipart/byteranges boundary string */
  75. AP_DECLARE_DATA extern const char *ap_multipart_boundary;
  76. /* Init RNG at startup */
  77. AP_CORE_DECLARE(void) ap_init_rng(apr_pool_t *p);
  78. /* Update RNG state in parent after fork */
  79. AP_CORE_DECLARE(void) ap_random_parent_after_fork(void);
  80. #ifdef __cplusplus
  81. }
  82. #endif
  83. #endif /* !MOD_CORE_H */
  84. /** @} */