00001 /* Copyright 2006 Garrett Rooney. 00002 * 00003 * Licensed under the Apache License, Version 2.0 (the "License"); 00004 * you may not use this file except in compliance with the License. 00005 * You may obtain a copy of the License at 00006 * 00007 * http://www.apache.org/licenses/LICENSE-2.0 00008 * 00009 * Unless required by applicable law or agreed to in writing, software 00010 * distributed under the License is distributed on an "AS IS" BASIS, 00011 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00012 * See the License for the specific language governing permissions and 00013 * limitations under the License. 00014 */ 00015 00016 /** 00017 * @file etl_resolver.h 00018 * @brief Functions for manipulating resolvers for use in including files 00019 */ 00020 00021 #ifndef ETL_RESOLVER_H 00022 #define ETL_RESOLVER_H 00023 00024 #include "etl_error.h" 00025 00026 #include <apr_buckets.h> 00027 00028 /** A resolver object. */ 00029 typedef struct etl_resolver_t etl_resolver_t; 00030 00031 /** 00032 * Use @a resolver to find a "file" named @a fname and return its 00033 * contents in @a *bb. 00034 * 00035 * @a *bb is allocated via @a alloc and @a pool is used for all other 00036 * allocations. 00037 */ 00038 etl_error_t * 00039 etl_resolver_resolve(apr_bucket_brigade **bb, 00040 etl_resolver_t *resolver, 00041 const char *fname, 00042 apr_bucket_alloc_t *alloc, 00043 apr_pool_t *pool); 00044 00045 /** 00046 * Create a resolver that searches through @a search_paths (which is an 00047 * array of <tt>char *</tt> paths) to find files. 00048 */ 00049 etl_resolver_t * 00050 etl_resolver_file_create(apr_array_header_t *search_paths, 00051 apr_pool_t *pool); 00052 00053 /** 00054 * If you want to build your own resolver, you just take a function 00055 * with * this prototype, and pass it to @c etl_resolver_create, along 00056 * with a baton pointer that'll get passed to your callback when 00057 * @c etl_resolver_resolve is called on your resolver. 00058 */ 00059 typedef etl_error_t * (*etl_resolver_resolve_func_t)(apr_bucket_brigade **bb, 00060 void *baton, 00061 const char *fname, 00062 apr_bucket_alloc_t *alloc, 00063 apr_pool_t *pool); 00064 00065 /** 00066 * Return a resolver that uses @a resolve_func and @a resolve_baton, 00067 * allocated in @a pool. 00068 */ 00069 etl_resolver_t * 00070 etl_resolver_create(etl_resolver_resolve_func_t resolve_func, 00071 void *resolve_baton, 00072 apr_pool_t *pool); 00073 00074 #endif /* ETL_RESOLVER_H */
1.4.4