Subversion
mod_dav_svn.h
Go to the documentation of this file.
1/**
2 * @copyright
3 * ====================================================================
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 * ====================================================================
21 * @endcopyright
22 *
23 * @file mod_dav_svn.h
24 * @brief Subversion's backend for Apache's mod_dav module
25 */
26
27
28#ifndef MOD_DAV_SVN_H
29#define MOD_DAV_SVN_H
30
31#include <httpd.h>
32#include <mod_dav.h>
33
34
35#ifdef __cplusplus
36extern "C" {
37#endif /* __cplusplus */
38
39
40/**
41 Given an apache request @a r, a @a uri, and a @a root_path to the svn
42 location block, process @a uri and return many things, allocated in
43 @a pool:
44
45 - @a cleaned_uri: The uri with duplicate and trailing slashes removed.
46
47 - @a trailing_slash: Whether the uri had a trailing slash on it.
48
49 Three special substrings of the uri are returned for convenience:
50
51 - @a repos_basename: The single path component that is the directory
52 which contains the repository. (Don't confuse
53 this with the "repository name" as optionally
54 defined via the SVNReposName directive!)
55
56 - @a relative_path: The remaining imaginary path components.
57
58 - @a repos_path: The actual path within the repository filesystem, or
59 NULL if no part of the uri refers to a path in
60 the repository (e.g. "!svn/vcc/default" or
61 "!svn/bln/25").
62
63
64 For example, consider the uri
65
66 /svn/repos/proj1/!svn/blah/13//A/B/alpha
67
68 In the SVNPath case, this function would receive a @a root_path of
69 '/svn/repos/proj1', and in the SVNParentPath case would receive a
70 @a root_path of '/svn/repos'. But either way, we would get back:
71
72 - @a cleaned_uri: /svn/repos/proj1/!svn/blah/13/A/B/alpha
73 - @a repos_basename: proj1
74 - @a relative_path: /!svn/blah/13/A/B/alpha
75 - @a repos_path: A/B/alpha
76 - @a trailing_slash: FALSE
77
78 NOTE: The returned dav_error will be also allocated in @a pool, not
79 in @a r->pool.
80
81 @since New in 1.9
82*/
83AP_MODULE_DECLARE(dav_error *) dav_svn_split_uri2(request_rec *r,
84 const char *uri_to_split,
85 const char *root_path,
86 const char **cleaned_uri,
87 int *trailing_slash,
88 const char **repos_basename,
89 const char **relative_path,
90 const char **repos_path,
91 apr_pool_t *pool);
92
93/**
94 * Same as dav_svn_split_uri2() but allocates the result in @a r->pool.
95 */
96AP_MODULE_DECLARE(dav_error *) dav_svn_split_uri(request_rec *r,
97 const char *uri,
98 const char *root_path,
99 const char **cleaned_uri,
100 int *trailing_slash,
101 const char **repos_basename,
102 const char **relative_path,
103 const char **repos_path);
104
105
106/**
107 * Given an apache request @a r and a @a root_path to the svn location
108 * block, set @a *repos_path to the path of the repository on disk.
109 * Perform all allocations in @a pool.
110 *
111 * NOTE: The returned dav_error will be also allocated in @a pool, not
112 * in @a r->pool.
113 *
114 * @since New in 1.9
115 */
116AP_MODULE_DECLARE(dav_error *) dav_svn_get_repos_path2(request_rec *r,
117 const char *root_path,
118 const char **repos_path,
119 apr_pool_t *pool);
120
121/**
122 * Same as dav_svn_get_repos_path2() but allocates the result in@a r->pool.
123 */
124AP_MODULE_DECLARE(dav_error *) dav_svn_get_repos_path(request_rec *r,
125 const char *root_path,
126 const char **repos_path);
127
128#ifdef __cplusplus
129}
130#endif /* __cplusplus */
131
132#endif /* MOD_DAV_SVN_H */
dav_error * dav_svn_split_uri2(request_rec *r, const char *uri_to_split, const char *root_path, const char **cleaned_uri, int *trailing_slash, const char **repos_basename, const char **relative_path, const char **repos_path, apr_pool_t *pool)
Given an apache request r, a uri, and a root_path to the svn location block, process uri and return m...
dav_error * dav_svn_get_repos_path2(request_rec *r, const char *root_path, const char **repos_path, apr_pool_t *pool)
Given an apache request r and a root_path to the svn location block, set *repos_path to the path of t...
dav_error * dav_svn_split_uri(request_rec *r, const char *uri, const char *root_path, const char **cleaned_uri, int *trailing_slash, const char **repos_basename, const char **relative_path, const char **repos_path)
Same as dav_svn_split_uri2() but allocates the result in r->pool.
dav_error * dav_svn_get_repos_path(request_rec *r, const char *root_path, const char **repos_path)
Same as dav_svn_get_repos_path2() but allocates the result inr->pool.