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_include.h 19 * @brief Server Side Include Filter Extension Module for Apache 20 * 21 * @defgroup MOD_INCLUDE mod_include 22 * @ingroup APACHE_MODS 23 * @{ 24 */ 25 26#ifndef _MOD_INCLUDE_H 27#define _MOD_INCLUDE_H 1 28 29#include "apr_pools.h" 30#include "apr_optional.h" 31 32/* 33 * Constants used for ap_ssi_get_tag_and_value's decode parameter 34 */ 35#define SSI_VALUE_DECODED 1 36#define SSI_VALUE_RAW 0 37 38/* 39 * Constants used for ap_ssi_parse_string's leave_name parameter 40 */ 41#define SSI_EXPAND_LEAVE_NAME 1 42#define SSI_EXPAND_DROP_NAME 0 43 44/* 45 * This macro creates a bucket which contains an error message and appends it 46 * to the current pass brigade 47 */ 48#define SSI_CREATE_ERROR_BUCKET(ctx, f, bb) APR_BRIGADE_INSERT_TAIL((bb), \ 49 apr_bucket_pool_create(apr_pstrdup((ctx)->pool, (ctx)->error_str), \ 50 strlen((ctx)->error_str), (ctx)->pool, \ 51 (f)->c->bucket_alloc)) 52 53/* 54 * These constants are used to set or clear flag bits. 55 */ 56#define SSI_FLAG_PRINTING (1<<0) /* Printing conditional lines. */ 57#define SSI_FLAG_COND_TRUE (1<<1) /* Conditional eval'd to true. */ 58#define SSI_FLAG_SIZE_IN_BYTES (1<<2) /* Sizes displayed in bytes. */ 59#define SSI_FLAG_NO_EXEC (1<<3) /* No Exec in current context. */ 60 61#define SSI_FLAG_SIZE_ABBREV (~(SSI_FLAG_SIZE_IN_BYTES)) 62#define SSI_FLAG_CLEAR_PRINT_COND (~((SSI_FLAG_PRINTING) | \ 63 (SSI_FLAG_COND_TRUE))) 64#define SSI_FLAG_CLEAR_PRINTING (~(SSI_FLAG_PRINTING)) 65 66/* 67 * The public SSI context structure 68 */ 69typedef struct { 70 /* permanent pool, use this for creating bucket data */ 71 apr_pool_t *pool; 72 73 /* temp pool; will be cleared after the execution of every directive */ 74 apr_pool_t *dpool; 75 76 /* See the SSI_FLAG_XXXXX definitions. */ 77 int flags; 78 79 /* nesting of *invisible* ifs */ 80 int if_nesting_level; 81 82 /* if true, the current buffer will be passed down the filter chain before 83 * continuing with next input bucket and the variable will be reset to 84 * false. 85 */ 86 int flush_now; 87 88 /* argument counter (of the current directive) */ 89 unsigned argc; 90 91 /* currently configured error string */ 92 const char *error_str; 93 94 /* currently configured time format */ 95 const char *time_str; 96 97 /* pointer to internal (non-public) data, don't touch */ 98 struct ssi_internal_ctx *intern; 99} include_ctx_t; 100 101typedef apr_status_t (include_handler_fn_t)(include_ctx_t *, ap_filter_t *, 102 apr_bucket_brigade *); 103 104APR_DECLARE_OPTIONAL_FN(void, ap_ssi_get_tag_and_value, 105 (include_ctx_t *ctx, char **tag, char **tag_val, 106 int dodecode)); 107 108APR_DECLARE_OPTIONAL_FN(char*, ap_ssi_parse_string, 109 (include_ctx_t *ctx, const char *in, char *out, 110 apr_size_t length, int leave_name)); 111 112APR_DECLARE_OPTIONAL_FN(void, ap_register_include_handler, 113 (char *tag, include_handler_fn_t *func)); 114 115#endif /* MOD_INCLUDE */ 116/** @} */ 117