1251881Speter/**
2251881Speter * @copyright
3251881Speter * ====================================================================
4251881Speter *    Licensed to the Apache Software Foundation (ASF) under one
5251881Speter *    or more contributor license agreements.  See the NOTICE file
6251881Speter *    distributed with this work for additional information
7251881Speter *    regarding copyright ownership.  The ASF licenses this file
8251881Speter *    to you under the Apache License, Version 2.0 (the
9251881Speter *    "License"); you may not use this file except in compliance
10251881Speter *    with the License.  You may obtain a copy of the License at
11251881Speter *
12251881Speter *      http://www.apache.org/licenses/LICENSE-2.0
13251881Speter *
14251881Speter *    Unless required by applicable law or agreed to in writing,
15251881Speter *    software distributed under the License is distributed on an
16251881Speter *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17251881Speter *    KIND, either express or implied.  See the License for the
18251881Speter *    specific language governing permissions and limitations
19251881Speter *    under the License.
20251881Speter * ====================================================================
21251881Speter * @endcopyright
22251881Speter *
23251881Speter * @file mod_dav_svn.h
24251881Speter * @brief Subversion's backend for Apache's mod_dav module
25251881Speter */
26251881Speter
27251881Speter
28251881Speter#ifndef MOD_DAV_SVN_H
29251881Speter#define MOD_DAV_SVN_H
30251881Speter
31251881Speter#include <httpd.h>
32251881Speter#include <mod_dav.h>
33251881Speter
34251881Speter
35251881Speter#ifdef __cplusplus
36251881Speterextern "C" {
37251881Speter#endif /* __cplusplus */
38251881Speter
39251881Speter
40251881Speter/**
41251881Speter   Given an apache request @a r, a @a uri, and a @a root_path to the svn
42251881Speter   location block, process @a uri and return many things, allocated in
43289180Speter   @a pool:
44251881Speter
45251881Speter   - @a cleaned_uri:    The uri with duplicate and trailing slashes removed.
46251881Speter
47251881Speter   - @a trailing_slash: Whether the uri had a trailing slash on it.
48251881Speter
49251881Speter   Three special substrings of the uri are returned for convenience:
50251881Speter
51251881Speter   - @a repos_basename: The single path component that is the directory
52251881Speter                      which contains the repository.  (Don't confuse
53251881Speter                      this with the "repository name" as optionally
54251881Speter                      defined via the SVNReposName directive!)
55251881Speter
56251881Speter   - @a relative_path:  The remaining imaginary path components.
57251881Speter
58251881Speter   - @a repos_path:     The actual path within the repository filesystem, or
59251881Speter                      NULL if no part of the uri refers to a path in
60251881Speter                      the repository (e.g. "!svn/vcc/default" or
61251881Speter                      "!svn/bln/25").
62251881Speter
63251881Speter
64251881Speter   For example, consider the uri
65251881Speter
66251881Speter       /svn/repos/proj1/!svn/blah/13//A/B/alpha
67251881Speter
68251881Speter   In the SVNPath case, this function would receive a @a root_path of
69251881Speter   '/svn/repos/proj1', and in the SVNParentPath case would receive a
70251881Speter   @a root_path of '/svn/repos'.  But either way, we would get back:
71251881Speter
72251881Speter     - @a cleaned_uri:    /svn/repos/proj1/!svn/blah/13/A/B/alpha
73251881Speter     - @a repos_basename: proj1
74251881Speter     - @a relative_path:  /!svn/blah/13/A/B/alpha
75251881Speter     - @a repos_path:     A/B/alpha
76251881Speter     - @a trailing_slash: FALSE
77289180Speter
78289180Speter   NOTE: The returned dav_error will be also allocated in @a pool, not
79289180Speter         in @a r->pool.
80289180Speter
81289180Speter   @since New in 1.9
82251881Speter*/
83289180SpeterAP_MODULE_DECLARE(dav_error *) dav_svn_split_uri2(request_rec *r,
84289180Speter                                                  const char *uri_to_split,
85289180Speter                                                  const char *root_path,
86289180Speter                                                  const char **cleaned_uri,
87289180Speter                                                  int *trailing_slash,
88289180Speter                                                  const char **repos_basename,
89289180Speter                                                  const char **relative_path,
90289180Speter                                                  const char **repos_path,
91289180Speter                                                  apr_pool_t *pool);
92289180Speter
93289180Speter/**
94289180Speter * Same as dav_svn_split_uri2() but allocates the result in @a r->pool.
95289180Speter */
96251881SpeterAP_MODULE_DECLARE(dav_error *) dav_svn_split_uri(request_rec *r,
97251881Speter                                                 const char *uri,
98251881Speter                                                 const char *root_path,
99251881Speter                                                 const char **cleaned_uri,
100251881Speter                                                 int *trailing_slash,
101251881Speter                                                 const char **repos_basename,
102251881Speter                                                 const char **relative_path,
103251881Speter                                                 const char **repos_path);
104251881Speter
105251881Speter
106251881Speter/**
107251881Speter * Given an apache request @a r and a @a root_path to the svn location
108289180Speter * block, set @a *repos_path to the path of the repository on disk.
109289180Speter * Perform all allocations in @a pool.
110289180Speter *
111289180Speter * NOTE: The returned dav_error will be also allocated in @a pool, not
112289180Speter *       in @a r->pool.
113289180Speter *
114289180Speter * @since New in 1.9
115289180Speter */
116289180SpeterAP_MODULE_DECLARE(dav_error *) dav_svn_get_repos_path2(request_rec *r,
117289180Speter                                                       const char *root_path,
118289180Speter                                                       const char **repos_path,
119289180Speter                                                       apr_pool_t *pool);
120289180Speter
121289180Speter/**
122289180Speter * Same as dav_svn_get_repos_path2() but allocates the result in@a r->pool.
123289180Speter */
124251881SpeterAP_MODULE_DECLARE(dav_error *) dav_svn_get_repos_path(request_rec *r,
125251881Speter                                                      const char *root_path,
126251881Speter                                                      const char **repos_path);
127251881Speter
128251881Speter#ifdef __cplusplus
129251881Speter}
130251881Speter#endif /* __cplusplus */
131251881Speter
132251881Speter#endif /* MOD_DAV_SVN_H */
133