842ae4bd224140319ae7feec1872b93dfd491143fielding/* Licensed to the Apache Software Foundation (ASF) under one or more
842ae4bd224140319ae7feec1872b93dfd491143fielding * contributor license agreements. See the NOTICE file distributed with
842ae4bd224140319ae7feec1872b93dfd491143fielding * this work for additional information regarding copyright ownership.
842ae4bd224140319ae7feec1872b93dfd491143fielding * The ASF licenses this file to You under the Apache License, Version 2.0
842ae4bd224140319ae7feec1872b93dfd491143fielding * (the "License"); you may not use this file except in compliance with
842ae4bd224140319ae7feec1872b93dfd491143fielding * the License. You may obtain a copy of the License at
c1a9af42c178bed7efa0a6bb7f45f46ffb269719rbb *
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd * http://www.apache.org/licenses/LICENSE-2.0
c1a9af42c178bed7efa0a6bb7f45f46ffb269719rbb *
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd * Unless required by applicable law or agreed to in writing, software
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd * distributed under the License is distributed on an "AS IS" BASIS,
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd * See the License for the specific language governing permissions and
ce9621257ef9e54c1bbe5ad8a5f445a1f211c2dcnd * limitations under the License.
c1a9af42c178bed7efa0a6bb7f45f46ffb269719rbb */
c1a9af42c178bed7efa0a6bb7f45f46ffb269719rbb
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh/**
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * @file util_cfgtree.h
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * @brief Config Tree Package
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh *
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * @defgroup APACHE_CORE_CONFIG_TREE Config Tree Package
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * @ingroup APACHE_CORE_CONFIG
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * @{
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh */
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh
c1a9af42c178bed7efa0a6bb7f45f46ffb269719rbb#ifndef AP_CONFTREE_H
c1a9af42c178bed7efa0a6bb7f45f46ffb269719rbb#define AP_CONFTREE_H
c1a9af42c178bed7efa0a6bb7f45f46ffb269719rbb
0af0bae91bd14e86a02d05fbd88105267ae4b244trawick#include "ap_config.h"
0af0bae91bd14e86a02d05fbd88105267ae4b244trawick
1075efe007e7af339bde09cbb175d4f4d676eeb5rpluem#ifdef __cplusplus
1075efe007e7af339bde09cbb175d4f4d676eeb5rpluemextern "C" {
1075efe007e7af339bde09cbb175d4f4d676eeb5rpluem#endif
1075efe007e7af339bde09cbb175d4f4d676eeb5rpluem
f6431843a765abbef9e79a26f4a5f077f0cef7dbrbbtypedef struct ap_directive_t ap_directive_t;
f6431843a765abbef9e79a26f4a5f077f0cef7dbrbb
f6431843a765abbef9e79a26f4a5f077f0cef7dbrbb/**
742318b93e89c311f66b55f426c4d9cf2c14628bjim * @brief Structure used to build the config tree.
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh *
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh * The config tree only stores
f6431843a765abbef9e79a26f4a5f077f0cef7dbrbb * the directives that will be active in the running server. Directives
f47c690c6fa01fa4334306be872da72fb9a3cdadsctemme * that contain other directions, such as <Directory ...> cause a sub-level
f6431843a765abbef9e79a26f4a5f077f0cef7dbrbb * to be created, where the included directives are stored. The closing
f47c690c6fa01fa4334306be872da72fb9a3cdadsctemme * directive (</Directory>) is not stored in the tree.
f6431843a765abbef9e79a26f4a5f077f0cef7dbrbb */
f6431843a765abbef9e79a26f4a5f077f0cef7dbrbbstruct ap_directive_t {
f6431843a765abbef9e79a26f4a5f077f0cef7dbrbb /** The current directive */
c1a9af42c178bed7efa0a6bb7f45f46ffb269719rbb const char *directive;
742318b93e89c311f66b55f426c4d9cf2c14628bjim /** The arguments for the current directive, stored as a space
f6431843a765abbef9e79a26f4a5f077f0cef7dbrbb * separated list */
c1a9af42c178bed7efa0a6bb7f45f46ffb269719rbb const char *args;
f47c690c6fa01fa4334306be872da72fb9a3cdadsctemme /** The next directive node in the tree */
c1a9af42c178bed7efa0a6bb7f45f46ffb269719rbb struct ap_directive_t *next;
f47c690c6fa01fa4334306be872da72fb9a3cdadsctemme /** The first child node of this directive */
c1a9af42c178bed7efa0a6bb7f45f46ffb269719rbb struct ap_directive_t *first_child;
f47c690c6fa01fa4334306be872da72fb9a3cdadsctemme /** The parent node of this directive */
c1a9af42c178bed7efa0a6bb7f45f46ffb269719rbb struct ap_directive_t *parent;
9346b854b0827ae0645b456ffd2b4938f1e73c03gstein
f6431843a765abbef9e79a26f4a5f077f0cef7dbrbb /** directive's module can store add'l data here */
f6431843a765abbef9e79a26f4a5f077f0cef7dbrbb void *data;
9346b854b0827ae0645b456ffd2b4938f1e73c03gstein
9346b854b0827ae0645b456ffd2b4938f1e73c03gstein /* ### these may go away in the future, but are needed for now */
f6431843a765abbef9e79a26f4a5f077f0cef7dbrbb /** The name of the file this directive was found in */
9346b854b0827ae0645b456ffd2b4938f1e73c03gstein const char *filename;
f6431843a765abbef9e79a26f4a5f077f0cef7dbrbb /** The line number the directive was on */
9346b854b0827ae0645b456ffd2b4938f1e73c03gstein int line_num;
d974a1624c0bb4f1c2e8b36fcf8ba1f12284ed8dsf
d974a1624c0bb4f1c2e8b36fcf8ba1f12284ed8dsf /** A short-cut towards the last directive node in the tree.
d974a1624c0bb4f1c2e8b36fcf8ba1f12284ed8dsf * The value may not always be up-to-date but it always points to
d974a1624c0bb4f1c2e8b36fcf8ba1f12284ed8dsf * somewhere in the tree, nearer to the tail.
d974a1624c0bb4f1c2e8b36fcf8ba1f12284ed8dsf * This value is only set in the first node
d974a1624c0bb4f1c2e8b36fcf8ba1f12284ed8dsf */
d974a1624c0bb4f1c2e8b36fcf8ba1f12284ed8dsf struct ap_directive_t *last;
f6431843a765abbef9e79a26f4a5f077f0cef7dbrbb};
9346b854b0827ae0645b456ffd2b4938f1e73c03gstein
69b3b88588e73701b14b6e925dedb339869fb12arbb/**
69b3b88588e73701b14b6e925dedb339869fb12arbb * The root of the configuration tree
69b3b88588e73701b14b6e925dedb339869fb12arbb */
c032b37ad682c1da5382258811e8e35a8ec0d78dwroweAP_DECLARE_DATA extern ap_directive_t *ap_conftree;
69b3b88588e73701b14b6e925dedb339869fb12arbb
f6431843a765abbef9e79a26f4a5f077f0cef7dbrbb/**
f6431843a765abbef9e79a26f4a5f077f0cef7dbrbb * Add a node to the configuration tree.
f6431843a765abbef9e79a26f4a5f077f0cef7dbrbb * @param parent The current parent node. If the added node is a first_child,
f6431843a765abbef9e79a26f4a5f077f0cef7dbrbb then this is changed to the current node
f6431843a765abbef9e79a26f4a5f077f0cef7dbrbb * @param current The current node
f6431843a765abbef9e79a26f4a5f077f0cef7dbrbb * @param toadd The node to add to the tree
f6431843a765abbef9e79a26f4a5f077f0cef7dbrbb * @param child Is the node to add a child node
f6431843a765abbef9e79a26f4a5f077f0cef7dbrbb * @return the added node
f6431843a765abbef9e79a26f4a5f077f0cef7dbrbb */
742318b93e89c311f66b55f426c4d9cf2c14628bjimap_directive_t *ap_add_node(ap_directive_t **parent, ap_directive_t *current,
f6431843a765abbef9e79a26f4a5f077f0cef7dbrbb ap_directive_t *toadd, int child);
c1a9af42c178bed7efa0a6bb7f45f46ffb269719rbb
1075efe007e7af339bde09cbb175d4f4d676eeb5rpluem#ifdef __cplusplus
1075efe007e7af339bde09cbb175d4f4d676eeb5rpluem}
1075efe007e7af339bde09cbb175d4f4d676eeb5rpluem#endif
1075efe007e7af339bde09cbb175d4f4d676eeb5rpluem
c1a9af42c178bed7efa0a6bb7f45f46ffb269719rbb#endif
9d129b55f5a43abf43865c6b0eb6dd19bc22aba8ianh/** @} */