Blame modules/filters/mod_include.h

Packit 90a5c9
/* Licensed to the Apache Software Foundation (ASF) under one or more
Packit 90a5c9
 * contributor license agreements.  See the NOTICE file distributed with
Packit 90a5c9
 * this work for additional information regarding copyright ownership.
Packit 90a5c9
 * The ASF licenses this file to You under the Apache License, Version 2.0
Packit 90a5c9
 * (the "License"); you may not use this file except in compliance with
Packit 90a5c9
 * the License.  You may obtain a copy of the License at
Packit 90a5c9
 *
Packit 90a5c9
 *     http://www.apache.org/licenses/LICENSE-2.0
Packit 90a5c9
 *
Packit 90a5c9
 * Unless required by applicable law or agreed to in writing, software
Packit 90a5c9
 * distributed under the License is distributed on an "AS IS" BASIS,
Packit 90a5c9
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Packit 90a5c9
 * See the License for the specific language governing permissions and
Packit 90a5c9
 * limitations under the License.
Packit 90a5c9
 */
Packit 90a5c9
Packit 90a5c9
/**
Packit 90a5c9
 * @file mod_include.h
Packit 90a5c9
 * @brief Server Side Include Filter Extension Module for Apache
Packit 90a5c9
 *
Packit 90a5c9
 * @defgroup MOD_INCLUDE mod_include
Packit 90a5c9
 * @ingroup APACHE_MODS
Packit 90a5c9
 * @{
Packit 90a5c9
 */
Packit 90a5c9
Packit 90a5c9
#ifndef _MOD_INCLUDE_H
Packit 90a5c9
#define _MOD_INCLUDE_H 1
Packit 90a5c9
Packit 90a5c9
#include "apr_pools.h"
Packit 90a5c9
#include "apr_optional.h"
Packit 90a5c9
Packit 90a5c9
/*
Packit 90a5c9
 * Constants used for ap_ssi_get_tag_and_value's decode parameter
Packit 90a5c9
 */
Packit 90a5c9
#define SSI_VALUE_DECODED 1
Packit 90a5c9
#define SSI_VALUE_RAW     0
Packit 90a5c9
Packit 90a5c9
/*
Packit 90a5c9
 * Constants used for ap_ssi_parse_string's leave_name parameter
Packit 90a5c9
 */
Packit 90a5c9
#define SSI_EXPAND_LEAVE_NAME 1
Packit 90a5c9
#define SSI_EXPAND_DROP_NAME  0
Packit 90a5c9
Packit 90a5c9
/*
Packit 90a5c9
 * This macro creates a bucket which contains an error message and appends it
Packit 90a5c9
 * to the current pass brigade
Packit 90a5c9
 */
Packit 90a5c9
#define SSI_CREATE_ERROR_BUCKET(ctx, f, bb) APR_BRIGADE_INSERT_TAIL((bb), \
Packit 90a5c9
    apr_bucket_pool_create(apr_pstrdup((ctx)->pool, (ctx)->error_str),    \
Packit 90a5c9
                           strlen((ctx)->error_str), (ctx)->pool,         \
Packit 90a5c9
                           (f)->c->bucket_alloc))
Packit 90a5c9
Packit 90a5c9
/*
Packit 90a5c9
 * These constants are used to set or clear flag bits.
Packit 90a5c9
 */
Packit 90a5c9
#define SSI_FLAG_PRINTING         (1<<0)  /* Printing conditional lines. */
Packit 90a5c9
#define SSI_FLAG_COND_TRUE        (1<<1)  /* Conditional eval'd to true. */
Packit 90a5c9
#define SSI_FLAG_SIZE_IN_BYTES    (1<<2)  /* Sizes displayed in bytes.   */
Packit 90a5c9
#define SSI_FLAG_NO_EXEC          (1<<3)  /* No Exec in current context. */
Packit 90a5c9
Packit 90a5c9
#define SSI_FLAG_SIZE_ABBREV      (~(SSI_FLAG_SIZE_IN_BYTES))
Packit 90a5c9
#define SSI_FLAG_CLEAR_PRINT_COND (~((SSI_FLAG_PRINTING) | \
Packit 90a5c9
                                     (SSI_FLAG_COND_TRUE)))
Packit 90a5c9
#define SSI_FLAG_CLEAR_PRINTING   (~(SSI_FLAG_PRINTING))
Packit 90a5c9
Packit 90a5c9
/*
Packit 90a5c9
 * The public SSI context structure
Packit 90a5c9
 */
Packit 90a5c9
typedef struct {
Packit 90a5c9
    /* permanent pool, use this for creating bucket data */
Packit 90a5c9
    apr_pool_t  *pool;
Packit 90a5c9
Packit 90a5c9
    /* temp pool; will be cleared after the execution of every directive */
Packit 90a5c9
    apr_pool_t  *dpool;
Packit 90a5c9
Packit 90a5c9
    /* See the SSI_FLAG_XXXXX definitions. */
Packit 90a5c9
    int          flags;
Packit 90a5c9
Packit 90a5c9
    /* nesting of *invisible* ifs */
Packit 90a5c9
    int          if_nesting_level;
Packit 90a5c9
Packit 90a5c9
    /* if true, the current buffer will be passed down the filter chain before
Packit 90a5c9
     * continuing with next input bucket and the variable will be reset to
Packit 90a5c9
     * false.
Packit 90a5c9
     */
Packit 90a5c9
    int          flush_now;
Packit 90a5c9
Packit 90a5c9
    /* argument counter (of the current directive) */
Packit 90a5c9
    unsigned     argc;
Packit 90a5c9
Packit 90a5c9
    /* currently configured error string */
Packit 90a5c9
    const char  *error_str;
Packit 90a5c9
Packit 90a5c9
    /* currently configured time format */
Packit 90a5c9
    const char  *time_str;
Packit 90a5c9
Packit 90a5c9
    /* the current request */
Packit 90a5c9
    request_rec  *r;
Packit 90a5c9
Packit 90a5c9
    /* pointer to internal (non-public) data, don't touch */
Packit 90a5c9
    struct ssi_internal_ctx *intern;
Packit 90a5c9
Packit 90a5c9
} include_ctx_t;
Packit 90a5c9
Packit 90a5c9
typedef apr_status_t (include_handler_fn_t)(include_ctx_t *, ap_filter_t *,
Packit 90a5c9
                                            apr_bucket_brigade *);
Packit 90a5c9
Packit 90a5c9
APR_DECLARE_OPTIONAL_FN(void, ap_ssi_get_tag_and_value,
Packit 90a5c9
                        (include_ctx_t *ctx, char **tag, char **tag_val,
Packit 90a5c9
                         int dodecode));
Packit 90a5c9
Packit 90a5c9
APR_DECLARE_OPTIONAL_FN(char*, ap_ssi_parse_string,
Packit 90a5c9
                        (include_ctx_t *ctx, const char *in, char *out,
Packit 90a5c9
                         apr_size_t length, int leave_name));
Packit 90a5c9
Packit 90a5c9
APR_DECLARE_OPTIONAL_FN(void, ap_register_include_handler,
Packit 90a5c9
                        (char *tag, include_handler_fn_t *func));
Packit 90a5c9
Packit 90a5c9
#endif /* MOD_INCLUDE */
Packit 90a5c9
/** @} */