~ubuntu-branches/ubuntu/feisty/apache2/feisty

« back to all changes in this revision

Viewing changes to srclib/apr-util/include/apr_strmatch.h

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Barth
  • Date: 2006-12-09 21:05:45 UTC
  • mfrom: (0.6.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061209210545-h70s0xaqc2v8vqr2
Tags: 2.2.3-3.2
* Non-maintainer upload.
* 043_ajp_connection_reuse: Patch from upstream Bugzilla, fixing a critical
  issue with regard to connection reuse in mod_proxy_ajp.
  Closes: #396265

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright 2002-2005 The Apache Software Foundation or its licensors, as
 
2
 * applicable.
 
3
 *
 
4
 * Licensed under the Apache License, Version 2.0 (the "License");
 
5
 * you may not use this file except in compliance with the License.
 
6
 * 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
#ifndef APR_STRMATCH_H
 
18
#define APR_STRMATCH_H
 
19
/**
 
20
 * @file apr_strmatch.h
 
21
 * @brief APR-UTIL string matching routines
 
22
 */
 
23
 
 
24
#include "apu.h"
 
25
#include "apr_pools.h"
 
26
 
 
27
#ifdef __cplusplus
 
28
extern "C" {
 
29
#endif
 
30
 
 
31
/**
 
32
 * @defgroup APR_Util_StrMatch String matching routines
 
33
 * @ingroup APR_Util
 
34
 * @{
 
35
 */
 
36
 
 
37
/** @see apr_strmatch_pattern */
 
38
typedef struct apr_strmatch_pattern apr_strmatch_pattern;
 
39
 
 
40
/**
 
41
 * Precompiled search pattern
 
42
 */
 
43
struct apr_strmatch_pattern {
 
44
    /** Function called to compare */
 
45
    const char *(*compare)(const apr_strmatch_pattern *this_pattern,
 
46
                           const char *s, apr_size_t slen);
 
47
    const char *pattern;    /**< Current pattern */
 
48
    apr_size_t length;      /**< Current length */
 
49
    void *context;          /**< hook to add precomputed metadata */
 
50
};
 
51
 
 
52
#if defined(DOXYGEN)
 
53
/**
 
54
 * Search for a precompiled pattern within a string
 
55
 * @param pattern The pattern
 
56
 * @param s The string in which to search for the pattern
 
57
 * @param slen The length of s (excluding null terminator)
 
58
 * @return A pointer to the first instance of the pattern in s, or
 
59
 *         NULL if not found
 
60
 */
 
61
APU_DECLARE(const char *) apr_strmatch(const apr_strmatch_pattern *pattern,
 
62
                                       const char *s, apr_size_t slen);
 
63
#else
 
64
#define apr_strmatch(pattern, s, slen) (*((pattern)->compare))((pattern), (s), (slen))
 
65
#endif
 
66
 
 
67
/**
 
68
 * Precompile a pattern for matching using the Boyer-Moore-Horspool algorithm
 
69
 * @param p The pool from which to allocate the pattern
 
70
 * @param s The pattern string
 
71
 * @param case_sensitive Whether the matching should be case-sensitive
 
72
 * @return a pointer to the compiled pattern, or NULL if compilation fails
 
73
 */
 
74
APU_DECLARE(const apr_strmatch_pattern *) apr_strmatch_precompile(apr_pool_t *p, const char *s, int case_sensitive);
 
75
 
 
76
/** @} */
 
77
#ifdef __cplusplus
 
78
}
 
79
#endif
 
80
 
 
81
#endif  /* !APR_STRMATCH_H */