Subversion
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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 #include <apr_optional.h>
34 
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif /* __cplusplus */
39 
40 
41 /**
42  Given an apache request @a r, a @a uri, and a @a root_path to the svn
43  location block, process @a uri and return many things, allocated in
44  @a r->pool:
45 
46  - @a cleaned_uri: The uri with duplicate and trailing slashes removed.
47 
48  - @a trailing_slash: Whether the uri had a trailing slash on it.
49 
50  Three special substrings of the uri are returned for convenience:
51 
52  - @a repos_basename: The single path component that is the directory
53  which contains the repository. (Don't confuse
54  this with the "repository name" as optionally
55  defined via the SVNReposName directive!)
56 
57  - @a relative_path: The remaining imaginary path components.
58 
59  - @a repos_path: The actual path within the repository filesystem, or
60  NULL if no part of the uri refers to a path in
61  the repository (e.g. "!svn/vcc/default" or
62  "!svn/bln/25").
63 
64 
65  For example, consider the uri
66 
67  /svn/repos/proj1/!svn/blah/13//A/B/alpha
68 
69  In the SVNPath case, this function would receive a @a root_path of
70  '/svn/repos/proj1', and in the SVNParentPath case would receive a
71  @a root_path of '/svn/repos'. But either way, we would get back:
72 
73  - @a cleaned_uri: /svn/repos/proj1/!svn/blah/13/A/B/alpha
74  - @a repos_basename: proj1
75  - @a relative_path: /!svn/blah/13/A/B/alpha
76  - @a repos_path: A/B/alpha
77  - @a trailing_slash: FALSE
78 */
79 AP_MODULE_DECLARE(dav_error *) dav_svn_split_uri(request_rec *r,
80  const char *uri,
81  const char *root_path,
82  const char **cleaned_uri,
83  int *trailing_slash,
84  const char **repos_basename,
85  const char **relative_path,
86  const char **repos_path);
87 APR_DECLARE_OPTIONAL_FN(dav_error *, dav_svn_split_uri,
88  (request_rec *r,
89  const char *uri,
90  const char *root_path,
91  const char **cleaned_uri,
92  int *trailing_slash,
93  const char **repos_name,
94  const char **relative_path,
95  const char **repos_path));
96 
97 
98 /**
99  * Given an apache request @a r and a @a root_path to the svn location
100  * block, set @a *repos_path to the path of the repository on disk. */
101 AP_MODULE_DECLARE(dav_error *) dav_svn_get_repos_path(request_rec *r,
102  const char *root_path,
103  const char **repos_path);
104 APR_DECLARE_OPTIONAL_FN(dav_error *, dav_svn_get_repos_path,
105  (request_rec *r,
106  const char *root_path,
107  const char **repos_path));
108 
109 #ifdef __cplusplus
110 }
111 #endif /* __cplusplus */
112 
113 #endif /* MOD_DAV_SVN_H */