mod_dav.h revision 6582c8e9b0d0d65427b0c55cb48eaac7950dcb8f
2d2eda71267231c2526be701fe655db125852c1ffielding/* ====================================================================
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * The Apache Software License, Version 1.1
bc8fd1b0b1afdf89b8d28eefa8cd74e26ba97986fielding * Copyright (c) 2000-2001 The Apache Software Foundation. All rights
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * reserved.
2d2eda71267231c2526be701fe655db125852c1ffielding * Redistribution and use in source and binary forms, with or without
2d2eda71267231c2526be701fe655db125852c1ffielding * modification, are permitted provided that the following conditions
2d2eda71267231c2526be701fe655db125852c1ffielding * 1. Redistributions of source code must retain the above copyright
2d2eda71267231c2526be701fe655db125852c1ffielding * notice, this list of conditions and the following disclaimer.
2d2eda71267231c2526be701fe655db125852c1ffielding * 2. Redistributions in binary form must reproduce the above copyright
2d2eda71267231c2526be701fe655db125852c1ffielding * notice, this list of conditions and the following disclaimer in
2d2eda71267231c2526be701fe655db125852c1ffielding * the documentation and/or other materials provided with the
2d2eda71267231c2526be701fe655db125852c1ffielding * distribution.
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * 3. The end-user documentation included with the redistribution,
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * if any, must include the following acknowledgment:
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * "This product includes software developed by the
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * Apache Software Foundation (http://www.apache.org/)."
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * Alternately, this acknowledgment may appear in the software itself,
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * if and wherever such third-party acknowledgments normally appear.
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * 4. The names "Apache" and "Apache Software Foundation" must
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * not be used to endorse or promote products derived from this
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * software without prior written permission. For written
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * permission, please contact apache@apache.org.
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * 5. Products derived from this software may not be called "Apache",
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * nor may "Apache" appear in their name, without prior written
64185f9824e42f21ca7b9ae6c004484215c031a7rbb * permission of the Apache Software Foundation.
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
2d2eda71267231c2526be701fe655db125852c1ffielding * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * SUCH DAMAGE.
2d2eda71267231c2526be701fe655db125852c1ffielding * ====================================================================
2d2eda71267231c2526be701fe655db125852c1ffielding * This software consists of voluntary contributions made by many
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * individuals on behalf of the Apache Software Foundation. For more
f062ed7bd262a37a909dd77ce5fc23b446818823fielding * information on the Apache Software Foundation, please see
f062ed7bd262a37a909dd77ce5fc23b446818823fielding** DAV extension module for Apache 2.0.*
61fd0cab072a05b855cbef9c585702401ac5ae29rbbextern "C" {
fd492f9543f14fb5bae78e04b135c3448eb9cc56rbb#define DAV_XML_HEADER "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
fd492f9543f14fb5bae78e04b135c3448eb9cc56rbb#define DAV_XML_CONTENT_TYPE "text/xml; charset=\"utf-8\""
2d2eda71267231c2526be701fe655db125852c1ffielding#define DAV_READ_BLOCKSIZE 2048 /* used for reading input blocks */
2d2eda71267231c2526be701fe655db125852c1ffielding#define DAV_RESPONSE_BODY_1 "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<HTML><HEAD>\n<TITLE>"
2d2eda71267231c2526be701fe655db125852c1ffielding#define DAV_RESPONSE_BODY_2 "</TITLE>\n</HEAD><BODY>\n<H1>"
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* Create a set of DAV_DECLARE(type), DAV_DECLARE_NONSTD(type) and
61fd0cab072a05b855cbef9c585702401ac5ae29rbb * DAV_DECLARE_DATA with appropriate export and import tags for the platform
61fd0cab072a05b855cbef9c585702401ac5ae29rbb#if !defined(WIN32)
61fd0cab072a05b855cbef9c585702401ac5ae29rbb#define DAV_DECLARE(type) __declspec(dllexport) type __stdcall
61fd0cab072a05b855cbef9c585702401ac5ae29rbb#define DAV_DECLARE_NONSTD(type) __declspec(dllexport) type
2d2eda71267231c2526be701fe655db125852c1ffielding#define DAV_DECLARE(type) __declspec(dllimport) type __stdcall
3d96ee83babeec32482c9082c9426340cee8c44dwrowe#define DAV_DECLARE_NONSTD(type) __declspec(dllimport) type
2d2eda71267231c2526be701fe655db125852c1ffielding/* --------------------------------------------------------------------
2d2eda71267231c2526be701fe655db125852c1ffielding** ERROR MANAGEMENT
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** dav_error structure.
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** In most cases, mod_dav uses a pointer to a dav_error structure. If the
7bdef86e15d47d16dcbe7a5611683191774bd5fbgstein** pointer is NULL, then no error has occurred.
7bdef86e15d47d16dcbe7a5611683191774bd5fbgstein** In certain cases, a dav_error structure is directly used. In these cases,
7bdef86e15d47d16dcbe7a5611683191774bd5fbgstein** a status value of 0 means that an error has not occurred.
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** Note: this implies that status != 0 whenever an error occurs.
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** The desc field is optional (it may be NULL). When NULL, it typically
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** implies that Apache has a proper description for the specified status.
3d96ee83babeec32482c9082c9426340cee8c44dwrowetypedef struct dav_error {
7bdef86e15d47d16dcbe7a5611683191774bd5fbgstein int status; /* suggested HTTP status (0 for no error) */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb const char *desc; /* DAV:responsedescription and error log */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb /* deferred computation of the description */
3d96ee83babeec32482c9082c9426340cee8c44dwrowe void (*compute_desc)(struct dav_error *err, apr_pool_t *p);
c9a95767fbf0f5fb0976a06b97a256033925e433rbb const char *ctx_s;
c9a95767fbf0f5fb0976a06b97a256033925e433rbb** Create a new error structure. save_errno will be filled with the current
c9a95767fbf0f5fb0976a06b97a256033925e433rbb** errno value.
c9a95767fbf0f5fb0976a06b97a256033925e433rbbDAV_DECLARE(dav_error*) dav_new_error(apr_pool_t *p, int status,
d82d78a97558238d16c52ec5278fe921bb7d7ec3brianp** Push a new error description onto the stack of errors.
d82d78a97558238d16c52ec5278fe921bb7d7ec3brianp** This function is used to provide an additional description to an existing
d82d78a97558238d16c52ec5278fe921bb7d7ec3brianp** <status> should contain the caller's view of what the current status is,
d82d78a97558238d16c52ec5278fe921bb7d7ec3brianp** given the underlying error. If it doesn't have a better idea, then the
d82d78a97558238d16c52ec5278fe921bb7d7ec3brianp** caller should pass prev->status.
c9a95767fbf0f5fb0976a06b97a256033925e433rbb** <error_id> can specify a new error_id since the topmost description has
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** changed.
61fd0cab072a05b855cbef9c585702401ac5ae29rbbDAV_DECLARE(dav_error*) dav_push_error(apr_pool_t *p, int status, int error_id,
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* error ID values... */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* IF: header errors */
3d96ee83babeec32482c9082c9426340cee8c44dwrowe#define DAV_ERR_IF_PARSE 100 /* general parsing error */
7bdef86e15d47d16dcbe7a5611683191774bd5fbgstein#define DAV_ERR_IF_MULTIPLE_NOT 101 /* multiple "Not" found */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb#define DAV_ERR_IF_UNK_CHAR 102 /* unknown char in header */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb#define DAV_ERR_IF_TAGGED 104 /* in parsing tagged-list */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb#define DAV_ERR_IF_UNCLOSED_PAREN 105 /* in no-tagged-list */
3d96ee83babeec32482c9082c9426340cee8c44dwrowe/* Prop DB errors */
7bdef86e15d47d16dcbe7a5611683191774bd5fbgstein#define DAV_ERR_PROP_BAD_MAJOR 200 /* major version was wrong */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb#define DAV_ERR_PROP_READONLY 201 /* prop is read-only */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb#define DAV_ERR_PROP_NO_DATABASE 202 /* writable db not avail */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb#define DAV_ERR_PROP_BAD_LOCKDB 204 /* could not open lockdb */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb#define DAV_ERR_PROP_OPENING 205 /* problem opening propdb */
3d96ee83babeec32482c9082c9426340cee8c44dwrowe#define DAV_ERR_PROP_EXEC 206 /* problem exec'ing patch */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* Predefined DB errors */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* ### any to define?? */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* Predefined locking system errors */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb#define DAV_ERR_LOCK_OPENDB 400 /* could not open lockdb */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb#define DAV_ERR_LOCK_UNK_STATE_TOKEN 403 /* unknown State-token */
3d96ee83babeec32482c9082c9426340cee8c44dwrowe#define DAV_ERR_LOCK_PARSE_TOKEN 404 /* bad opaquelocktoken */
2d2eda71267231c2526be701fe655db125852c1ffielding#define DAV_ERR_LOCK_SAVE_LOCK 405 /* err saving locks */
2d2eda71267231c2526be701fe655db125852c1ffielding** Some comments on Error ID values:
2d2eda71267231c2526be701fe655db125852c1ffielding** The numbers do not necessarily need to be unique. Uniqueness simply means
2d2eda71267231c2526be701fe655db125852c1ffielding** that two errors that have not been predefined above can be distinguished
2d2eda71267231c2526be701fe655db125852c1ffielding** from each other. At the moment, mod_dav does not use this distinguishing
2d2eda71267231c2526be701fe655db125852c1ffielding** feature, but it could be used in the future to collapse <response> elements
2d2eda71267231c2526be701fe655db125852c1ffielding** into groups based on the error ID (and associated responsedescription).
2d2eda71267231c2526be701fe655db125852c1ffielding** If a compute_desc is provided, then the error ID should be unique within
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** the context of the compute_desc function (so the function can figure out
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** what to filled into the desc).
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** Basically, subsystems can ignore defining new error ID values if they want
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** to. The subsystems *do* need to return the predefined errors when
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** appropriate, so that mod_dav can figure out what to do. Subsystems can
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** simply leave the error ID field unfilled (zero) if there isn't an error
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** that must be placed there.
1ccd992d37d62c8cb2056126f2234f64ec189bfddougm/* --------------------------------------------------------------------
23ff73a56371e21f16744cb94d06399b877829f1rbb** HOOK STRUCTURES
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** These are here for forward-declaration purposes. For more info, see
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** the section title "HOOK HANDLING" for more information, plus each
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** structure definition.
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* forward-declare this structure */
2d2eda71267231c2526be701fe655db125852c1ffieldingtypedef struct dav_hooks_repository dav_hooks_repository;
62db15de4c1f335a64d45821796ae197cff94ef8rbb/* ### deprecated name */
62db15de4c1f335a64d45821796ae197cff94ef8rbb/* --------------------------------------------------------------------
62db15de4c1f335a64d45821796ae197cff94ef8rbb** RESOURCE HANDLING
62db15de4c1f335a64d45821796ae197cff94ef8rbb** Resource Types:
62db15de4c1f335a64d45821796ae197cff94ef8rbb** The base protocol defines only file and collection resources.
62db15de4c1f335a64d45821796ae197cff94ef8rbb** The versioning protocol defines several additional resource types
62db15de4c1f335a64d45821796ae197cff94ef8rbb** to represent artifacts of a version control system.
62db15de4c1f335a64d45821796ae197cff94ef8rbb** This enumeration identifies the type of URL used to identify the
62db15de4c1f335a64d45821796ae197cff94ef8rbb** resource. Since the same resource may have more than one type of
62db15de4c1f335a64d45821796ae197cff94ef8rbb** URL which can identify it, dav_resource_type cannot be used
62db15de4c1f335a64d45821796ae197cff94ef8rbb** alone to determine the type of the resource; attributes of the
62db15de4c1f335a64d45821796ae197cff94ef8rbb** dav_resource object must also be consulted.
48d2edbfb84e5559b5da0f8d614ccab805cc67a8rbbtypedef enum {
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar DAV_RESOURCE_TYPE_REGULAR, /* file or collection; could be
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar * unversioned, or version selector,
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar * or baseline selector */
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar DAV_RESOURCE_TYPE_VERSION, /* version or baseline URL */
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar DAV_RESOURCE_TYPE_HISTORY, /* version or baseline history URL */
a19698aebe10b9d41574e4a73794ba7d4cecd78btrawick DAV_RESOURCE_TYPE_PRIVATE /* repository-private type */
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar** Opaque, repository-specific information for a resource.
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coartypedef struct dav_resource_private dav_resource_private;
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar** Resource descriptor, generated by a repository provider.
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar** Note: the lock-null state is not explicitly represented here,
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar** since it may be expensive to compute. Use dav_get_resource_state()
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar** to determine whether a non-existent resource is a lock-null resource.
3d96ee83babeec32482c9082c9426340cee8c44dwrowe** A quick explanation of how the flags can apply to different resources:
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar** unversioned file or collection:
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar** type = DAV_RESOURCE_TYPE_REGULAR
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar** exists = ? (1 if exists)
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar** collection = ? (1 if collection)
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar** versioned = 0
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar** baselined = 0
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar** working = 0
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar** version-controlled resource or configuration:
3d96ee83babeec32482c9082c9426340cee8c44dwrowe** type = DAV_RESOURCE_TYPE_REGULAR
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar** exists = 1
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar** collection = ? (1 if collection)
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar** versioned = 1
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar** baselined = ? (1 if configuration)
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar** working = ? (1 if checked out)
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar** type = DAV_RESOURCE_TYPE_HISTORY
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar** exists = 1
3d96ee83babeec32482c9082c9426340cee8c44dwrowe** collection = 0
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar** versioned = 0
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar** baselined = 0
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar** working = 0
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar** type = DAV_RESOURCE_TYPE_VERSION
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar** exists = 1
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar** collection = ? (1 if collection)
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar** versioned = 1
3d96ee83babeec32482c9082c9426340cee8c44dwrowe** baselined = ? (1 if baseline)
91f0d8da77152d24e4bbb31ce199282b3fd6e3b2coar** working = 0
db08da9ddcd65c31f9ea44b823898b72a1b24fbestoddard** working resource:
db08da9ddcd65c31f9ea44b823898b72a1b24fbestoddard** type = DAV_RESOURCE_TYPE_WORKING
db08da9ddcd65c31f9ea44b823898b72a1b24fbestoddard** exists = 1
db08da9ddcd65c31f9ea44b823898b72a1b24fbestoddard** collection = ? (1 if collection)
db08da9ddcd65c31f9ea44b823898b72a1b24fbestoddard** versioned = 1
db08da9ddcd65c31f9ea44b823898b72a1b24fbestoddard** baselined = 0
db08da9ddcd65c31f9ea44b823898b72a1b24fbestoddard** working = 1
db08da9ddcd65c31f9ea44b823898b72a1b24fbestoddard** workspace:
2864362ca8266097928e84f101010bdf814ffa08stoddard** type = DAV_RESOURCE_TYPE_WORKSPACE
2d2eda71267231c2526be701fe655db125852c1ffielding** exists = ? (1 if exists)
2d2eda71267231c2526be701fe655db125852c1ffielding** collection = 1
2d2eda71267231c2526be701fe655db125852c1ffielding** versioned = ? (1 if version-controlled)
2d2eda71267231c2526be701fe655db125852c1ffielding** baselined = ? (1 if baseline-controlled)
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** working = ? (1 if checked out)
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** activity:
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** type = DAV_RESOURCE_TYPE_ACTIVITY
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** exists = ? (1 if exists)
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** collection = 0
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** versioned = 0
3d96ee83babeec32482c9082c9426340cee8c44dwrowe** baselined = 0
a6b9ed64fdf548c61de9714e2cfb999ec59d149cgstein** working = 0
61fd0cab072a05b855cbef9c585702401ac5ae29rbbtypedef struct dav_resource {
3d96ee83babeec32482c9082c9426340cee8c44dwrowe * REGULAR, VERSION, and WORKING resources,
a6b9ed64fdf548c61de9714e2cfb999ec59d149cgstein * and is always 1 for WORKSPACE */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb * REGULAR and WORKSPACE resources,
61fd0cab072a05b855cbef9c585702401ac5ae29rbb * and is always 1 for VERSION and WORKING */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb * REGULAR, VERSION, and WORKSPACE resources;
61fd0cab072a05b855cbef9c585702401ac5ae29rbb * versioned == 1 when baselined == 1 */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb * REGULAR and WORKSPACE resources,
61fd0cab072a05b855cbef9c585702401ac5ae29rbb * and is always 1 for WORKING */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb dav_resource_private *info; /* the provider's private info */
3d96ee83babeec32482c9082c9426340cee8c44dwrowe const dav_hooks_repository *hooks; /* hooks used for this resource */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb /* When allocating items related specifically to this resource, the
61fd0cab072a05b855cbef9c585702401ac5ae29rbb following pool should be used. Its lifetime will be at least as
61fd0cab072a05b855cbef9c585702401ac5ae29rbb long as the dav_resource structure. */
3d96ee83babeec32482c9082c9426340cee8c44dwrowe** Lock token type. Lock providers define the details of a lock token.
a6b9ed64fdf548c61de9714e2cfb999ec59d149cgstein** However, all providers are expected to at least be able to parse
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** the "opaquelocktoken" scheme, which is represented by a uuid_t.
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* --------------------------------------------------------------------
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** BUFFER HANDLING
2d2eda71267231c2526be701fe655db125852c1ffielding** These buffers are used as a lightweight buffer reuse mechanism. Apache
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** provides sub-pool creation and destruction to much the same effect, but
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** the sub-pools are a bit more general and heavyweight than these buffers.
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* buffer for reuse; can grow to accomodate needed size */
61fd0cab072a05b855cbef9c585702401ac5ae29rbbtypedef struct
2d2eda71267231c2526be701fe655db125852c1ffielding apr_size_t alloc_len; /* how much has been allocated */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb apr_size_t cur_len; /* how much is currently being used */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb#define DAV_BUFFER_MINSIZE 256 /* minimum size for buffer */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb#define DAV_BUFFER_PAD 64 /* amount of pad when growing */
2d2eda71267231c2526be701fe655db125852c1ffielding/* set the cur_len to the given size and ensure space is available */
3d96ee83babeec32482c9082c9426340cee8c44dwroweDAV_DECLARE(void) dav_set_bufsize(apr_pool_t *p, dav_buffer *pbuf,
d839a9822ee53ce00da24c15f2d9fe054233d342gstein/* initialize a buffer and copy the specified (null-term'd) string into it */
d839a9822ee53ce00da24c15f2d9fe054233d342gsteinDAV_DECLARE(void) dav_buffer_init(apr_pool_t *p, dav_buffer *pbuf,
d839a9822ee53ce00da24c15f2d9fe054233d342gstein const char *str);
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* check that the buffer can accomodate <extra_needed> more bytes */
61fd0cab072a05b855cbef9c585702401ac5ae29rbbDAV_DECLARE(void) dav_check_bufsize(apr_pool_t *p, dav_buffer *pbuf,
d839a9822ee53ce00da24c15f2d9fe054233d342gstein/* append a string to the end of the buffer, adjust length */
2d2eda71267231c2526be701fe655db125852c1ffieldingDAV_DECLARE(void) dav_buffer_append(apr_pool_t *p, dav_buffer *pbuf,
2d2eda71267231c2526be701fe655db125852c1ffielding const char *str);
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* place a string on the end of the buffer, do NOT adjust length */
61fd0cab072a05b855cbef9c585702401ac5ae29rbbDAV_DECLARE(void) dav_buffer_place(apr_pool_t *p, dav_buffer *pbuf,
61fd0cab072a05b855cbef9c585702401ac5ae29rbb const char *str);
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* place some memory on the end of a buffer; do NOT adjust length */
61fd0cab072a05b855cbef9c585702401ac5ae29rbbDAV_DECLARE(void) dav_buffer_place_mem(apr_pool_t *p, dav_buffer *pbuf,
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* --------------------------------------------------------------------
a6b9ed64fdf548c61de9714e2cfb999ec59d149cgstein** HANDY UTILITIES
face099b681c052cb1f52176a5499661c44b2982trawick/* contains results from one of the getprop functions */
61fd0cab072a05b855cbef9c585702401ac5ae29rbbtypedef struct
61fd0cab072a05b855cbef9c585702401ac5ae29rbb ap_text * xmlns; /* namespace decls for <response> elem */
3d96ee83babeec32482c9082c9426340cee8c44dwrowe/* holds the contents of a <response> element */
a6b9ed64fdf548c61de9714e2cfb999ec59d149cgsteintypedef struct dav_response
61fd0cab072a05b855cbef9c585702401ac5ae29rbb const char *desc; /* optional description at <response> level */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb /* use status if propresult.propstats is NULL. */
61fd0cab072a05b855cbef9c585702401ac5ae29rbbtypedef struct
61fd0cab072a05b855cbef9c585702401ac5ae29rbbdav_lookup_result dav_lookup_uri(const char *uri, request_rec *r);
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* defines type of property info a provider is to return */
61fd0cab072a05b855cbef9c585702401ac5ae29rbbtypedef enum {
3d96ee83babeec32482c9082c9426340cee8c44dwrowe DAV_PROP_INSERT_NOTDEF, /* property is defined by this provider,
2d2eda71267231c2526be701fe655db125852c1ffielding but nothing was inserted because the
a6b9ed64fdf548c61de9714e2cfb999ec59d149cgstein (live) property is not defined for this
61fd0cab072a05b855cbef9c585702401ac5ae29rbb resource (it may be present as a dead
61fd0cab072a05b855cbef9c585702401ac5ae29rbb property). */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb DAV_PROP_INSERT_NOTSUPP, /* property is recognized by this provider,
61fd0cab072a05b855cbef9c585702401ac5ae29rbb but it is not supported, and cannot be
61fd0cab072a05b855cbef9c585702401ac5ae29rbb treated as a dead property */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb DAV_PROP_INSERT_NAME, /* a property name (empty elem) was
61fd0cab072a05b855cbef9c585702401ac5ae29rbb inserted into the text block */
3d96ee83babeec32482c9082c9426340cee8c44dwrowe DAV_PROP_INSERT_VALUE, /* a property name/value pair was inserted
a6b9ed64fdf548c61de9714e2cfb999ec59d149cgstein into the text block */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb DAV_PROP_INSERT_SUPPORTED /* a supported live property was added to
61fd0cab072a05b855cbef9c585702401ac5ae29rbb the text block as a
61fd0cab072a05b855cbef9c585702401ac5ae29rbb <DAV:supported-live-property> element */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* ### this stuff is private to dav/fs/repos.c; move it... */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* format a time string (buf must be at least DAV_TIMEBUF_SIZE chars) */
61fd0cab072a05b855cbef9c585702401ac5ae29rbbint dav_validate_root(const ap_xml_doc *doc, const char *tagname);
61fd0cab072a05b855cbef9c585702401ac5ae29rbbap_xml_elem *dav_find_child(const ap_xml_elem *elem, const char *tagname);
3d96ee83babeec32482c9082c9426340cee8c44dwrowe/* gather up all the CDATA into a single string */
a6b9ed64fdf548c61de9714e2cfb999ec59d149cgsteinconst char *dav_xml_get_cdata(const ap_xml_elem *elem, apr_pool_t *pool,
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* --------------------------------------------------------------------
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** DAV PLUGINS
61fd0cab072a05b855cbef9c585702401ac5ae29rbb/* ### docco ... */
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** dav_provider
3d96ee83babeec32482c9082c9426340cee8c44dwrowe** This structure wraps up all of the hooks that a mod_dav provider can
2d2eda71267231c2526be701fe655db125852c1ffielding** supply. The provider MUST supply <repos> and <propdb>. The rest are
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** optional and should contain NULL if that feature is not supplied.
346029f34d03eb20d84fc35664426d3874b00f9ewrowe** Note that a provider cannot pick and choose portions. There are too many
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** dependencies between a dav_resource (defined by <repos>) and the other
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** functionality.
346029f34d03eb20d84fc35664426d3874b00f9ewrowe** Live properties are not part of the dav_provider structure because they
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** are handled through the APR_HOOK interface (to allow for multiple liveprop
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** providers). The core always provides some properties, and then a given
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** provider will add more properties.
3d96ee83babeec32482c9082c9426340cee8c44dwrowetypedef struct {
fd8b91502bc200ed4cca3810560a2a570522b3debrianp** gather_propsets: gather all live property propset-URIs
fd8b91502bc200ed4cca3810560a2a570522b3debrianp** The hook implementor should push one or more URIs into the specified
aa4af3da5c68fe5dbd9d2c3fd7b2fe7103daa2b7dougm** array. These URIs are returned in the DAV: header to let clients know
e351a4349a3dcc2e8d9c27bcdf72414bdde0942frbb** what sets of live properties are supported by the installation. mod_dav
fd8b91502bc200ed4cca3810560a2a570522b3debrianp** will place open/close angle brackets around each value (much like
fd8b91502bc200ed4cca3810560a2a570522b3debrianp** a Coded-URL); quotes and brackets should not be in the value.
4111de96e9f75c58e77c2bdda23be83b8ebf81ccgregames** (of course, use your own domain to ensure a unique value)
4111de96e9f75c58e77c2bdda23be83b8ebf81ccgregamesAPR_DECLARE_EXTERNAL_HOOK(dav, DAV, void, gather_propsets,
fd8b91502bc200ed4cca3810560a2a570522b3debrianp** find_liveprop: find a live property, returning a non-zero, unique,
fd8b91502bc200ed4cca3810560a2a570522b3debrianp** opaque identifier.
45613d36b9466a48def0498cffa07f48980720f8jerenkrantz** If the hook implementor determines the specified URI/name refers to
fd8b91502bc200ed4cca3810560a2a570522b3debrianp** one of its properties, then it should fill in HOOKS and return a
fd8b91502bc200ed4cca3810560a2a570522b3debrianp** non-zero value. The returned value is the "property ID" and will
50e60f30bdc074fbc887f0b98f4d570457ac97c9brianp** be passed to the various liveprop hook functions.
45613d36b9466a48def0498cffa07f48980720f8jerenkrantz** Return 0 if the property is not defined by the hook implementor.
fd8b91502bc200ed4cca3810560a2a570522b3debrianpAPR_DECLARE_EXTERNAL_HOOK(dav, DAV, int, find_liveprop,
4111de96e9f75c58e77c2bdda23be83b8ebf81ccgregames** insert_all_liveprops: insert all (known) live property names/values.
50e60f30bdc074fbc887f0b98f4d570457ac97c9brianp** The hook implementor should append XML text to PHDR, containing liveprop
4111de96e9f75c58e77c2bdda23be83b8ebf81ccgregames** names. If INSVALUE is true, then the property values should also be
4111de96e9f75c58e77c2bdda23be83b8ebf81ccgregames** inserted into the output XML stream.
50e60f30bdc074fbc887f0b98f4d570457ac97c9brianp** The liveprop provider should insert *all* known and *defined* live
50e60f30bdc074fbc887f0b98f4d570457ac97c9brianp** properties on the specified resource. If a particular liveprop is
5a9667916c79d8c699b069068e5570aa1c331c80gstein** not defined for this resource, then it should not be inserted.
61fd0cab072a05b855cbef9c585702401ac5ae29rbbAPR_DECLARE_EXTERNAL_HOOK(dav, DAV, void, insert_all_liveprops,
2d2eda71267231c2526be701fe655db125852c1ffieldingconst dav_hooks_locks *dav_get_lock_hooks(request_rec *r);
3d96ee83babeec32482c9082c9426340cee8c44dwroweconst dav_hooks_propdb *dav_get_propdb_hooks(request_rec *r);
2d2eda71267231c2526be701fe655db125852c1ffieldingconst dav_hooks_vsn *dav_get_vsn_hooks(request_rec *r);
344f3bc38dfccf6261d5bb8d689794cde113b3d6coarconst dav_hooks_binding *dav_get_binding_hooks(request_rec *r);
344f3bc38dfccf6261d5bb8d689794cde113b3d6coarDAV_DECLARE(void) dav_register_provider(apr_pool_t *p, const char *name,
344f3bc38dfccf6261d5bb8d689794cde113b3d6coarconst dav_provider * dav_lookup_provider(const char *name);
5a9667916c79d8c699b069068e5570aa1c331c80gstein/* ### deprecated */
fd0edaa8e3d4dd67d0604ccef2e96b071db96643fielding#define DAV_GET_HOOKS_BINDING(r) dav_get_binding_hooks(r)
fd0edaa8e3d4dd67d0604ccef2e96b071db96643fielding/* --------------------------------------------------------------------
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** IF HEADER PROCESSING
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** Here is the definition of the If: header from RFC 2518, S9.4:
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** If = "If" ":" (1*No-tag-list | 1*Tagged-list)
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** No-tag-list = List
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** Tagged-list = Resource 1*List
42ce672c516baf6e4eaed18ccc1647de2d456d8edougm** Resource = Coded-URL
a6b9ed64fdf548c61de9714e2cfb999ec59d149cgstein** List = "(" 1*(["Not"](State-token | "[" entity-tag "]")) ")"
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** State-token = Coded-URL
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** Coded-URL = "<" absoluteURI ">" ; absoluteURI from RFC 2616
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** List corresponds to dav_if_state_list. No-tag-list corresponds to
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** dav_if_header with uri==NULL. Tagged-list corresponds to a sequence of
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** dav_if_header structures with (duplicate) uri==Resource -- one
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** dav_if_header per state_list. A second Tagged-list will start a new
42ce672c516baf6e4eaed18ccc1647de2d456d8edougm** sequence of dav_if_header structures with the new URI.
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** A summary of the semantics, mapped into our structures:
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** - Chained dav_if_headers: OR
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** - Chained dav_if_state_lists: AND
61fd0cab072a05b855cbef9c585702401ac5ae29rbb** - NULL uri matches all resources
61fd0cab072a05b855cbef9c585702401ac5ae29rbbtypedef enum
61fd0cab072a05b855cbef9c585702401ac5ae29rbbtypedef struct dav_if_state_list
fcc25eda7b150e226d3c1cdaea66a943d3fdee4erbbtypedef struct dav_if_header
0de8f88b22d24dd57ed10b96fb594e69b6aa0072jwoolley const char *uri;
fcc25eda7b150e226d3c1cdaea66a943d3fdee4erbb int dummy_header; /* used internally by the lock/etag validation */
2e75499d05677dd589f7ce6b5139ae15ba049419jerenkrantzdav_error * dav_get_locktoken_list(request_rec *r, dav_locktoken_list **ltl);
fcc25eda7b150e226d3c1cdaea66a943d3fdee4erbb/* --------------------------------------------------------------------
fcc25eda7b150e226d3c1cdaea66a943d3fdee4erbb** LIVE PROPERTY HANDLING
fcc25eda7b150e226d3c1cdaea66a943d3fdee4erbb/* opaque type for PROPPATCH rollback information */
561e5f16a2f9fb397aac4c283aaa87a752520a4ddougmtypedef struct dav_liveprop_rollback dav_liveprop_rollback;
fcc25eda7b150e226d3c1cdaea66a943d3fdee4erbb ** Insert property information into a text block. The property to
fcc25eda7b150e226d3c1cdaea66a943d3fdee4erbb ** insert is identified by the propid value. The information to insert
fcc25eda7b150e226d3c1cdaea66a943d3fdee4erbb ** is identified by the "what" argument, as follows:
fcc25eda7b150e226d3c1cdaea66a943d3fdee4erbb ** DAV_PROP_INSERT_NAME
2fc50921b88defeb7127985dfe4b4130175e069ejwoolley ** property name, as an empty XML element
2fc50921b88defeb7127985dfe4b4130175e069ejwoolley ** DAV_PROP_INSERT_VALUE
fcc25eda7b150e226d3c1cdaea66a943d3fdee4erbb ** property name/value, as an XML element
2fc50921b88defeb7127985dfe4b4130175e069ejwoolley ** DAV_PROP_INSERT_SUPPORTED
fcc25eda7b150e226d3c1cdaea66a943d3fdee4erbb ** if the property is defined on the resource, then
2fc50921b88defeb7127985dfe4b4130175e069ejwoolley ** a DAV:supported-live-property element, as defined
2fc50921b88defeb7127985dfe4b4130175e069ejwoolley ** by the DeltaV extensions to RFC2518.
fcc25eda7b150e226d3c1cdaea66a943d3fdee4erbb ** Providers should return DAV_PROP_INSERT_NOTDEF if the property is
c9a95767fbf0f5fb0976a06b97a256033925e433rbb ** known and not defined for this resource, so should be handled as a
c9a95767fbf0f5fb0976a06b97a256033925e433rbb ** dead property. If a provider recognizes, but does not support, a
c9a95767fbf0f5fb0976a06b97a256033925e433rbb ** property, and does not want it handled as a dead property, it should
c9a95767fbf0f5fb0976a06b97a256033925e433rbb ** return DAV_PROP_INSERT_NOTSUPP.
c9a95767fbf0f5fb0976a06b97a256033925e433rbb ** Returns one of DAV_PROP_INSERT_* based on what happened.
c9a95767fbf0f5fb0976a06b97a256033925e433rbb ** ### we may need more context... ie. the lock database
c9a95767fbf0f5fb0976a06b97a256033925e433rbb dav_prop_insert (*insert_prop)(const dav_resource *resource,
2d2eda71267231c2526be701fe655db125852c1ffielding ** Determine whether a given property is writable.
2d2eda71267231c2526be701fe655db125852c1ffielding ** ### we may want a different semantic. i.e. maybe it should be
2d2eda71267231c2526be701fe655db125852c1ffielding ** ### "can we write <value> into this property?"
const char * const * namespace_uris;
int operation,
void **context,
int *defer_to_dead);
int operation,
void *context,
int operation,
void *context,
int operation,
void *context,
const char * const *namespace_uris;
int dav_get_liveprop_ns_count(void);
struct dav_hooks_propdb
#define DAV_TIMEOUT_INFINITE 0
} dav_lockdb;
typedef struct dav_lock
} dav_lock;
int resource_state,
int depth);
struct dav_hooks_locks
const char * (*get_supportedlock)(
apr_pool_t *p,
const char *char_token,
const char * (*format_locktoken)(
apr_pool_t *p,
int (*compare_locktoken)(
request_rec *r,
int ro,
int force,
void (*close_lockdb)(
int calltype,
int partial_ok,
int *locks_present);
int make_indirect,
request_rec *r,
int ro,
const char *ns_uri,
const char *propname,
** differentiate/group the "desc" values.
typedef struct dav_prop_ctx
int operation;
int is_liveprop;
void *liveprop_ctx;
/* private to mod_dav.c */
request_rec *r;
} dav_prop_ctx;
void *walk_ctx;
int walk_type;
void *walk_ctx;
typedef struct dav_walker_ctx
int propfind_type;
int flags;
int status,
struct dav_hooks_repository
int handle_get;
request_rec *r,
const char *root_dir,
const char *label,
int use_checked_in,
int (*is_same_resource)(
int (*is_parent_resource)(
const char * (*get_pathname)(
void **free_handle_p
void (*free_file)(
void *free_handle
int depth,
int parent_only,
request_rec *r,
int undo,
struct dav_hooks_vsn
const char *target);
int create_activity,
int keep_checked_out,
const char *label,
int depth,
const char *label,
int replace);
const char *label);
struct dav_hooks_binding {
#ifdef __cplusplus