Apache2
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
mod_dav.h
Go to the documentation of this file.
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements. See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License. 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 
26 #ifndef _MOD_DAV_H_
27 #define _MOD_DAV_H_
28 
29 #include "apr_hooks.h"
30 #include "apr_hash.h"
31 #include "apr_dbm.h"
32 #include "apr_tables.h"
33 
34 #include "httpd.h"
35 #include "util_filter.h"
36 #include "util_xml.h"
37 
38 #include <limits.h> /* for INT_MAX */
39 #include <time.h> /* for time_t */
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 
46 #define DAV_VERSION AP_SERVER_BASEREVISION
47 
48 #define DAV_XML_HEADER "<?xml version=\"1.0\" encoding=\"utf-8\"?>"
49 #define DAV_XML_CONTENT_TYPE "text/xml; charset=\"utf-8\""
50 
51 #define DAV_READ_BLOCKSIZE 2048 /* used for reading input blocks */
52 
53 #define DAV_RESPONSE_BODY_1 "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n<html><head>\n<title>"
54 #define DAV_RESPONSE_BODY_2 "</title>\n</head><body>\n<h1>"
55 #define DAV_RESPONSE_BODY_3 "</h1>\n<p>"
56 #define DAV_RESPONSE_BODY_4 "</p>\n"
57 #define DAV_RESPONSE_BODY_5 "</body></html>\n"
58 
59 #define DAV_DO_COPY 0
60 #define DAV_DO_MOVE 1
61 
62 
63 #if 1
64 #define DAV_DEBUG 1
65 #define DEBUG_CR "\n"
66 #define DBG0(f) ap_log_error(APLOG_MARK, \
67  APLOG_ERR, 0, NULL, (f))
68 #define DBG1(f,a1) ap_log_error(APLOG_MARK, \
69  APLOG_ERR, 0, NULL, f, a1)
70 #define DBG2(f,a1,a2) ap_log_error(APLOG_MARK, \
71  APLOG_ERR, 0, NULL, f, a1, a2)
72 #define DBG3(f,a1,a2,a3) ap_log_error(APLOG_MARK, \
73  APLOG_ERR, 0, NULL, f, a1, a2, a3)
74 #else
75 #undef DAV_DEBUG
76 #define DEBUG_CR ""
77 #endif
78 
79 #define DAV_INFINITY INT_MAX /* for the Depth: header */
80 
81 /* Create a set of DAV_DECLARE(type), DAV_DECLARE_NONSTD(type) and
82  * DAV_DECLARE_DATA with appropriate export and import tags for the platform
83  */
84 #if !defined(WIN32)
85 #define DAV_DECLARE(type) type
86 #define DAV_DECLARE_NONSTD(type) type
87 #define DAV_DECLARE_DATA
88 #elif defined(DAV_DECLARE_STATIC)
89 #define DAV_DECLARE(type) type __stdcall
90 #define DAV_DECLARE_NONSTD(type) type
91 #define DAV_DECLARE_DATA
92 #elif defined(DAV_DECLARE_EXPORT)
93 #define DAV_DECLARE(type) __declspec(dllexport) type __stdcall
94 #define DAV_DECLARE_NONSTD(type) __declspec(dllexport) type
95 #define DAV_DECLARE_DATA __declspec(dllexport)
96 #else
97 #define DAV_DECLARE(type) __declspec(dllimport) type __stdcall
98 #define DAV_DECLARE_NONSTD(type) __declspec(dllimport) type
99 #define DAV_DECLARE_DATA __declspec(dllimport)
100 #endif
101 
102 /* --------------------------------------------------------------------
103 **
104 ** ERROR MANAGEMENT
105 */
106 
107 /*
108 ** dav_error structure.
109 **
110 ** In most cases, mod_dav uses a pointer to a dav_error structure. If the
111 ** pointer is NULL, then no error has occurred.
112 **
113 ** In certain cases, a dav_error structure is directly used. In these cases,
114 ** a status value of 0 means that an error has not occurred.
115 **
116 ** Note: this implies that status != 0 whenever an error occurs.
117 **
118 ** The desc field is optional (it may be NULL). When NULL, it typically
119 ** implies that Apache has a proper description for the specified status.
120 */
121 typedef struct dav_error {
122  int status; /* suggested HTTP status (0 for no error) */
123  int error_id; /* DAV-specific error ID */
124  const char *desc; /* DAV:responsedescription and error log */
125 
126  apr_status_t aprerr; /* APR error if any, or 0/APR_SUCCESS */
127 
128  const char *namespace; /* [optional] namespace of error */
129  const char *tagname; /* name of error-tag */
130 
131  struct dav_error *prev; /* previous error (in stack) */
132 
133  const char *childtags; /* error-tag may have children */
134 
135 } dav_error;
136 
137 /*
138 ** Create a new error structure. save_errno will be filled with the current
139 ** errno value.
140 */
141 DAV_DECLARE(dav_error*) dav_new_error(apr_pool_t *p, int status,
143  const char *desc);
144 
145 
146 /*
147 ** Create a new error structure with tagname and (optional) namespace;
148 ** namespace may be NULL, which means "DAV:".
149 */
150 DAV_DECLARE(dav_error*) dav_new_error_tag(apr_pool_t *p, int status,
151  int error_id, apr_status_t aprerr,
152  const char *desc,
153  const char *namespace,
154  const char *tagname);
155 
156 
157 /*
158 ** Push a new error description onto the stack of errors.
159 **
160 ** This function is used to provide an additional description to an existing
161 ** error.
162 **
163 ** <status> should contain the caller's view of what the current status is,
164 ** given the underlying error. If it doesn't have a better idea, then the
165 ** caller should pass prev->status.
166 **
167 ** <error_id> can specify a new error_id since the topmost description has
168 ** changed.
169 */
170 DAV_DECLARE(dav_error*) dav_push_error(apr_pool_t *p, int status, int error_id,
171  const char *desc, dav_error *prev);
172 
173 
174 /*
175 ** Join two errors together.
176 **
177 ** This function is used to add a new error stack onto an existing error so
178 ** that subsequent errors can be reported after the first error. It returns
179 ** the correct error stack to use so that the caller can blindly call it
180 ** without checking that both dest and src are not NULL.
181 **
182 ** <dest> is the error stack that the error will be added to.
183 **
184 ** <src> is the error stack that will be appended.
185 */
186 DAV_DECLARE(dav_error*) dav_join_error(dav_error* dest, dav_error* src);
187 
188 typedef struct dav_response dav_response;
189 
190 /*
191 ** dav_handle_err()
192 **
193 ** Handle the standard error processing. <err> must be non-NULL.
194 **
195 ** <response> is set by the following:
196 ** - dav_validate_request()
197 ** - dav_add_lock()
198 ** - repos_hooks->remove_resource
199 ** - repos_hooks->move_resource
200 ** - repos_hooks->copy_resource
201 ** - vsn_hooks->update
202 */
203 DAV_DECLARE(int) dav_handle_err(request_rec *r, dav_error *err,
204  dav_response *response);
205 
206 /* error ID values... */
207 
208 /* IF: header errors */
209 #define DAV_ERR_IF_PARSE 100 /* general parsing error */
210 #define DAV_ERR_IF_MULTIPLE_NOT 101 /* multiple "Not" found */
211 #define DAV_ERR_IF_UNK_CHAR 102 /* unknown char in header */
212 #define DAV_ERR_IF_ABSENT 103 /* no locktokens given */
213 #define DAV_ERR_IF_TAGGED 104 /* in parsing tagged-list */
214 #define DAV_ERR_IF_UNCLOSED_PAREN 105 /* in no-tagged-list */
215 
216 /* Prop DB errors */
217 #define DAV_ERR_PROP_BAD_MAJOR 200 /* major version was wrong */
218 #define DAV_ERR_PROP_READONLY 201 /* prop is read-only */
219 #define DAV_ERR_PROP_NO_DATABASE 202 /* writable db not avail */
220 #define DAV_ERR_PROP_NOT_FOUND 203 /* prop not found */
221 #define DAV_ERR_PROP_BAD_LOCKDB 204 /* could not open lockdb */
222 #define DAV_ERR_PROP_OPENING 205 /* problem opening propdb */
223 #define DAV_ERR_PROP_EXEC 206 /* problem exec'ing patch */
224 
225 /* Predefined DB errors */
226 /* ### any to define?? */
227 
228 /* Predefined locking system errors */
229 #define DAV_ERR_LOCK_OPENDB 400 /* could not open lockdb */
230 #define DAV_ERR_LOCK_NO_DB 401 /* no database defined */
231 #define DAV_ERR_LOCK_CORRUPT_DB 402 /* DB is corrupt */
232 #define DAV_ERR_LOCK_UNK_STATE_TOKEN 403 /* unknown State-token */
233 #define DAV_ERR_LOCK_PARSE_TOKEN 404 /* bad opaquelocktoken */
234 #define DAV_ERR_LOCK_SAVE_LOCK 405 /* err saving locks */
235 
236 /*
237 ** Some comments on Error ID values:
238 **
239 ** The numbers do not necessarily need to be unique. Uniqueness simply means
240 ** that two errors that have not been predefined above can be distinguished
241 ** from each other. At the moment, mod_dav does not use this distinguishing
242 ** feature, but it could be used in the future to collapse <response> elements
243 ** into groups based on the error ID (and associated responsedescription).
244 **
245 ** If a compute_desc is provided, then the error ID should be unique within
246 ** the context of the compute_desc function (so the function can figure out
247 ** what to filled into the desc).
248 **
249 ** Basically, subsystems can ignore defining new error ID values if they want
250 ** to. The subsystems *do* need to return the predefined errors when
251 ** appropriate, so that mod_dav can figure out what to do. Subsystems can
252 ** simply leave the error ID field unfilled (zero) if there isn't an error
253 ** that must be placed there.
254 */
255 
256 
257 /* --------------------------------------------------------------------
258 **
259 ** HOOK STRUCTURES
260 **
261 ** These are here for forward-declaration purposes. For more info, see
262 ** the section title "HOOK HANDLING" for more information, plus each
263 ** structure definition.
264 */
265 
266 /* forward-declare this structure */
274 
275 /* ### deprecated name */
277 
278 
279 /* --------------------------------------------------------------------
280 **
281 ** RESOURCE HANDLING
282 */
283 
284 /*
285 ** Resource Types:
286 ** The base protocol defines only file and collection resources.
287 ** The versioning protocol defines several additional resource types
288 ** to represent artifacts of a version control system.
289 **
290 ** This enumeration identifies the type of URL used to identify the
291 ** resource. Since the same resource may have more than one type of
292 ** URL which can identify it, dav_resource_type cannot be used
293 ** alone to determine the type of the resource; attributes of the
294 ** dav_resource object must also be consulted.
295 */
296 typedef enum {
298 
299  DAV_RESOURCE_TYPE_REGULAR, /* file or collection; could be
300  * unversioned, or version selector,
301  * or baseline selector */
302 
303  DAV_RESOURCE_TYPE_VERSION, /* version or baseline URL */
304 
305  DAV_RESOURCE_TYPE_HISTORY, /* version or baseline history URL */
306 
307  DAV_RESOURCE_TYPE_WORKING, /* working resource URL */
308 
309  DAV_RESOURCE_TYPE_WORKSPACE, /* workspace URL */
310 
311  DAV_RESOURCE_TYPE_ACTIVITY, /* activity URL */
312 
313  DAV_RESOURCE_TYPE_PRIVATE /* repository-private type */
314 
316 
317 /*
318 ** Opaque, repository-specific information for a resource.
319 */
321 
322 #ifdef APR_XML_X2T_PARSED
323 typedef struct dav_acl_provider dav_acl_provider;
324 #endif
325 
326 /*
327 ** Resource descriptor, generated by a repository provider.
328 **
329 ** Note: the lock-null state is not explicitly represented here,
330 ** since it may be expensive to compute. Use dav_get_resource_state()
331 ** to determine whether a non-existent resource is a lock-null resource.
332 **
333 ** A quick explanation of how the flags can apply to different resources:
334 **
335 ** unversioned file or collection:
336 ** type = DAV_RESOURCE_TYPE_REGULAR
337 ** exists = ? (1 if exists)
338 ** collection = ? (1 if collection)
339 ** versioned = 0
340 ** baselined = 0
341 ** working = 0
342 **
343 ** version-controlled resource or configuration:
344 ** type = DAV_RESOURCE_TYPE_REGULAR
345 ** exists = 1
346 ** collection = ? (1 if collection)
347 ** versioned = 1
348 ** baselined = ? (1 if configuration)
349 ** working = ? (1 if checked out)
350 **
351 ** version/baseline history:
352 ** type = DAV_RESOURCE_TYPE_HISTORY
353 ** exists = 1
354 ** collection = 0
355 ** versioned = 0
356 ** baselined = 0
357 ** working = 0
358 **
359 ** version/baseline:
360 ** type = DAV_RESOURCE_TYPE_VERSION
361 ** exists = 1
362 ** collection = ? (1 if collection)
363 ** versioned = 1
364 ** baselined = ? (1 if baseline)
365 ** working = 0
366 **
367 ** working resource:
368 ** type = DAV_RESOURCE_TYPE_WORKING
369 ** exists = 1
370 ** collection = ? (1 if collection)
371 ** versioned = 1
372 ** baselined = 0
373 ** working = 1
374 **
375 ** workspace:
376 ** type = DAV_RESOURCE_TYPE_WORKSPACE
377 ** exists = ? (1 if exists)
378 ** collection = 1
379 ** versioned = ? (1 if version-controlled)
380 ** baselined = ? (1 if baseline-controlled)
381 ** working = ? (1 if checked out)
382 **
383 ** activity:
384 ** type = DAV_RESOURCE_TYPE_ACTIVITY
385 ** exists = ? (1 if exists)
386 ** collection = 0
387 ** versioned = 0
388 ** baselined = 0
389 ** working = 0
390 */
391 typedef struct dav_resource {
393 
394  int exists; /* 0 => null resource */
395 
396  int collection; /* 0 => file; can be 1 for
397  * REGULAR, VERSION, and WORKING resources,
398  * and is always 1 for WORKSPACE */
399 
400  int versioned; /* 0 => unversioned; can be 1 for
401  * REGULAR and WORKSPACE resources,
402  * and is always 1 for VERSION and WORKING */
403 
404  int baselined; /* 0 => not baselined; can be 1 for
405  * REGULAR, VERSION, and WORKSPACE resources;
406  * versioned == 1 when baselined == 1 */
407 
408  int working; /* 0 => not checked out; can be 1 for
409  * REGULAR and WORKSPACE resources,
410  * and is always 1 for WORKING */
411 
412  const char *uri; /* the URI for this resource;
413  * currently has an ABI flaw where sometimes it is
414  * assumed to be encoded and sometimes not */
415 
416  dav_resource_private *info; /* the provider's private info */
417 
418  const dav_hooks_repository *hooks; /* hooks used for this resource */
419 
420  /* When allocating items related specifically to this resource, the
421  following pool should be used. Its lifetime will be at least as
422  long as the dav_resource structure. */
424 
425 #ifdef APR_XML_X2T_PARSED
426  const dav_acl_provider *acls; /* acls used for this resource */
427 #endif
428 
429  void *ctx; /* additional parameter */
430 
431 } dav_resource;
432 
433 /*
434 ** Lock token type. Lock providers define the details of a lock token.
435 ** However, all providers are expected to at least be able to parse
436 ** the "opaquelocktoken" scheme, which is represented by a uuid_t.
437 */
439 
440 
441 /* --------------------------------------------------------------------
442 **
443 ** BUFFER HANDLING
444 **
445 ** These buffers are used as a lightweight buffer reuse mechanism. Apache
446 ** provides sub-pool creation and destruction to much the same effect, but
447 ** the sub-pools are a bit more general and heavyweight than these buffers.
448 */
449 
450 /* buffer for reuse; can grow to accommodate needed size */
451 typedef struct
452 {
453  apr_size_t alloc_len; /* how much has been allocated */
454  apr_size_t cur_len; /* how much is currently being used */
455  char *buf; /* buffer contents */
456 } dav_buffer;
457 #define DAV_BUFFER_MINSIZE 256 /* minimum size for buffer */
458 #define DAV_BUFFER_PAD 64 /* amount of pad when growing */
459 
460 /* set the cur_len to the given size and ensure space is available */
461 DAV_DECLARE(void) dav_set_bufsize(apr_pool_t *p, dav_buffer *pbuf,
462  apr_size_t size);
463 
464 /* initialize a buffer and copy the specified (null-term'd) string into it */
465 DAV_DECLARE(void) dav_buffer_init(apr_pool_t *p, dav_buffer *pbuf,
466  const char *str);
467 
468 /* check that the buffer can accommodate <extra_needed> more bytes */
469 DAV_DECLARE(void) dav_check_bufsize(apr_pool_t *p, dav_buffer *pbuf,
471 
472 /* append a string to the end of the buffer, adjust length */
473 DAV_DECLARE(void) dav_buffer_append(apr_pool_t *p, dav_buffer *pbuf,
474  const char *str);
475 
476 /* place a string on the end of the buffer, do NOT adjust length */
477 DAV_DECLARE(void) dav_buffer_place(apr_pool_t *p, dav_buffer *pbuf,
478  const char *str);
479 
480 /* place some memory on the end of a buffer; do NOT adjust length */
481 DAV_DECLARE(void) dav_buffer_place_mem(apr_pool_t *p, dav_buffer *pbuf,
482  const void *mem, apr_size_t amt,
483  apr_size_t pad);
484 
485 
486 /* --------------------------------------------------------------------
487 **
488 ** HANDY UTILITIES
489 */
490 
491 /* contains results from one of the getprop functions */
492 typedef struct
493 {
494  apr_text * propstats; /* <propstat> element text */
495  apr_text * xmlns; /* namespace decls for <response> elem */
497 
498 /* holds the contents of a <response> element */
499 struct dav_response
500 {
501  const char *href; /* always */
502  const char *desc; /* optional description at <response> level */
503 
504  /* use status if propresult.propstats is NULL. */
506 
507  int status;
508 
509  struct dav_response *next;
510 };
511 
512 typedef struct
513 {
514  request_rec *rnew; /* new subrequest */
515  dav_error err; /* potential error response */
517 
518 
519 DAV_DECLARE(dav_lookup_result) dav_lookup_uri(const char *uri, request_rec *r,
520  int must_be_absolute);
521 
522 /* defines type of property info a provider is to return */
523 typedef enum {
524  DAV_PROP_INSERT_NOTDEF, /* property is defined by this provider,
525  but nothing was inserted because the
526  (live) property is not defined for this
527  resource (it may be present as a dead
528  property). */
529  DAV_PROP_INSERT_NOTSUPP, /* property is recognized by this provider,
530  but it is not supported, and cannot be
531  treated as a dead property */
532  DAV_PROP_INSERT_NAME, /* a property name (empty elem) was
533  inserted into the text block */
534  DAV_PROP_INSERT_VALUE, /* a property name/value pair was inserted
535  into the text block */
536  DAV_PROP_INSERT_SUPPORTED /* a supported live property was added to
537  the text block as a
538  <DAV:supported-live-property> element */
540 
541 /* ### this stuff is private to dav/fs/repos.c; move it... */
542 /* format a time string (buf must be at least DAV_TIMEBUF_SIZE chars) */
543 #define DAV_STYLE_ISO8601 1
544 #define DAV_STYLE_RFC822 2
545 #define DAV_TIMEBUF_SIZE 30
546 
547 /* Write a complete RESPONSE object out as a <DAV:response> xml
548  * element. Data is sent into brigade BB, which is auto-flushed into
549  * the output filter stack for request R. Use POOL for any temporary
550  * allocations.
551  *
552  * [Presumably the <multistatus> tag has already been written; this
553  * routine is shared by dav_send_multistatus and dav_stream_response.]
554  */
555 DAV_DECLARE(void) dav_send_one_response(dav_response *response,
557  request_rec *r,
558  apr_pool_t *pool);
559 
560 /* Factorized helper function: prep request_rec R for a multistatus
561  * response and write <multistatus> tag into BB, destined for
562  * R->output_filters. Use xml NAMESPACES in initial tag, if
563  * non-NULL.
564  */
565 DAV_DECLARE(void) dav_begin_multistatus(apr_bucket_brigade *bb,
566  request_rec *r, int status,
568 
569 /* Finish a multistatus response started by dav_begin_multistatus: */
570 DAV_DECLARE(apr_status_t) dav_finish_multistatus(request_rec *r,
571  apr_bucket_brigade *bb);
572 
573 /* Send a multistatus response */
574 DAV_DECLARE(void) dav_send_multistatus(request_rec *r, int status,
575  dav_response *first,
576  apr_array_header_t *namespaces);
577 
578 DAV_DECLARE(apr_text *) dav_failed_proppatch(apr_pool_t *p,
580 DAV_DECLARE(apr_text *) dav_success_proppatch(apr_pool_t *p,
581  apr_array_header_t *prop_ctx);
582 
583 DAV_DECLARE(int) dav_get_depth(request_rec *r, int def_depth);
584 
585 DAV_DECLARE(int) dav_validate_root(const apr_xml_doc *doc,
586  const char *tagname);
587 DAV_DECLARE(apr_xml_elem *) dav_find_child(const apr_xml_elem *elem,
588  const char *tagname);
589 
590 /* gather up all the CDATA into a single string */
591 DAV_DECLARE(const char *) dav_xml_get_cdata(const apr_xml_elem *elem, apr_pool_t *pool,
592  int strip_white);
593 
594 /*
595 ** XML namespace handling
596 **
597 ** This structure tracks namespace declarations (xmlns:prefix="URI").
598 ** It maintains a one-to-many relationship of URIs-to-prefixes. In other
599 ** words, one URI may be defined by many prefixes, but any specific
600 ** prefix will specify only one URI.
601 **
602 ** Prefixes using the "g###" pattern can be generated automatically if
603 ** the caller does not have specific prefix requirements.
604 */
605 typedef struct {
607  apr_hash_t *uri_prefix; /* map URIs to an available prefix */
608  apr_hash_t *prefix_uri; /* map all prefixes to their URIs */
609  int count; /* counter for "g###" prefixes */
611 
612 /* create an empty dav_xmlns_info structure */
613 DAV_DECLARE(dav_xmlns_info *) dav_xmlns_create(apr_pool_t *pool);
614 
615 /* add a specific prefix/URI pair. the prefix/uri should have a lifetime
616  at least that of xmlns->pool */
617 DAV_DECLARE(void) dav_xmlns_add(dav_xmlns_info *xi,
618  const char *prefix, const char *uri);
619 
620 /* add a URI (if not present); any prefix is acceptable and is returned.
621  the uri should have a lifetime at least that xmlns->pool */
622 DAV_DECLARE(const char *) dav_xmlns_add_uri(dav_xmlns_info *xi,
623  const char *uri);
624 
625 /* return the URI for a specified prefix (or NULL if the prefix is unknown) */
626 DAV_DECLARE(const char *) dav_xmlns_get_uri(dav_xmlns_info *xi,
627  const char *prefix);
628 
629 /* return an available prefix for a specified URI (or NULL if the URI
630  is unknown) */
631 DAV_DECLARE(const char *) dav_xmlns_get_prefix(dav_xmlns_info *xi,
632  const char *uri);
633 
634 /* generate xmlns declarations (appending into the given text) */
635 DAV_DECLARE(void) dav_xmlns_generate(dav_xmlns_info *xi,
637 
638 /* --------------------------------------------------------------------
639 **
640 ** DAV PLUGINS
641 */
642 
643 /* ### docco ... */
644 
645 /*
646 ** dav_provider
647 **
648 ** This structure wraps up all of the hooks that a mod_dav provider can
649 ** supply. The provider MUST supply <repos> and <propdb>. The rest are
650 ** optional and should contain NULL if that feature is not supplied.
651 **
652 ** Note that a provider cannot pick and choose portions from various
653 ** underlying implementations (which was theoretically possible in
654 ** mod_dav 1.0). There are too many dependencies between a dav_resource
655 ** (defined by <repos>) and the other functionality.
656 **
657 ** Live properties are not part of the dav_provider structure because they
658 ** are handled through the APR_HOOK interface (to allow for multiple liveprop
659 ** providers). The core always provides some properties, and then a given
660 ** provider will add more properties.
661 **
662 ** Some providers may need to associate a context with the dav_provider
663 ** structure -- the ctx field is available for storing this context. Just
664 ** leave it NULL if it isn't required.
665 */
666 typedef struct {
673 
674  void *ctx;
675 } dav_provider;
676 
677 /*
678 ** gather_propsets: gather all live property propset-URIs
679 **
680 ** The hook implementor should push one or more URIs into the specified
681 ** array. These URIs are returned in the DAV: header to let clients know
682 ** what sets of live properties are supported by the installation. mod_dav
683 ** will place open/close angle brackets around each value (much like
684 ** a Coded-URL); quotes and brackets should not be in the value.
685 **
686 ** Example: http://apache.org/dav/props/
687 **
688 ** (of course, use your own domain to ensure a unique value)
689 */
690 APR_DECLARE_EXTERNAL_HOOK(dav, DAV, void, gather_propsets,
691  (apr_array_header_t *uris))
692 
693 /*
694 ** find_liveprop: find a live property, returning a non-zero, unique,
695 ** opaque identifier.
696 **
697 ** If the hook implementor determines the specified URI/name refers to
698 ** one of its properties, then it should fill in HOOKS and return a
699 ** non-zero value. The returned value is the "property ID" and will
700 ** be passed to the various liveprop hook functions.
701 **
702 ** Return 0 if the property is not defined by the hook implementor.
703 */
704 APR_DECLARE_EXTERNAL_HOOK(dav, DAV, int, find_liveprop,
705  (const dav_resource *resource,
706  const char *ns_uri, const char *name,
707  const dav_hooks_liveprop **hooks))
708 
709 /*
710 ** insert_all_liveprops: insert all (known) live property names/values.
711 **
712 ** The hook implementor should append XML text to PHDR, containing liveprop
713 ** names. If INSVALUE is true, then the property values should also be
714 ** inserted into the output XML stream.
715 **
716 ** The liveprop provider should insert *all* known and *defined* live
717 ** properties on the specified resource. If a particular liveprop is
718 ** not defined for this resource, then it should not be inserted.
719 */
720 APR_DECLARE_EXTERNAL_HOOK(dav, DAV, void, insert_all_liveprops,
721  (request_rec *r, const dav_resource *resource,
723 
724 DAV_DECLARE(const dav_hooks_locks *) dav_get_lock_hooks(request_rec *r);
725 DAV_DECLARE(const dav_hooks_propdb *) dav_get_propdb_hooks(request_rec *r);
726 DAV_DECLARE(const dav_hooks_vsn *) dav_get_vsn_hooks(request_rec *r);
727 DAV_DECLARE(const dav_hooks_binding *) dav_get_binding_hooks(request_rec *r);
728 DAV_DECLARE(const dav_hooks_search *) dav_get_search_hooks(request_rec *r);
729 
730 DAV_DECLARE(void) dav_register_provider(apr_pool_t *p, const char *name,
731  const dav_provider *hooks);
732 DAV_DECLARE(const dav_provider *) dav_lookup_provider(const char *name);
733 DAV_DECLARE(const char *) dav_get_provider_name(request_rec *r);
734 
735 
736 /* ### deprecated */
737 #define DAV_GET_HOOKS_PROPDB(r) dav_get_propdb_hooks(r)
738 #define DAV_GET_HOOKS_LOCKS(r) dav_get_lock_hooks(r)
739 #define DAV_GET_HOOKS_VSN(r) dav_get_vsn_hooks(r)
740 #define DAV_GET_HOOKS_BINDING(r) dav_get_binding_hooks(r)
741 #define DAV_GET_HOOKS_SEARCH(r) dav_get_search_hooks(r)
742 
743 
744 /* --------------------------------------------------------------------
745 **
746 ** IF HEADER PROCESSING
747 **
748 ** Here is the definition of the If: header from RFC 2518, S9.4:
749 **
750 ** If = "If" ":" (1*No-tag-list | 1*Tagged-list)
751 ** No-tag-list = List
752 ** Tagged-list = Resource 1*List
753 ** Resource = Coded-URL
754 ** List = "(" 1*(["Not"](State-token | "[" entity-tag "]")) ")"
755 ** State-token = Coded-URL
756 ** Coded-URL = "<" absoluteURI ">" ; absoluteURI from RFC 2616
757 **
758 ** List corresponds to dav_if_state_list. No-tag-list corresponds to
759 ** dav_if_header with uri==NULL. Tagged-list corresponds to a sequence of
760 ** dav_if_header structures with (duplicate) uri==Resource -- one
761 ** dav_if_header per state_list. A second Tagged-list will start a new
762 ** sequence of dav_if_header structures with the new URI.
763 **
764 ** A summary of the semantics, mapped into our structures:
765 ** - Chained dav_if_headers: OR
766 ** - Chained dav_if_state_lists: AND
767 ** - NULL uri matches all resources
768 */
769 
770 typedef enum
771 {
774  dav_if_unknown /* the "unknown" state type; always matches false. */
776 
777 typedef struct dav_if_state_list
778 {
780 
782 #define DAV_IF_COND_NORMAL 0
783 #define DAV_IF_COND_NOT 1 /* "Not" was applied */
784 
785  const char *etag;
787 
790 
791 typedef struct dav_if_header
792 {
793  const char *uri;
797 
798  int dummy_header; /* used internally by the lock/etag validation */
799 } dav_if_header;
800 
801 typedef struct dav_locktoken_list
802 {
806 
807 DAV_DECLARE(dav_error *) dav_get_locktoken_list(request_rec *r,
809 
810 
811 /* --------------------------------------------------------------------
812 **
813 ** LIVE PROPERTY HANDLING
814 */
815 
816 /* opaque type for PROPPATCH rollback information */
818 
820 {
821  /*
822  ** Insert property information into a text block. The property to
823  ** insert is identified by the propid value. The information to insert
824  ** is identified by the "what" argument, as follows:
825  ** DAV_PROP_INSERT_NAME
826  ** property name, as an empty XML element
827  ** DAV_PROP_INSERT_VALUE
828  ** property name/value, as an XML element
829  ** DAV_PROP_INSERT_SUPPORTED
830  ** if the property is defined on the resource, then
831  ** a DAV:supported-live-property element, as defined
832  ** by the DeltaV extensions to RFC2518.
833  **
834  ** Providers should return DAV_PROP_INSERT_NOTDEF if the property is
835  ** known and not defined for this resource, so should be handled as a
836  ** dead property. If a provider recognizes, but does not support, a
837  ** property, and does not want it handled as a dead property, it should
838  ** return DAV_PROP_INSERT_NOTSUPP.
839  **
840  ** Returns one of DAV_PROP_INSERT_* based on what happened.
841  **
842  ** ### we may need more context... ie. the lock database
843  */
844  dav_prop_insert (*insert_prop)(const dav_resource *resource,
845  int propid, dav_prop_insert what,
847 
848  /*
849  ** Determine whether a given property is writable.
850  **
851  ** ### we may want a different semantic. i.e. maybe it should be
852  ** ### "can we write <value> into this property?"
853  **
854  ** Returns 1 if the live property can be written, 0 if read-only.
855  */
856  int (*is_writable)(const dav_resource *resource, int propid);
857 
858  /*
859  ** This member defines the set of namespace URIs that the provider
860  ** uses for its properties. When insert_all is called, it will be
861  ** passed a list of integers that map from indices into this list
862  ** to namespace IDs for output generation.
863  **
864  ** The last entry in this list should be a NULL value (sentinel).
865  */
866  const char * const * namespace_uris;
867 
868  /*
869  ** ### this is not the final design. we want an open-ended way for
870  ** ### liveprop providers to attach *new* properties. To this end,
871  ** ### we'll have a "give me a list of the props you define", a way
872  ** ### to check for a prop's existence, a way to validate a set/remove
873  ** ### of a prop, and a way to execute/commit/rollback that change.
874  */
875 
876  /*
877  ** Validate that the live property can be assigned a value, and that
878  ** the provided value is valid.
879  **
880  ** elem will point to the XML element that names the property. For
881  ** example:
882  ** <lp1:executable>T</lp1:executable>
883  **
884  ** The provider can access the cdata fields and the child elements
885  ** to extract the relevant pieces.
886  **
887  ** operation is one of DAV_PROP_OP_SET or _DELETE.
888  **
889  ** The provider may return a value in *context which will be passed
890  ** to each of the exec/commit/rollback functions. For example, this
891  ** may contain an internal value which has been processed from the
892  ** input element.
893  **
894  ** The provider must set defer_to_dead to true (non-zero) or false.
895  ** If true, then the set/remove is deferred to the dead property
896  ** database. Note: it will be set to zero on entry.
897  */
898  dav_error * (*patch_validate)(const dav_resource *resource,
899  const apr_xml_elem *elem,
900  int operation,
901  void **context,
902  int *defer_to_dead);
903 
904  /* ### doc... */
905  dav_error * (*patch_exec)(const dav_resource *resource,
906  const apr_xml_elem *elem,
907  int operation,
908  void *context,
909  dav_liveprop_rollback **rollback_ctx);
910 
911  /* ### doc... */
912  void (*patch_commit)(const dav_resource *resource,
913  int operation,
914  void *context,
915  dav_liveprop_rollback *rollback_ctx);
916 
917  /* ### doc... */
918  dav_error * (*patch_rollback)(const dav_resource *resource,
919  int operation,
920  void *context,
921  dav_liveprop_rollback *rollback_ctx);
922 
923  /*
924  ** If a provider needs a context to associate with this hooks structure,
925  ** then this field may be used. In most cases, it will just be NULL.
926  */
927  void *ctx;
928 };
929 
930 /*
931 ** dav_liveprop_spec: specify a live property
932 **
933 ** This structure is used as a standard way to determine if a particular
934 ** property is a live property. Its use is not part of the mandated liveprop
935 ** interface, but can be used by liveprop providers in conjunction with the
936 ** utility routines below.
937 **
938 ** spec->name == NULL is the defined end-sentinel for a list of specs.
939 */
940 typedef struct {
941  int ns; /* provider-local namespace index */
942  const char *name; /* name of the property */
943 
944  int propid; /* provider-local property ID */
945 
946  int is_writable; /* is the property writable? */
947 
949 
950 /*
951 ** dav_liveprop_group: specify a group of liveprops
952 **
953 ** This structure specifies a group of live properties, their namespaces,
954 ** and how to handle them.
955 */
956 typedef struct {
958  const char * const *namespace_uris;
960 
962 
963 /* ### docco */
964 DAV_DECLARE(int) dav_do_find_liveprop(const char *ns_uri, const char *name,
965  const dav_liveprop_group *group,
966  const dav_hooks_liveprop **hooks);
967 
968 /* ### docco */
969 DAV_DECLARE(long) dav_get_liveprop_info(int propid,
970  const dav_liveprop_group *group,
971  const dav_liveprop_spec **info);
972 
973 /* ### docco */
974 DAV_DECLARE(void) dav_register_liveprop_group(apr_pool_t *pool,
975  const dav_liveprop_group *group);
976 
977 /* ### docco */
978 DAV_DECLARE(long) dav_get_liveprop_ns_index(const char *uri);
979 
980 /* ### docco */
981 DAV_DECLARE(long) dav_get_liveprop_ns_count(void);
982 
983 /* ### docco */
984 DAV_DECLARE(void) dav_add_all_liveprop_xmlns(apr_pool_t *p,
986 
987 /*
988 ** The following three functions are part of mod_dav's internal handling
989 ** for the core WebDAV properties. They are not part of mod_dav's API.
990 */
991 DAV_DECLARE_NONSTD(int) dav_core_find_liveprop(
992  const dav_resource *resource,
993  const char *ns_uri,
994  const char *name,
995  const dav_hooks_liveprop **hooks);
996 DAV_DECLARE_NONSTD(void) dav_core_insert_all_liveprops(
997  request_rec *r,
998  const dav_resource *resource,
1000  apr_text_header *phdr);
1001 DAV_DECLARE_NONSTD(void) dav_core_register_uris(apr_pool_t *p);
1002 
1003 
1004 /*
1005 ** Standard WebDAV Property Identifiers
1006 **
1007 ** A live property provider does not need to use these; they are simply
1008 ** provided for convenience.
1009 **
1010 ** Property identifiers need to be unique within a given provider, but not
1011 ** *across* providers (note: this uniqueness constraint was different in
1012 ** older versions of mod_dav).
1013 **
1014 ** The identifiers start at 20000 to make it easier for providers to avoid
1015 ** conflicts with the standard properties. The properties are arranged
1016 ** alphabetically, and may be reordered from time to time (as properties
1017 ** are introduced).
1018 **
1019 ** NOTE: there is no problem with reordering (e.g. binary compat) since the
1020 ** identifiers are only used within a given provider, which would pick up
1021 ** the entire set of changes upon a recompile.
1022 */
1023 enum {
1025 
1026  /* Standard WebDAV properties (RFC 2518) */
1038 
1039  /* DeltaV properties (from the I-D (#14)) */
1078 
1080 };
1081 
1082 /*
1083 ** Property Identifier Registration
1084 **
1085 ** At the moment, mod_dav requires live property providers to ensure that
1086 ** each property returned has a unique value. For now, this is done through
1087 ** central registration (there are no known providers other than the default,
1088 ** so this remains manageable).
1089 **
1090 ** WARNING: the TEST ranges should never be "shipped".
1091 */
1092 #define DAV_PROPID_CORE 10000 /* ..10099. defined by mod_dav */
1093 #define DAV_PROPID_FS 10100 /* ..10299.
1094  mod_dav filesystem provider. */
1095 #define DAV_PROPID_TEST1 10300 /* ..10399 */
1096 #define DAV_PROPID_TEST2 10400 /* ..10499 */
1097 #define DAV_PROPID_TEST3 10500 /* ..10599 */
1098 /* Next: 10600 */
1099 
1100 
1101 /* --------------------------------------------------------------------
1102 **
1103 ** DATABASE FUNCTIONS
1104 */
1105 
1106 typedef struct dav_db dav_db;
1109 
1110 typedef struct {
1111  const char *ns; /* "" signals "no namespace" */
1112  const char *name;
1113 } dav_prop_name;
1114 
1115 /* hook functions to enable pluggable databases */
1117 {
1118  dav_error * (*open)(apr_pool_t *p, const dav_resource *resource, int ro,
1119  dav_db **pdb);
1120  void (*close)(dav_db *db);
1121 
1122  /*
1123  ** In bulk, define any namespaces that the values and their name
1124  ** elements may need.
1125  **
1126  ** Note: sometimes mod_dav will defer calling this until output_value
1127  ** returns found==1. If the output process needs the dav_xmlns_info
1128  ** filled for its work, then it will need to fill it on demand rather
1129  ** than depending upon this hook to fill in the structure.
1130  **
1131  ** Note: this will *always* be called during an output sequence. Thus,
1132  ** the provider may rely solely on using this to fill the xmlns info.
1133  */
1134  dav_error * (*define_namespaces)(dav_db *db, dav_xmlns_info *xi);
1135 
1136  /*
1137  ** Output the value from the database (i.e. add an element name and
1138  ** the value into *phdr). Set *found based on whether the name/value
1139  ** was found in the propdb.
1140  **
1141  ** Note: it is NOT an error for the key/value pair to not exist.
1142  **
1143  ** The dav_xmlns_info passed to define_namespaces() is also passed to
1144  ** each output_value() call so that namespaces can be added on-demand.
1145  ** It can also be used to look up prefixes or URIs during the output
1146  ** process.
1147  */
1148  dav_error * (*output_value)(dav_db *db, const dav_prop_name *name,
1149  dav_xmlns_info *xi,
1150  apr_text_header *phdr, int *found);
1151 
1152  /*
1153  ** Build a mapping from "global" namespaces (stored in apr_xml_*)
1154  ** into provider-local namespace identifiers.
1155  **
1156  ** This mapping should be done once per set of namespaces, and the
1157  ** resulting mapping should be passed into the store() hook function.
1158  **
1159  ** Note: usually, there is just a single document/namespaces for all
1160  ** elements passed. However, the generality of creating multiple
1161  ** mappings and passing them to store() is provided here.
1162  **
1163  ** Note: this is only in preparation for a series of store() calls.
1164  ** As a result, the propdb must be open for read/write access when
1165  ** this function is called.
1166  */
1167  dav_error * (*map_namespaces)(dav_db *db,
1169  dav_namespace_map **mapping);
1170 
1171  /*
1172  ** Store a property value for a given name. The value->combined field
1173  ** MUST be set for this call.
1174  **
1175  ** ### WARNING: current providers will quote the text within ELEM.
1176  ** ### this implies you can call this function only once with a given
1177  ** ### element structure (a second time will quote it again).
1178  */
1179  dav_error * (*store)(dav_db *db, const dav_prop_name *name,
1180  const apr_xml_elem *elem,
1181  dav_namespace_map *mapping);
1182 
1183  /* remove a given property */
1184  dav_error * (*remove)(dav_db *db, const dav_prop_name *name);
1185 
1186  /* returns 1 if the record specified by "key" exists; 0 otherwise */
1188 
1189  /*
1190  ** Iterate over the property names in the database.
1191  **
1192  ** iter->name.ns == iter->name.name == NULL when there are no more names.
1193  **
1194  ** Note: only one iteration may occur over the propdb at a time.
1195  */
1196  dav_error * (*first_name)(dav_db *db, dav_prop_name *pname);
1197  dav_error * (*next_name)(dav_db *db, dav_prop_name *pname);
1198 
1199  /*
1200  ** Rollback support: get rollback context, and apply it.
1201  **
1202  ** struct dav_deadprop_rollback is a provider-private structure; it
1203  ** should remember the name, and the name's old value (or the fact that
1204  ** the value was not present, and should be deleted if a rollback occurs).
1205  */
1206  dav_error * (*get_rollback)(dav_db *db, const dav_prop_name *name,
1207  dav_deadprop_rollback **prollback);
1208  dav_error * (*apply_rollback)(dav_db *db,
1209  dav_deadprop_rollback *rollback);
1210 
1211  /*
1212  ** If a provider needs a context to associate with this hooks structure,
1213  ** then this field may be used. In most cases, it will just be NULL.
1214  */
1215  void *ctx;
1216 };
1217 
1218 
1219 /* --------------------------------------------------------------------
1220 **
1221 ** LOCK FUNCTIONS
1222 */
1223 
1224 /* Used to represent a Timeout header of "Infinity" */
1225 #define DAV_TIMEOUT_INFINITE 0
1226 
1227 DAV_DECLARE(time_t) dav_get_timeout(request_rec *r);
1228 
1229 /*
1230 ** Opaque, provider-specific information for a lock database.
1231 */
1233 
1234 /*
1235 ** Opaque, provider-specific information for a lock record.
1236 */
1238 
1239 /*
1240 ** Lock database type. Lock providers are urged to implement a "lazy" open, so
1241 ** doing an "open" is cheap until something is actually needed from the DB.
1242 */
1243 typedef struct
1244 {
1245  const dav_hooks_locks *hooks; /* the hooks used for this lockdb */
1246  int ro; /* was it opened readonly? */
1247 
1248  dav_lockdb_private *info;
1249 
1250 } dav_lockdb;
1251 
1252 typedef enum {
1256 } dav_lock_scope;
1257 
1258 typedef enum {
1261 } dav_lock_type;
1262 
1263 typedef enum {
1264  DAV_LOCKREC_DIRECT, /* lock asserted on this resource */
1265  DAV_LOCKREC_INDIRECT, /* lock inherited from a parent */
1266  DAV_LOCKREC_INDIRECT_PARTIAL /* most info is not filled in */
1268 
1269 /*
1270 ** dav_lock: hold information about a lock on a resource.
1271 **
1272 ** This structure is used for both direct and indirect locks. A direct lock
1273 ** is a lock applied to a specific resource by the client. An indirect lock
1274 ** is one that is inherited from a parent resource by virtue of a non-zero
1275 ** Depth: header when the lock was applied.
1276 **
1277 ** mod_dav records both types of locks in the lock database, managing their
1278 ** addition/removal as resources are moved about the namespace.
1279 **
1280 ** Note that the lockdb is free to marshal this structure in any form that
1281 ** it likes.
1282 **
1283 ** For a "partial" lock, the <rectype> and <locktoken> fields must be filled
1284 ** in. All other (user) fields should be zeroed. The lock provider will
1285 ** usually fill in the <info> field, and the <next> field may be used to
1286 ** construct a list of partial locks.
1287 **
1288 ** The lock provider MUST use the info field to store a value such that a
1289 ** dav_lock structure can locate itself in the underlying lock database.
1290 ** This requirement is needed for refreshing: when an indirect dav_lock is
1291 ** refreshed, its reference to the direct lock does not specify the direct's
1292 ** resource, so the only way to locate the (refreshed, direct) lock in the
1293 ** database is to use the info field.
1294 **
1295 ** Note that <is_locknull> only refers to the resource where this lock was
1296 ** found.
1297 ** ### hrm. that says the abstraction is wrong. is_locknull may disappear.
1298 */
1299 typedef struct dav_lock
1300 {
1301  dav_lock_rectype rectype; /* type of lock record */
1302  int is_locknull; /* lock establishes a locknull resource */
1303 
1304  /* ### put the resource in here? */
1305 
1306  dav_lock_scope scope; /* scope of the lock */
1307  dav_lock_type type; /* type of lock */
1308  int depth; /* depth of the lock */
1309  time_t timeout; /* when the lock will timeout */
1310 
1311  const dav_locktoken *locktoken; /* the token that was issued */
1312 
1313  const char *owner; /* (XML) owner of the lock */
1314  const char *auth_user; /* auth'd username owning lock */
1315 
1316  dav_lock_private *info; /* private to the lockdb */
1317 
1318  struct dav_lock *next; /* for managing a list of locks */
1319 } dav_lock;
1320 
1321 /* Property-related public lock functions */
1322 DAV_DECLARE(const char *)dav_lock_get_activelock(request_rec *r,
1324  dav_buffer *pbuf);
1325 
1326 /* LockDB-related public lock functions */
1327 DAV_DECLARE(dav_error *) dav_lock_parse_lockinfo(request_rec *r,
1329  dav_lockdb *lockdb,
1330  const apr_xml_doc *doc,
1332 DAV_DECLARE(int) dav_unlock(request_rec *r,
1334  const dav_locktoken *locktoken);
1335 DAV_DECLARE(dav_error *) dav_add_lock(request_rec *r,
1336  const dav_resource *resource,
1337  dav_lockdb *lockdb, dav_lock *request,
1338  dav_response **response);
1339 DAV_DECLARE(dav_error *) dav_notify_created(request_rec *r,
1340  dav_lockdb *lockdb,
1341  const dav_resource *resource,
1342  int resource_state,
1343  int depth);
1344 
1345 DAV_DECLARE(dav_error*) dav_lock_query(dav_lockdb *lockdb,
1346  const dav_resource *resource,
1347  dav_lock **locks);
1348 
1349 DAV_DECLARE(dav_error *) dav_validate_request(request_rec *r,
1350  dav_resource *resource,
1351  int depth,
1352  dav_locktoken *locktoken,
1353  dav_response **response,
1354  int flags,
1355  dav_lockdb *lockdb);
1356 /*
1357 ** flags:
1358 ** 0x0F -- reserved for <dav_lock_scope> values
1359 **
1360 ** other flags, detailed below
1361 */
1362 #define DAV_VALIDATE_RESOURCE 0x0010 /* validate just the resource */
1363 #define DAV_VALIDATE_PARENT 0x0020 /* validate resource AND its parent */
1364 #define DAV_VALIDATE_ADD_LD 0x0040 /* add DAV:lockdiscovery into
1365  the 424 DAV:response */
1366 #define DAV_VALIDATE_USE_424 0x0080 /* return 424 status, not 207 */
1367 #define DAV_VALIDATE_IS_PARENT 0x0100 /* for internal use */
1368 #define DAV_VALIDATE_NO_MODIFY 0x0200 /* resource is not being modified
1369  so allow even if lock token
1370  is not provided */
1371 
1372 /* Lock-null related public lock functions */
1373 DAV_DECLARE(int) dav_get_resource_state(request_rec *r,
1374  const dav_resource *resource);
1375 
1376 /* Lock provider hooks. Locking is optional, so there may be no
1377  * lock provider for a given repository.
1378  */
1380 {
1381  /* Return the supportedlock property for a resource */
1382  const char * (*get_supportedlock)(
1383  const dav_resource *resource
1384  );
1385 
1386  /* Parse a lock token URI, returning a lock token object allocated
1387  * in the given pool.
1388  */
1389  dav_error * (*parse_locktoken)(
1390  apr_pool_t *p,
1391  const char *char_token,
1392  dav_locktoken **locktoken_p
1393  );
1394 
1395  /* Format a lock token object into a URI string, allocated in
1396  * the given pool.
1397  *
1398  * Always returns non-NULL.
1399  */
1400  const char * (*format_locktoken)(
1401  apr_pool_t *p,
1402  const dav_locktoken *locktoken
1403  );
1404 
1405  /* Compare two lock tokens.
1406  *
1407  * Result < 0 => lt1 < lt2
1408  * Result == 0 => lt1 == lt2
1409  * Result > 0 => lt1 > lt2
1410  */
1411  int (*compare_locktoken)(
1412  const dav_locktoken *lt1,
1413  const dav_locktoken *lt2
1414  );
1415 
1416  /* Open the provider's lock database.
1417  *
1418  * The provider may or may not use a "real" database for locks
1419  * (a lock could be an attribute on a resource, for example).
1420  *
1421  * The provider may choose to use the value of the DAVLockDB directive
1422  * (as returned by dav_get_lockdb_path()) to decide where to place
1423  * any storage it may need.
1424  *
1425  * The request storage pool should be associated with the lockdb,
1426  * so it can be used in subsequent operations.
1427  *
1428  * If ro != 0, only readonly operations will be performed.
1429  * If force == 0, the open can be "lazy"; no subsequent locking operations
1430  * may occur.
1431  * If force != 0, locking operations will definitely occur.
1432  */
1433  dav_error * (*open_lockdb)(
1434  request_rec *r,
1435  int ro,
1436  int force,
1437  dav_lockdb **lockdb
1438  );
1439 
1440  /* Indicates completion of locking operations */
1441  void (*close_lockdb)(
1443  );
1444 
1445  /* Take a resource out of the lock-null state. */
1446  dav_error * (*remove_locknull_state)(
1447  dav_lockdb *lockdb,
1448  const dav_resource *resource
1449  );
1450 
1451  /*
1452  ** Create a (direct) lock structure for the given resource. A locktoken
1453  ** will be created.
1454  **
1455  ** The lock provider may store private information into lock->info.
1456  */
1457  dav_error * (*create_lock)(dav_lockdb *lockdb,
1458  const dav_resource *resource,
1459  dav_lock **lock);
1460 
1461  /*
1462  ** Get the locks associated with the specified resource.
1463  **
1464  ** If resolve_locks is true (non-zero), then any indirect locks are
1465  ** resolved to their actual, direct lock (i.e. the reference to followed
1466  ** to the original lock).
1467  **
1468  ** The locks, if any, are returned as a linked list in no particular
1469  ** order. If no locks are present, then *locks will be NULL.
1470  */
1471  dav_error * (*get_locks)(dav_lockdb *lockdb,
1472  const dav_resource *resource,
1473  int calltype,
1474  dav_lock **locks);
1475 
1476 #define DAV_GETLOCKS_RESOLVED 0 /* resolve indirects to directs */
1477 #define DAV_GETLOCKS_PARTIAL 1 /* leave indirects partially filled */
1478 #define DAV_GETLOCKS_COMPLETE 2 /* fill out indirect locks */
1479 
1480  /*
1481  ** Find a particular lock on a resource (specified by its locktoken).
1482  **
1483  ** *lock will be set to NULL if the lock is not found.
1484  **
1485  ** Note that the provider can optimize the unmarshalling -- only one
1486  ** lock (or none) must be constructed and returned.
1487  **
1488  ** If partial_ok is true (non-zero), then an indirect lock can be
1489  ** partially filled in. Otherwise, another lookup is done and the
1490  ** lock structure will be filled out as a DAV_LOCKREC_INDIRECT.
1491  */
1492  dav_error * (*find_lock)(dav_lockdb *lockdb,
1493  const dav_resource *resource,
1494  const dav_locktoken *locktoken,
1495  int partial_ok,
1496  dav_lock **lock);
1497 
1498  /*
1499  ** Quick test to see if the resource has *any* locks on it.
1500  **
1501  ** This is typically used to determine if a non-existent resource
1502  ** has a lock and is (therefore) a locknull resource.
1503  **
1504  ** WARNING: this function may return TRUE even when timed-out locks
1505  ** exist (i.e. it may not perform timeout checks).
1506  */
1507  dav_error * (*has_locks)(dav_lockdb *lockdb,
1508  const dav_resource *resource,
1509  int *locks_present);
1510 
1511  /*
1512  ** Append the specified lock(s) to the set of locks on this resource.
1513  **
1514  ** If "make_indirect" is true (non-zero), then the specified lock(s)
1515  ** should be converted to an indirect lock (if it is a direct lock)
1516  ** before appending. Note that the conversion to an indirect lock does
1517  ** not alter the passed-in lock -- the change is internal the
1518  ** append_locks function.
1519  **
1520  ** Multiple locks are specified using the lock->next links.
1521  */
1522  dav_error * (*append_locks)(dav_lockdb *lockdb,
1523  const dav_resource *resource,
1524  int make_indirect,
1525  const dav_lock *lock);
1526 
1527  /*
1528  ** Remove any lock that has the specified locktoken.
1529  **
1530  ** If locktoken == NULL, then ALL locks are removed.
1531  */
1532  dav_error * (*remove_lock)(dav_lockdb *lockdb,
1533  const dav_resource *resource,
1534  const dav_locktoken *locktoken);
1535 
1536  /*
1537  ** Refresh all locks, found on the specified resource, which has a
1538  ** locktoken in the provided list.
1539  **
1540  ** If the lock is indirect, then the direct lock is referenced and
1541  ** refreshed.
1542  **
1543  ** Each lock that is updated is returned in the <locks> argument.
1544  ** Note that the locks will be fully resolved.
1545  */
1546  dav_error * (*refresh_locks)(dav_lockdb *lockdb,
1547  const dav_resource *resource,
1548  const dav_locktoken_list *ltl,
1549  time_t new_time,
1550  dav_lock **locks);
1551 
1552  /*
1553  ** Look up the resource associated with a particular locktoken.
1554  **
1555  ** The search begins at the specified <start_resource> and the lock
1556  ** specified by <locktoken>.
1557  **
1558  ** If the resource/token specifies an indirect lock, then the direct
1559  ** lock will be looked up, and THAT resource will be returned. In other
1560  ** words, this function always returns the resource where a particular
1561  ** lock (token) was asserted.
1562  **
1563  ** NOTE: this function pointer is allowed to be NULL, indicating that
1564  ** the provider does not support this type of functionality. The
1565  ** caller should then traverse up the repository hierarchy looking
1566  ** for the resource defining a lock with this locktoken.
1567  */
1568  dav_error * (*lookup_resource)(dav_lockdb *lockdb,
1569  const dav_locktoken *locktoken,
1570  const dav_resource *start_resource,
1571  const dav_resource **resource);
1572 
1573  /*
1574  ** If a provider needs a context to associate with this hooks structure,
1575  ** then this field may be used. In most cases, it will just be NULL.
1576  */
1577  void *ctx;
1578 };
1579 
1580 /* what types of resources can be discovered by dav_get_resource_state() */
1581 #define DAV_RESOURCE_LOCK_NULL 10 /* resource lock-null */
1582 #define DAV_RESOURCE_NULL 11 /* resource null */
1583 #define DAV_RESOURCE_EXISTS 12 /* resource exists */
1584 #define DAV_RESOURCE_ERROR 13 /* an error occurred */
1585 
1586 
1587 /* --------------------------------------------------------------------
1588 **
1589 ** PROPERTY HANDLING
1590 */
1591 
1592 typedef struct dav_propdb dav_propdb;
1593 
1594 
1595 DAV_DECLARE(dav_error *) dav_open_propdb(
1596  request_rec *r,
1597  dav_lockdb *lockdb,
1598  const dav_resource *resource,
1599  int ro,
1601  dav_propdb **propdb);
1602 
1603 DAV_DECLARE(void) dav_close_propdb(dav_propdb *db);
1604 
1605 DAV_DECLARE(dav_get_props_result) dav_get_props(
1606  dav_propdb *db,
1607  apr_xml_doc *doc);
1608 
1609 DAV_DECLARE(dav_get_props_result) dav_get_allprops(
1610  dav_propdb *db,
1612 
1613 DAV_DECLARE(void) dav_get_liveprop_supported(
1614  dav_propdb *propdb,
1615  const char *ns_uri,
1616  const char *propname,
1618 
1619 /*
1620 ** 3-phase property modification.
1621 **
1622 ** 1) validate props. readable? unlocked? ACLs allow access?
1623 ** 2) execute operation (set/delete)
1624 ** 3) commit or rollback
1625 **
1626 ** ### eventually, auth must be available. a ref to the request_rec (which
1627 ** ### contains the auth info) should be in the shared context struct.
1628 **
1629 ** Each function may alter the error values and information contained within
1630 ** the context record. This should be done as an "increasing" level of
1631 ** error, rather than overwriting any previous error.
1632 **
1633 ** Note that commit() cannot generate errors. It should simply free the
1634 ** rollback information.
1635 **
1636 ** rollback() may generate additional errors because the rollback operation
1637 ** can sometimes fail(!).
1638 **
1639 ** The caller should allocate an array of these, one per operation. It should
1640 ** be zero-initialized, then the db, operation, and prop fields should be
1641 ** filled in before calling dav_prop_validate. Note that the set/delete
1642 ** operations are order-dependent. For a given (logical) context, the same
1643 ** pointer must be passed to each phase.
1644 **
1645 ** error_type is an internal value, but will have the same numeric value
1646 ** for each possible "desc" value. This allows the caller to group the
1647 ** descriptions via the error_type variable, rather than through string
1648 ** comparisons. Note that "status" does not provide enough granularity to
1649 ** differentiate/group the "desc" values.
1650 **
1651 ** Note that the propdb will maintain some (global) context across all
1652 ** of the property change contexts. This implies that you can have only
1653 ** one open transaction per propdb.
1654 */
1655 typedef struct dav_prop_ctx
1656 {
1658 
1659  apr_xml_elem *prop; /* property to affect */
1660 
1662 #define DAV_PROP_OP_SET 1 /* set a property value */
1663 #define DAV_PROP_OP_DELETE 2 /* delete a prop value */
1664 /* ### add a GET? */
1665 
1666  /* private items to the propdb */
1669  struct dav_rollback_item *rollback; /* optional rollback info */
1670 
1671  dav_error *err; /* error (if any) */
1672 
1673  /* private to mod_dav.c */
1675 
1676 } dav_prop_ctx;
1677 
1678 DAV_DECLARE_NONSTD(void) dav_prop_validate(dav_prop_ctx *ctx);
1679 DAV_DECLARE_NONSTD(void) dav_prop_exec(dav_prop_ctx *ctx);
1680 DAV_DECLARE_NONSTD(void) dav_prop_commit(dav_prop_ctx *ctx);
1681 DAV_DECLARE_NONSTD(void) dav_prop_rollback(dav_prop_ctx *ctx);
1682 
1683 #define DAV_PROP_CTX_HAS_ERR(dpc) ((dpc).err && (dpc).err->status >= 300)
1684 
1685 
1686 /* --------------------------------------------------------------------
1687 **
1688 ** WALKER STRUCTURE
1689 */
1690 
1691 enum {
1692  DAV_CALLTYPE_MEMBER = 1, /* called for a member resource */
1693  DAV_CALLTYPE_COLLECTION, /* called for a collection */
1694  DAV_CALLTYPE_LOCKNULL /* called for a locknull resource */
1695 };
1696 
1697 typedef struct
1698 {
1699  /* the client-provided context */
1700  void *walk_ctx;
1701 
1702  /* pool to use for allocations in the callback */
1704 
1705  /* the current resource */
1707 
1708  /* OUTPUT: add responses to this */
1709  dav_response *response;
1710 
1712 
1713 typedef struct
1714 {
1716 #define DAV_WALKTYPE_AUTH 0x0001 /* limit to authorized files */
1717 #define DAV_WALKTYPE_NORMAL 0x0002 /* walk normal files */
1718 #define DAV_WALKTYPE_LOCKNULL 0x0004 /* walk locknull resources */
1719 
1720  /* callback function and a client context for the walk */
1721  dav_error * (*func)(dav_walk_resource *wres, int calltype);
1722  void *walk_ctx;
1723 
1724  /* what pool to use for allocations needed by walk logic */
1726 
1727  /* beginning root of the walk */
1729 
1730  /* lock database to enable walking LOCKNULL resources */
1732 
1733 } dav_walk_params;
1734 
1735 /* directory tree walking context */
1736 typedef struct dav_walker_ctx
1737 {
1738  /* input: */
1740 
1741 
1742  /* ### client data... phasing out this big glom */
1743 
1744  /* this brigade buffers data being sent to r->output_filters */
1746 
1747  /* a scratch pool, used to stream responses and iteratively cleared. */
1749 
1750  request_rec *r; /* original request */
1751 
1752  /* for PROPFIND operations */
1755 #define DAV_PROPFIND_IS_ALLPROP 1
1756 #define DAV_PROPFIND_IS_PROPNAME 2
1757 #define DAV_PROPFIND_IS_PROP 3
1758 
1759  apr_text *propstat_404; /* (cached) propstat giving a 404 error */
1760 
1761  const dav_if_header *if_header; /* for validation */
1762  const dav_locktoken *locktoken; /* for UNLOCK */
1763  const dav_lock *lock; /* for LOCK */
1764  int skip_root; /* for dav_inherit_locks() */
1765 
1766  int flags;
1767 
1768  dav_buffer work_buf; /* for dav_validate_request() */
1769 
1770 } dav_walker_ctx;
1771 
1772 DAV_DECLARE(void) dav_add_response(dav_walk_resource *wres,
1773  int status,
1775 
1776 
1777 /* --------------------------------------------------------------------
1778 **
1779 ** "STREAM" STRUCTURE
1780 **
1781 ** mod_dav uses this abstraction for interacting with the repository
1782 ** while fetching/storing resources. mod_dav views resources as a stream
1783 ** of bytes.
1784 **
1785 ** Note that the structure is opaque -- it is private to the repository
1786 ** that created the stream in the repository's "open" function.
1787 **
1788 ** ### THIS STUFF IS GOING AWAY ... GET/read requests are handled by
1789 ** ### having the provider jam stuff straight into the filter stack.
1790 ** ### this is only left for handling PUT/write requests.
1791 */
1792 
1793 typedef struct dav_stream dav_stream;
1794 
1795 typedef enum {
1796  DAV_MODE_WRITE_TRUNC, /* truncate and open for writing */
1797  DAV_MODE_WRITE_SEEKABLE /* open for writing; random access */
1798 } dav_stream_mode;
1799 
1800 
1801 /* --------------------------------------------------------------------
1802 **
1803 ** REPOSITORY FUNCTIONS
1804 */
1805 
1806 /* Repository provider hooks */
1808 {
1809  /* Flag for whether repository requires special GET handling.
1810  * If resources in the repository are not visible in the
1811  * filesystem location which URLs map to, then special handling
1812  * is required to first fetch a resource from the repository,
1813  * respond to the GET request, then free the resource copy.
1814  */
1816 
1817  /* Get a resource descriptor for the URI in a request. A descriptor
1818  * should always be returned even if the resource does not exist. This
1819  * repository has been identified as handling the resource given by
1820  * the URI, so an answer must be given. If there is a problem with the
1821  * URI or accessing the resource or whatever, then an error should be
1822  * returned.
1823  *
1824  * root_dir:
1825  * the root of the directory for which this repository is configured.
1826  *
1827  * label:
1828  * if a Label: header is present (and allowed), this is the label
1829  * to use to identify a version resource from the resource's
1830  * corresponding version history. Otherwise, it will be NULL.
1831  *
1832  * use_checked_in:
1833  * use the DAV:checked-in property of the resource identified by the
1834  * Request-URI to identify and return a version resource
1835  *
1836  * The provider may associate the request storage pool with the resource
1837  * (in the resource->pool field), to use in other operations on that
1838  * resource.
1839  */
1840  dav_error * (*get_resource)(
1841  request_rec *r,
1842  const char *root_dir,
1843  const char *label,
1844  int use_checked_in,
1846  );
1847 
1848  /* Get a resource descriptor for the parent of the given resource.
1849  * The resources need not exist. NULL is returned if the resource
1850  * is the root collection.
1851  *
1852  * An error should be returned only if there is a fatal error in
1853  * fetching information about the parent resource.
1854  */
1855  dav_error * (*get_parent_resource)(
1856  const dav_resource *resource,
1857  dav_resource **parent_resource
1858  );
1859 
1860  /* Determine whether two resource descriptors refer to the same resource.
1861  *
1862  * Result != 0 => the resources are the same.
1863  */
1865  const dav_resource *res1,
1866  const dav_resource *res2
1867  );
1868 
1869  /* Determine whether one resource is a parent (immediate or otherwise)
1870  * of another.
1871  *
1872  * Result != 0 => res1 is a parent of res2.
1873  */
1875  const dav_resource *res1,
1876  const dav_resource *res2
1877  );
1878 
1879  /*
1880  ** Open a stream for this resource, using the specified mode. The
1881  ** stream will be returned in *stream.
1882  */
1883  dav_error * (*open_stream)(const dav_resource *resource,
1884  dav_stream_mode mode,
1885  dav_stream **stream);
1886 
1887  /*
1888  ** Close the specified stream.
1889  **
1890  ** mod_dav will (ideally) make sure to call this. For safety purposes,
1891  ** a provider should (ideally) register a cleanup function with the
1892  ** request pool to get this closed and cleaned up.
1893  **
1894  ** Note the possibility of an error from the close -- it is entirely
1895  ** feasible that the close does a "commit" of some kind, which can
1896  ** produce an error.
1897  **
1898  ** commit should be TRUE (non-zero) or FALSE (0) if the stream was
1899  ** opened for writing. This flag states whether to retain the file
1900  ** or not.
1901  ** Note: the commit flag is ignored for streams opened for reading.
1902  */
1903  dav_error * (*close_stream)(dav_stream *stream, int commit);
1904 
1905  /*
1906  ** Write data to the stream.
1907  **
1908  ** All of the bytes must be written, or an error should be returned.
1909  */
1910  dav_error * (*write_stream)(dav_stream *stream,
1911  const void *buf, apr_size_t bufsize);
1912 
1913  /*
1914  ** Seek to an absolute position in the stream. This is used to support
1915  ** Content-Range in a GET/PUT.
1916  **
1917  ** NOTE: if this function is NULL (which is allowed), then any
1918  ** operations using Content-Range will be refused.
1919  */
1920  dav_error * (*seek_stream)(dav_stream *stream, apr_off_t abs_position);
1921 
1922  /*
1923  ** If a GET is processed using a stream (open_stream, read_stream)
1924  ** rather than via a sub-request (on get_pathname), then this function
1925  ** is used to provide the repository with a way to set the headers
1926  ** in the response.
1927  **
1928  ** This function may be called without a following deliver(), to
1929  ** handle a HEAD request.
1930  **
1931  ** This may be NULL if handle_get is FALSE.
1932  */
1933  dav_error * (*set_headers)(request_rec *r,
1934  const dav_resource *resource);
1935 
1936  /*
1937  ** The provider should deliver the resource into the request's output
1938  ** filter stack. Basically, this is the response to the GET method.
1939  **
1940  ** Note that this is called for all resources, including collections.
1941  ** The provider should determine what has content to deliver or not.
1942  **
1943  ** set_headers will be called prior to this function, allowing the
1944  ** provider to set the appropriate response headers.
1945  **
1946  ** This may be NULL if handle_get is FALSE.
1947  ** ### maybe toss handle_get and just use this function as the marker
1948  **
1949  ** API ISSUE: don't use the passed-in 'output' filter.
1950  **
1951  ** Instead, generate the response into the output filter stack for the
1952  ** request (r->output_filters). An implementation can use the request_rec
1953  ** that was passed to get_resource() for this purpose. Using 'output'
1954  ** filter for the response can cause unbounded memory usage.
1955  **
1956  ** See https://mail-archives.apache.org/mod_mbox/httpd-dev/201608.mbox/%3C20160822151917.GA22369%40redhat.com%3E
1957  */
1958  dav_error * (*deliver)(const dav_resource *resource,
1959  ap_filter_t *output);
1960 
1961  /* Create a collection resource. The resource must not already exist.
1962  *
1963  * Result == NULL if the collection was created successfully. Also, the
1964  * resource object is updated to reflect that the resource exists, and
1965  * is a collection.
1966  */
1967  dav_error * (*create_collection)(
1969  );
1970 
1971  /* Copy one resource to another. The destination may exist, if it is
1972  * versioned.
1973  * Handles both files and collections. Properties are copied as well.
1974  * If the destination exists and is versioned, the provider must update
1975  * the destination to have identical content to the source,
1976  * recursively for collections.
1977  * The depth argument is ignored for a file, and can be either 0 or
1978  * DAV_INFINITY for a collection.
1979  * If an error occurs in a child resource, then the return value is
1980  * non-NULL, and *response is set to a multistatus response.
1981  * If the copy is successful, the dst resource object is
1982  * updated to reflect that the resource exists.
1983  */
1984  dav_error * (*copy_resource)(
1985  const dav_resource *src,
1986  dav_resource *dst,
1987  int depth,
1988  dav_response **response
1989  );
1990 
1991  /* Move one resource to another. The destination must not exist.
1992  * Handles both files and collections. Properties are moved as well.
1993  * If an error occurs in a child resource, then the return value is
1994  * non-NULL, and *response is set to a multistatus response.
1995  * If the move is successful, the src and dst resource objects are
1996  * updated to reflect that the source no longer exists, and the
1997  * destination does.
1998  */
1999  dav_error * (*move_resource)(
2000  dav_resource *src,
2001  dav_resource *dst,
2002  dav_response **response
2003  );
2004 
2005  /* Remove a resource. Handles both files and collections.
2006  * Removes any associated properties as well.
2007  * If an error occurs in a child resource, then the return value is
2008  * non-NULL, and *response is set to a multistatus response.
2009  * If the delete is successful, the resource object is updated to
2010  * reflect that the resource no longer exists.
2011  */
2012  dav_error * (*remove_resource)(
2014  dav_response **response
2015  );
2016 
2017  /* Walk a resource hierarchy.
2018  *
2019  * Iterates over the resource hierarchy specified by params->root.
2020  * Control of the walk and the callback are specified by 'params'.
2021  *
2022  * An error may be returned. *response will contain multistatus
2023  * responses (if any) suitable for the body of the error. It is also
2024  * possible to return NULL, yet still have multistatus responses.
2025  * In this case, typically the caller should return a 207 (Multistatus)
2026  * and the responses (in the body) as the HTTP response.
2027  */
2028  dav_error * (*walk)(const dav_walk_params *params, int depth,
2029  dav_response **response);
2030 
2031  /* Get the entity tag for a resource */
2032  const char * (*getetag)(const dav_resource *resource);
2033 
2034  /*
2035  ** If a provider needs a context to associate with this hooks structure,
2036  ** then this field may be used. In most cases, it will just be NULL.
2037  */
2038  void *ctx;
2039 
2040  /* Get the request rec for a resource */
2041  request_rec * (*get_request_rec)(const dav_resource *resource);
2042 
2043  /* Get the pathname for a resource */
2044  const char * (*get_pathname)(const dav_resource *resource);
2045 };
2046 
2047 
2048 /* --------------------------------------------------------------------
2049 **
2050 ** VERSIONING FUNCTIONS
2051 */
2052 
2053 
2054 /* dav_add_vary_header
2055  *
2056  * If there were any headers in the request which require a Vary header
2057  * in the response, add it.
2058  */
2059 DAV_DECLARE(void) dav_add_vary_header(request_rec *in_req,
2061  const dav_resource *resource);
2062 
2063 /*
2064 ** Flags specifying auto-versioning behavior, returned by
2065 ** the auto_versionable hook. The value returned depends
2066 ** on both the state of the resource and the value of the
2067 ** DAV:auto-versioning property for the resource.
2068 **
2069 ** If the resource does not exist (null or lock-null),
2070 ** DAV_AUTO_VERSION_ALWAYS causes creation of a new version-controlled resource
2071 **
2072 ** If the resource is checked in,
2073 ** DAV_AUTO_VERSION_ALWAYS causes it to be checked out always,
2074 ** DAV_AUTO_VERSION_LOCKED causes it to be checked out only when locked
2075 **
2076 ** If the resource is checked out,
2077 ** DAV_AUTO_VERSION_ALWAYS causes it to be checked in always,
2078 ** DAV_AUTO_VERSION_LOCKED causes it to be checked in when unlocked
2079 ** (note: a provider should allow auto-checkin only for resources which
2080 ** were automatically checked out)
2081 **
2082 ** In all cases, DAV_AUTO_VERSION_NEVER results in no auto-versioning behavior.
2083 */
2084 typedef enum {
2089 
2090 /*
2091 ** This structure is used to record what auto-versioning operations
2092 ** were done to make a resource writable, so that they can be undone
2093 ** at the end of a request.
2094 */
2095 typedef struct {
2096  int resource_versioned; /* 1 => resource was auto-version-controlled */
2097  int resource_checkedout; /* 1 => resource was auto-checked-out */
2098  int parent_checkedout; /* 1 => parent was auto-checked-out */
2099  dav_resource *parent_resource; /* parent resource, if it was needed */
2101 
2102 /* Ensure that a resource is writable. If there is no versioning
2103  * provider, then this is essentially a no-op. Versioning repositories
2104  * require explicit resource creation and checkout before they can
2105  * be written to. If a new resource is to be created, or an existing
2106  * resource deleted, the parent collection must be checked out as well.
2107  *
2108  * Set the parent_only flag to only make the parent collection writable.
2109  * Otherwise, both parent and child are made writable as needed. If the
2110  * child does not exist, then a new versioned resource is created and
2111  * checked out.
2112  *
2113  * If auto-versioning is not enabled for a versioned resource, then an error is
2114  * returned, since the resource cannot be modified.
2115  *
2116  * The dav_auto_version_info structure is filled in with enough information
2117  * to restore both parent and child resources to the state they were in
2118  * before the auto-versioning operations occurred.
2119  */
2120 DAV_DECLARE(dav_error *) dav_auto_checkout(
2121  request_rec *r,
2122  dav_resource *resource,
2123  int parent_only,
2125 
2126 /* Revert the writability of resources back to what they were
2127  * before they were modified. If undo == 0, then the resource
2128  * modifications are maintained (i.e. they are checked in).
2129  * If undo != 0, then resource modifications are discarded
2130  * (i.e. they are unchecked out).
2131  *
2132  * Set the unlock flag to indicate that the resource is about
2133  * to be unlocked; it will be checked in if the resource
2134  * auto-versioning property indicates it should be. In this case,
2135  * av_info is ignored, so it can be NULL.
2136  *
2137  * The resource argument may be NULL if only the parent resource
2138  * was checked out (i.e. the parent_only was != 0 in the
2139  * dav_auto_checkout call).
2140  */
2141 DAV_DECLARE(dav_error *) dav_auto_checkin(
2142  request_rec *r,
2143  dav_resource *resource,
2144  int undo,
2145  int unlock,
2146  dav_auto_version_info *av_info);
2147 
2148 /*
2149 ** This structure is used to describe available reports
2150 **
2151 ** "nmspace" should be valid XML and URL-quoted. mod_dav will place
2152 ** double-quotes around it and use it in an xmlns declaration.
2153 */
2154 typedef struct {
2155  const char *nmspace; /* namespace of the XML report element */
2156  const char *name; /* element name for the XML report */
2157 } dav_report_elem;
2158 
2159 
2160 /* Versioning provider hooks */
2162 {
2163  /*
2164  ** MANDATORY HOOKS
2165  ** The following hooks are mandatory for all versioning providers;
2166  ** they define the functionality needed to implement "core" versioning.
2167  */
2168 
2169  /* Return supported versioning options.
2170  * Each dav_text item in the list will be returned as a separate
2171  * DAV header. Providers are advised to limit the length of an
2172  * individual text item to 63 characters, to conform to the limit
2173  * used by MS Web Folders.
2174  */
2176 
2177  /* Get the value of a specific option for an OPTIONS request.
2178  * The option being requested is given by the parsed XML
2179  * element object "elem". The value of the option should be
2180  * appended to the "option" text object.
2181  */
2182  dav_error * (*get_option)(const dav_resource *resource,
2183  const apr_xml_elem *elem,
2184  apr_text_header *option);
2185 
2186  /* Determine whether a non-versioned (or non-existent) resource
2187  * is versionable. Returns != 0 if resource can be versioned.
2188  */
2190 
2191  /* Determine whether auto-versioning is enabled for a resource
2192  * (which may not exist, or may not be versioned). If the resource
2193  * is a checked-out resource, the provider must only enable
2194  * auto-checkin if the resource was automatically checked out.
2195  *
2196  * The value returned depends on both the state of the resource
2197  * and the value of its DAV:auto-version property. See the description
2198  * of the dav_auto_version enumeration above for the details.
2199  */
2201 
2202  /* Put a resource under version control. If the resource already
2203  * exists unversioned, then it becomes the initial version of the
2204  * new version history, and it is replaced by a version selector
2205  * which targets the new version.
2206  *
2207  * If the resource does not exist, then a new version-controlled
2208  * resource is created which either targets an existing version (if the
2209  * "target" argument is not NULL), or the initial, empty version
2210  * in a new history resource (if the "target" argument is NULL).
2211  *
2212  * If successful, the resource object state is updated appropriately
2213  * (that is, changed to refer to the new version-controlled resource).
2214  */
2215  dav_error * (*vsn_control)(dav_resource *resource,
2216  const char *target);
2217 
2218  /* Checkout a resource. If successful, the resource
2219  * object state is updated appropriately.
2220  *
2221  * The auto_checkout flag will be set if this checkout is being
2222  * done automatically, as part of some method which modifies
2223  * the resource. The provider must remember that the resource
2224  * was automatically checked out, so it can determine whether it
2225  * can be automatically checked in. (Auto-checkin should only be
2226  * enabled for resources which were automatically checked out.)
2227  *
2228  * If the working resource has a different URL from the
2229  * target resource, a dav_resource descriptor is returned
2230  * for the new working resource. Otherwise, the original
2231  * resource descriptor will refer to the working resource.
2232  * The working_resource argument can be NULL if the caller
2233  * is not interested in the working resource.
2234  *
2235  * If the client has specified DAV:unreserved or DAV:fork-ok in the
2236  * checkout request, then the corresponding flags are set. If
2237  * DAV:activity-set has been specified, then create_activity is set
2238  * if DAV:new was specified; otherwise, the DAV:href elements' CDATA
2239  * (the actual href text) is passed in the "activities" array (each
2240  * element of the array is a const char *). activities will be NULL
2241  * no DAV:activity-set was provided or when create_activity is set.
2242  */
2244  int auto_checkout,
2245  int is_unreserved, int is_fork_ok,
2246  int create_activity,
2247  apr_array_header_t *activities,
2248  dav_resource **working_resource);
2249 
2250  /* Uncheckout a checked-out resource. If successful, the resource
2251  * object state is updated appropriately.
2252  */
2253  dav_error * (*uncheckout)(dav_resource *resource);
2254 
2255  /* Checkin a checked-out resource. If successful, the resource
2256  * object state is updated appropriately, and the
2257  * version_resource descriptor will refer to the new version.
2258  * The version_resource argument can be NULL if the caller
2259  * is not interested in the new version resource.
2260  *
2261  * If the client has specified DAV:keep-checked-out in the checkin
2262  * request, then the keep_checked_out flag is set. The provider
2263  * should create a new version, but keep the resource in the
2264  * checked-out state.
2265  */
2267  int keep_checked_out,
2268  dav_resource **version_resource);
2269 
2270  /*
2271  ** Return the set of reports available at this resource.
2272  **
2273  ** An array of report elements should be returned, with an end-marker
2274  ** element containing namespace==NULL. The value of the
2275  ** DAV:supported-report-set property will be constructed and
2276  ** returned.
2277  */
2278  dav_error * (*avail_reports)(const dav_resource *resource,
2279  const dav_report_elem **reports);
2280 
2281  /*
2282  ** Determine whether a Label header can be used
2283  ** with a particular report. The dav_xml_doc structure
2284  ** contains the parsed report request body.
2285  ** Returns 0 if the Label header is not allowed.
2286  */
2288 
2289  /*
2290  ** Generate a report on a resource. Since a provider is free
2291  ** to define its own reports, and the value of request headers
2292  ** may affect the interpretation of a report, the request record
2293  ** must be passed to this routine.
2294  **
2295  ** The dav_xml_doc structure contains the parsed report request
2296  ** body. The report response should be generated into the specified
2297  ** output filter.
2298  **
2299  ** If an error occurs, and a response has not yet been generated,
2300  ** then an error can be returned from this function. mod_dav will
2301  ** construct an appropriate error response. Once some output has
2302  ** been placed into the filter, however, the provider should not
2303  ** return an error -- there is no way that mod_dav can deliver it
2304  ** properly.
2305  **
2306  ** ### maybe we need a way to signal an error anyways, and then
2307  ** ### apache can abort the connection?
2308  **
2309  ** API ISSUE: don't use the passed-in 'output' filter.
2310  **
2311  ** Instead, generate the response into the output filter stack for the
2312  ** request (r->output_filters). An implementation can use the request_rec
2313  ** that was passed to get_resource() for this purpose. Using 'output'
2314  ** filter for the response can cause unbounded memory usage.
2315  **
2316  ** See https://mail-archives.apache.org/mod_mbox/httpd-dev/201608.mbox/%3C20160822151917.GA22369%40redhat.com%3E
2317  */
2318  dav_error * (*deliver_report)(request_rec *r,
2319  const dav_resource *resource,
2320  const apr_xml_doc *doc,
2321  ap_filter_t *output);
2322 
2323  /*
2324  ** OPTIONAL HOOKS
2325  ** The following hooks are optional; if not defined, then the
2326  ** corresponding protocol methods will be unsupported.
2327  */
2328 
2329  /*
2330  ** Set the state of a checked-in version-controlled resource.
2331  **
2332  ** If the request specified a version, the version resource
2333  ** represents that version. If the request specified a label,
2334  ** then "version" is NULL, and "label" is the label.
2335  **
2336  ** The depth argument is ignored for a file, and can be 0, 1, or
2337  ** DAV_INFINITY for a collection. The depth argument only applies
2338  ** with a label, not a version.
2339  **
2340  ** If an error occurs in a child resource, then the return value is
2341  ** non-NULL, and *response is set to a multistatus response.
2342  **
2343  ** This hook is optional; if not defined, then the UPDATE method
2344  ** will not be supported.
2345  */
2346  dav_error * (*update)(const dav_resource *resource,
2347  const dav_resource *version,
2348  const char *label,
2349  int depth,
2350  dav_response **response);
2351 
2352  /*
2353  ** Add a label to a version. The resource is either a specific
2354  ** version, or a version selector, in which case the label should
2355  ** be added to the current target of the version selector. The
2356  ** version selector cannot be checked out.
2357  **
2358  ** If replace != 0, any existing label by the same name is
2359  ** effectively deleted first. Otherwise, it is an error to
2360  ** attempt to add a label which already exists on some version
2361  ** of the same history resource.
2362  **
2363  ** This hook is optional; if not defined, then the LABEL method
2364  ** will not be supported. If it is defined, then the remove_label
2365  ** hook must be defined also.
2366  */
2367  dav_error * (*add_label)(const dav_resource *resource,
2368  const char *label,
2369  int replace);
2370 
2371  /*
2372  ** Remove a label from a version. The resource is either a specific
2373  ** version, or a version selector, in which case the label should
2374  ** be added to the current target of the version selector. The
2375  ** version selector cannot be checked out.
2376  **
2377  ** It is an error if no such label exists on the specified version.
2378  **
2379  ** This hook is optional, but if defined, the add_label hook
2380  ** must be defined also.
2381  */
2382  dav_error * (*remove_label)(const dav_resource *resource,
2383  const char *label);
2384 
2385  /*
2386  ** Determine whether a null resource can be created as a workspace.
2387  ** The provider may restrict workspaces to certain locations.
2388  ** Returns 0 if the resource cannot be a workspace.
2389  **
2390  ** This hook is optional; if the provider does not support workspaces,
2391  ** it should be set to NULL.
2392  */
2394 
2395  /*
2396  ** Create a workspace resource. The resource must not already
2397  ** exist. Any <DAV:mkworkspace> element is passed to the provider
2398  ** in the "doc" structure; it may be empty.
2399  **
2400  ** If workspace creation is successful, the state of the resource
2401  ** object is updated appropriately.
2402  **
2403  ** This hook is optional; if the provider does not support workspaces,
2404  ** it should be set to NULL.
2405  */
2406  dav_error * (*make_workspace)(dav_resource *resource,
2407  apr_xml_doc *doc);
2408 
2409  /*
2410  ** Determine whether a null resource can be created as an activity.
2411  ** The provider may restrict activities to certain locations.
2412  ** Returns 0 if the resource cannot be an activity.
2413  **
2414  ** This hook is optional; if the provider does not support activities,
2415  ** it should be set to NULL.
2416  */
2418 
2419  /*
2420  ** Create an activity resource. The resource must not already
2421  ** exist.
2422  **
2423  ** If activity creation is successful, the state of the resource
2424  ** object is updated appropriately.
2425  **
2426  ** This hook is optional; if the provider does not support activities,
2427  ** it should be set to NULL.
2428  */
2429  dav_error * (*make_activity)(dav_resource *resource);
2430 
2431  /*
2432  ** Merge a resource (tree) into target resource (tree).
2433  **
2434  ** ### more doc...
2435  **
2436  ** This hook is optional; if the provider does not support merging,
2437  ** then this should be set to NULL.
2438  **
2439  ** API ISSUE: don't use the passed-in 'output' filter.
2440  **
2441  ** Instead, generate the response into the output filter stack for the
2442  ** request (r->output_filters). An implementation can use the request_rec
2443  ** that was passed to get_resource() for this purpose. Using 'output'
2444  ** filter for the response can cause unbounded memory usage.
2445  **
2446  ** See https://mail-archives.apache.org/mod_mbox/httpd-dev/201608.mbox/%3C20160822151917.GA22369%40redhat.com%3E
2447  */
2448  dav_error * (*merge)(dav_resource *target, dav_resource *source,
2449  int no_auto_merge, int no_checkout,
2450  apr_xml_elem *prop_elem,
2451  ap_filter_t *output);
2452 
2453  /*
2454  ** If a provider needs a context to associate with this hooks structure,
2455  ** then this field may be used. In most cases, it will just be NULL.
2456  */
2457  void *ctx;
2458 };
2459 
2460 
2461 /* --------------------------------------------------------------------
2462 **
2463 ** BINDING FUNCTIONS
2464 */
2465 
2466 /* binding provider hooks */
2468 
2469  /* Determine whether a resource can be the target of a binding.
2470  * Returns 0 if the resource cannot be a binding target.
2471  */
2473 
2474  /* Create a binding to a resource.
2475  * The resource argument is the target of the binding;
2476  * the binding argument must be a resource which does not already
2477  * exist.
2478  */
2479  dav_error * (*bind_resource)(const dav_resource *resource,
2480  dav_resource *binding);
2481 
2482  /*
2483  ** If a provider needs a context to associate with this hooks structure,
2484  ** then this field may be used. In most cases, it will just be NULL.
2485  */
2486  void *ctx;
2487 
2488 };
2489 
2490 
2491 /* --------------------------------------------------------------------
2492 **
2493 ** SEARCH(DASL) FUNCTIONS
2494 */
2495 
2496 /* search provider hooks */
2498  /* Set header for a OPTION method
2499  * An error may be returned.
2500  * To set a hadder, this function might call
2501  * apr_table_setn(r->headers_out, "DASL", dasl_optin1);
2502  *
2503  * Examples:
2504  * DASL: <DAV:basicsearch>
2505  * DASL: <http://foo.bar.com/syntax1>
2506  * DASL: <http://akuma.com/syntax2>
2507  */
2508  dav_error * (*set_option_head)(request_rec *r);
2509 
2510  /* Search resources
2511  * An error may be returned. *response will contain multistatus
2512  * responses (if any) suitable for the body of the error. It is also
2513  * possible to return NULL, yet still have multistatus responses.
2514  * In this case, typically the caller should return a 207 (Multistatus)
2515  * and the responses (in the body) as the HTTP response.
2516  */
2517  dav_error * (*search_resource)(request_rec *r,
2518  dav_response **response);
2519 
2520  /*
2521  ** If a provider needs a context to associate with this hooks structure,
2522  ** then this field may be used. In most cases, it will just be NULL.
2523  */
2524  void *ctx;
2525 
2526 };
2527 
2528 
2529 /* --------------------------------------------------------------------
2530 **
2531 ** MISCELLANEOUS STUFF
2532 */
2533 
2534 typedef struct {
2535  int propid; /* live property ID */
2536  const dav_hooks_liveprop *provider; /* the provider defining this prop */
2538 
2539 
2540 /* --------------------------------------------------------------------
2541 **
2542 ** DAV ACL HOOKS
2543 */
2544 #ifdef APR_XML_X2T_PARSED
2545 
2546 struct dav_acl_provider
2547 {
2548  dav_error * (*acl_check_method)(request_rec *r,
2549  const dav_resource *resource);
2550 
2551  dav_error * (*acl_check_read)(request_rec *r,
2552  const dav_resource *resource);
2553 
2554  dav_error * (*acl_check_prop)(request_rec *r,
2555  const dav_resource *resource,
2556  const dav_prop_name *name,
2558 
2559  void (*acl_post_processing)(request_rec *r,
2560  const dav_resource *resource,
2561  int new_resource_created);
2562  void *ctx;
2563 };
2564 
2565 DAV_DECLARE(void) dav_acl_provider_register(apr_pool_t *p,
2566  const dav_acl_provider *acl);
2567 
2568 DAV_DECLARE(const dav_acl_provider *) dav_get_acl_providers(void);
2569 
2570 #endif
2571 
2572 /* --------------------------------------------------------------------
2573 **
2574 ** DAV OPTIONS
2575 */
2576 #define DAV_OPTIONS_EXTENSION_GROUP "dav_options"
2577 
2578 typedef struct dav_options_provider
2579 {
2580  dav_error* (*dav_header)(request_rec *r,
2581  const dav_resource *resource,
2583 
2584  dav_error* (*dav_method)(request_rec *r,
2585  const dav_resource *resource,
2587 
2588  void *ctx;
2590 
2591 extern DAV_DECLARE(const dav_options_provider *) dav_get_options_providers(const char *name);
2592 
2593 extern DAV_DECLARE(void) dav_options_provider_register(apr_pool_t *p,
2594  const char *name,
2596 
2597 /* --------------------------------------------------------------------
2598 **
2599 ** DAV RESOURCE TYPE HOOKS
2600 */
2601 
2603 {
2604  int (*get_resource_type)(const dav_resource *resource,
2605  const char **name,
2606  const char **uri);
2608 
2609 #define DAV_RESOURCE_TYPE_GROUP "dav_resource_type"
2610 
2611 DAV_DECLARE(void) dav_resource_type_provider_register(apr_pool_t *p,
2612  const char *name,
2614 
2615 DAV_DECLARE(const dav_resource_type_provider *) dav_get_resource_type_providers(const char *name);
2616 
2617 #ifdef __cplusplus
2618 }
2619 #endif
2620 
2621 #endif /* _MOD_DAV_H_ */
2622 
const dav_hooks_propdb * propdb
Definition: mod_dav.h:668
size_t apr_size_t
Definition: apr.h:375
struct dav_if_state_list * state
Definition: mod_dav.h:795
dav_response * response
Definition: mod_dav.h:1709
dav_buffer work_buf
Definition: mod_dav.h:1768
void(* close)(dav_db *db)
Definition: mod_dav.h:1120
Definition: mod_dav.h:1066
apr_text * propstats
Definition: mod_dav.h:494
#define DAV_DECLARE_NONSTD(type)
Definition: mod_dav.h:86
Definition: mod_dav.h:1057
Definition: mod_dav.h:512
struct dav_if_header * next
Definition: mod_dav.h:796
void * ctx
Definition: mod_dav.h:927
dav_buffer * pbuf
Definition: mod_dav.h:461
struct dav_lockdb_private dav_lockdb_private
Definition: mod_dav.h:1232
const dav_hooks_repository * repos
Definition: mod_dav.h:667
Definition: mod_dav.h:1043
Definition: apr_xml.h:200
Definition: mod_dav.h:666
const char *const * namespace_uris
Definition: mod_dav.h:866
Definition: mod_dav.h:1045
struct dav_prop_ctx dav_prop_ctx
Definition: apr_tables.h:62
void * liveprop_ctx
Definition: mod_dav.h:1668
const dav_resource dav_lockdb const apr_xml_doc dav_lock ** lock_request
Definition: mod_dav.h:1328
int versioned
Definition: mod_dav.h:400
Definition: mod_dav.h:773
void * ctx
Definition: mod_dav.h:2457
APR-UTIL DBM library.
Definition: mod_dav.h:1076
const char const char apr_text_header * body
Definition: mod_dav.h:1615
void(* get_vsn_options)(apr_pool_t *p, apr_text_header *phdr)
Definition: mod_dav.h:2175
Definition: mod_dav.h:1797
const dav_resource * resrouce
Definition: mod_dav.h:1328
Definition: mod_dav.h:305
Definition: mod_dav.h:2497
dav_resource int undo
Definition: mod_dav.h:2143
Definition: mod_dav.h:1049
apr_pool_t * scratchpool
Definition: mod_dav.h:1748
Definition: mod_dav.h:1692
apr_array_header_t * prop_ctx
Definition: mod_dav.h:579
Definition: mod_dav.h:1053
The representation of a filter chain.
Definition: util_filter.h:273
Definition: mod_dav.h:1379
const dav_resource * root
Definition: mod_dav.h:1728
const char * uri
Definition: mod_dav.h:793
Definition: mod_dav.h:299
Definition: mod_dav.h:605
int operation
Definition: mod_dav.h:1661
dav_lock_type
Definition: mod_dav.h:1258
int(* can_be_workspace)(const dav_resource *resource)
Definition: mod_dav.h:2393
apr_bucket_brigade request_rec apr_pool_t * pool
Definition: mod_dav.h:556
Definition: mod_dav.h:1065
Definition: mod_dav.h:1299
int propid
Definition: mod_dav.h:2535
void * ctx
Definition: mod_dav.h:2524
void * ctx
Definition: mod_dav.h:674
Definition: mod_dav.h:1042
const dav_resource dav_lockdb dav_lock * request
Definition: mod_dav.h:1336
int propfind_type
Definition: mod_dav.h:1754
dav_auto_version
Definition: mod_dav.h:2084
Definition: mod_dav.h:1655
Definition: mod_dav.h:1052
void * ctx
Definition: mod_dav.h:2038
Definition: mod_dav.h:1062
Definition: apr_xml.h:162
Apache XML library.
struct dav_error * prev
Definition: mod_dav.h:131
dav_lockdb const dav_resource int apr_array_header_t dav_propdb ** propdb
Definition: mod_dav.h:1597
const char * desc
Definition: mod_dav.h:124
Definition: mod_dav.h:536
Definition: mod_dav.h:1075
Definition: mod_dav.h:1032
apr_text * xmlns
Definition: mod_dav.h:495
dav_resource_type
Definition: mod_dav.h:296
int parent_checkedout
Definition: mod_dav.h:2098
APR Hash Tables.
struct dav_rollback_item * rollback
Definition: mod_dav.h:1669
int dummy_header
Definition: mod_dav.h:798
Definition: mod_dav.h:1034
Definition: mod_dav.h:1071
Definition: mod_dav.h:309
Definition: mod_dav.h:1037
struct dav_resource_type_provider dav_resource_type_provider
Definition: mod_dav.h:2602
Definition: mod_dav.h:532
apr_pool_t * pool
Definition: mod_dav.h:423
Definition: mod_dav.h:391
Definition: mod_dav.h:1054
Definition: mod_dav.h:303
Definition: mod_dav.h:1697
Definition: mod_dav.h:2467
int(* exists)(dav_db *db, const dav_prop_name *name)
Definition: mod_dav.h:1187
apr_hash_t * prefix_uri
Definition: mod_dav.h:608
dav_locktoken_list ** ltl
Definition: mod_dav.h:808
Definition: mod_dav.h:1041
Definition: mod_dav.h:1116
const char * name
Definition: mod_dav.h:942
const dav_hooks_search * search
Definition: mod_dav.h:672
const dav_resource const dav_locktoken * locktoken
Definition: mod_dav.h:1333
void * ctx
Definition: mod_dav.h:429
Definition: apr_xml.h:53
int count
Definition: mod_dav.h:609
apr_pool_t int strip_white
Definition: mod_dav.h:591
apr_pool_t * pool
Definition: mod_dav.h:1725
const char const char * uri
Definition: mod_dav.h:618
int baselined
Definition: mod_dav.h:404
dav_lock * locks
Definition: mod_dav.h:1323
Definition: mod_dav.h:1030
void * ctx
Definition: mod_dav.h:2588
Definition: apr_buckets.h:258
int skip_root
Definition: mod_dav.h:1764
const char * nmspace
Definition: mod_dav.h:2155
dav_if_state_type
Definition: mod_dav.h:770
const char * name
Definition: mod_dav.h:1112
const char * prefix
Definition: mod_dav.h:618
Definition: mod_dav.h:1069
Definition: mod_dav.h:529
Definition: mod_dav.h:2087
apr_xml_doc * doc
Definition: mod_dav.h:1753
int is_liveprop
Definition: mod_dav.h:1667
struct dav_if_state_list * next
Definition: mod_dav.h:788
Definition: mod_dav.h:1796
Definition: mod_dav.h:774
dav_lockdb const dav_resource int int depth
Definition: mod_dav.h:1340
Definition: mod_dav.h:1048
Definition: mod_dav.h:1807
request_rec * r
Definition: mod_dav.h:1750
int dav_get_props_result * propstats
Definition: mod_dav.h:1773
Definition: mod_dav.h:1059
dav_buffer apr_size_t size
Definition: mod_dav.h:461
request_rec int apr_array_header_t * namespaces
Definition: mod_dav.h:566
Definition: mod_dav.h:1055
Definition: mod_dav.h:1027
Definition: mod_dav.h:819
int int apr_status_t const char * desc
Definition: mod_dav.h:141
void * ctx
Definition: mod_dav.h:1577
const char * name
Definition: mod_dav.h:2156
Definition: mod_dav.h:1067
Definition: mod_dav.h:1243
Definition: mod_dav.h:1259
Definition: mod_dav.h:2095
apr_bucket_brigade * bb
Definition: mod_dav.h:556
dav_lock_rectype
Definition: mod_dav.h:1263
const dav_lock * lock
Definition: mod_dav.h:1763
struct dav_walker_ctx dav_walker_ctx
Definition: mod_dav.h:940
HTTP Daemon routines.
apr_size_t alloc_len
Definition: mod_dav.h:453
Apache hook functions.
request_rec * r
Definition: mod_dav.h:1674
Definition: mod_dav.h:1050
apr_text * propstat_404
Definition: mod_dav.h:1759
int int apr_status_t aprerr
Definition: mod_dav.h:141
int(* is_same_resource)(const dav_resource *res1, const dav_resource *res2)
Definition: mod_dav.h:1864
Definition: mod_dav.h:1264
int int error_id
Definition: mod_dav.h:141
const char * etag
Definition: mod_dav.h:785
Definition: mod_dav.h:2086
int
Definition: mod_proxy.h:617
dav_lock_rectype rectype
Definition: mod_dav.h:1301
Definition: mod_dav.h:2534
struct dav_options_provider dav_options_provider
Definition: mod_dav.h:492
Definition: mod_dav.h:1079
Definition: mod_dav.h:1694
Definition: mod_dav.h:1028
Definition: mod_dav.h:1736
#define APR_DECLARE_EXTERNAL_HOOK(ns, link, ret, name, args)
Definition: apr_hooks.h:118
struct dav_db dav_db
Definition: mod_dav.h:1106
int(* versionable)(const dav_resource *resource)
Definition: mod_dav.h:2189
const char * childtags
Definition: mod_dav.h:133
dav_buffer const void apr_size_t amt
Definition: mod_dav.h:481
apr_xml_elem * prop
Definition: mod_dav.h:1659
dav_error * src
Definition: mod_dav.h:186
dav_error * err
Definition: mod_dav.h:203
const char const dav_liveprop_group * group
Definition: mod_dav.h:964
int error_id
Definition: mod_dav.h:123
int(* is_bindable)(const dav_resource *resource)
Definition: mod_dav.h:2472
APR Table library.
apr_bucket_brigade * bb
Definition: mod_dav.h:1745
struct dav_stream dav_stream
Definition: mod_dav.h:1793
dav_lockdb const dav_resource int apr_array_header_t * ns_xlate
Definition: mod_dav.h:1597
time_t timeout
Definition: mod_dav.h:1309
void * walk_ctx
Definition: mod_dav.h:1700
Definition: mod_dav.h:1068
const char const char * propname
Definition: mod_dav.h:1615
const dav_resource * resource
Definition: mod_dav.h:1706
dav_if_state_type type
Definition: mod_dav.h:779
dav_lockdb const dav_resource int resource_state
Definition: mod_dav.h:1340
Definition: mod_dav.h:1110
int flags
Definition: mod_dav.h:1766
apr_size_t uri_len
Definition: mod_dav.h:794
Definition: mod_dav.h:1060
const dav_locktoken * locktoken
Definition: mod_dav.h:1762
Definition: mod_dav.h:2085
int dav_response * first
Definition: mod_dav.h:574
Definition: mod_dav.h:1029
dav_lockdb_private * info
Definition: mod_dav.h:1248
Definition: mod_dav.h:1063
Definition: mod_dav.h:777
const dav_hooks_liveprop * provider
Definition: mod_dav.h:2536
dav_locktoken * locktoken
Definition: mod_dav.h:786
dav_propdb * propdb
Definition: mod_dav.h:1657
int status
Definition: mod_dav.h:122
Definition: mod_dav.h:1260
struct dav_if_header dav_if_header
char * buf
Definition: mod_dav.h:455
namespace const char * tagname
Definition: mod_dav.h:153
Definition: mod_dav.h:1056
dav_resource_type type
Definition: mod_dav.h:392
#define DAV_DECLARE(type)
Definition: mod_dav.h:85
int is_locknull
Definition: mod_dav.h:1302
dav_auto_version(* auto_versionable)(const dav_resource *resource)
Definition: mod_dav.h:2200
struct dav_liveprop_rollback dav_liveprop_rollback
Definition: mod_dav.h:817
const char * desc
Definition: mod_dav.h:502
struct apr_hash_t apr_hash_t
Definition: apr_hash.h:52
dav_error dav_response * response
Definition: mod_dav.h:203
const dav_liveprop_group const dav_liveprop_spec ** info
Definition: mod_dav.h:970
Definition: mod_dav.h:311
Definition: mod_dav.h:1040
Definition: mod_dav.h:1254
dav_buffer apr_size_t extra_needed
Definition: mod_dav.h:469
Definition: mod_dav.h:791
Definition: mod_dav.h:1064
request_rec int must_be_absolute
Definition: mod_dav.h:519
apr_pool_t * p
struct dav_if_state_list dav_if_state_list
int resource_versioned
Definition: mod_dav.h:2096
const dav_locktoken * locktoken
Definition: mod_dav.h:1311
Definition: mod_dav.h:1061
dav_hooks_propdb dav_hooks_db
Definition: mod_dav.h:276
int ro
Definition: mod_dav.h:1246
Definition: mod_dav.h:1693
const char * uri
Definition: mod_dav.h:412
int working
Definition: mod_dav.h:408
dav_stream_mode
Definition: mod_dav.h:1795
dav_lock_scope
Definition: mod_dav.h:1252
struct dav_lock_private dav_lock_private
Definition: mod_dav.h:1237
int is_writable
Definition: mod_dav.h:946
const char const dav_provider * hooks
Definition: mod_dav.h:730
const char const dav_options_provider * provider
Definition: mod_dav.h:2594
Definition: mod_dav.h:297
struct dav_lock * next
Definition: mod_dav.h:1318
dav_resource int dav_auto_version_info * av_info
Definition: mod_dav.h:2122
dav_lock_type type
Definition: mod_dav.h:1307
struct dav_propdb dav_propdb
Definition: mod_dav.h:1592
dav_resource_private * info
Definition: mod_dav.h:416
struct dav_namespace_map dav_namespace_map
Definition: mod_dav.h:1107
Definition: mod_dav.h:1031
int ns
Definition: mod_dav.h:941
apr_hash_t * uri_prefix
Definition: mod_dav.h:607
Definition: mod_dav.h:1077
struct dav_error dav_error
struct dav_resource_private dav_resource_private
Definition: mod_dav.h:320
Definition: mod_dav.h:1070
struct dav_deadprop_rollback dav_deadprop_rollback
Definition: mod_dav.h:1108
Definition: mod_dav.h:1266
const dav_resource dav_lockdb * lockdb
Definition: mod_dav.h:1328
const dav_liveprop_spec * specs
Definition: mod_dav.h:957
A structure that represents the current request.
Definition: httpd.h:805
Definition: mod_dav.h:1058
Definition: mod_dav.h:1713
const dav_resource dav_lockdb const apr_xml_doc * doc
Definition: mod_dav.h:1328
Definition: mod_dav.h:121
Apache filter library.
int status
Definition: mod_dav.h:507
const char * ns
Definition: mod_dav.h:1111
dav_buffer const void apr_size_t apr_size_t pad
Definition: mod_dav.h:481
int condition
Definition: mod_dav.h:781
apr_status_t aprerr
Definition: mod_dav.h:126
apr_pool_t * pool
Definition: mod_dav.h:606
const dav_hooks_binding * binding
Definition: mod_dav.h:671
const dav_if_header * if_header
Definition: mod_dav.h:1761
Definition: mod_dav.h:1024
int(* can_be_activity)(const dav_resource *resource)
Definition: mod_dav.h:2417
void * ctx
Definition: mod_dav.h:1215
struct dav_resource dav_resource
apr_size_t cur_len
Definition: mod_dav.h:454
struct dav_locktoken dav_locktoken
Definition: mod_dav.h:438
const char *const * namespace_uris
Definition: mod_dav.h:958
int depth
Definition: mod_dav.h:1308
dav_buffer const char * str
Definition: mod_dav.h:465
dav_error err
Definition: mod_dav.h:515
const dav_resource * resource
Definition: mod_dav.h:998
int status
Definition: mod_dav.h:141
const dav_resource dav_prop_insert what
Definition: mod_dav.h:998
int int const char dav_error * prev
Definition: mod_dav.h:170
Definition: mod_dav.h:1074
dav_buffer const void * mem
Definition: mod_dav.h:481
dav_resource * parent_resource
Definition: mod_dav.h:2099
dav_lockdb const dav_resource int ro
Definition: mod_dav.h:1597
const char * name
Definition: mod_dav.h:730
dav_lock_scope scope
Definition: mod_dav.h:1306
Definition: apr_xml.h:64
const dav_hooks_repository * hooks
Definition: mod_dav.h:418
dav_walk_params w
Definition: mod_dav.h:1739
const char * tagname
Definition: mod_dav.h:128
int handle_get
Definition: mod_dav.h:1815
int walk_type
Definition: mod_dav.h:1715
struct apr_pool_t apr_pool_t
Definition: apr_pools.h:60
Definition: mod_dav.h:1033
struct dav_locktoken_list * next
Definition: mod_dav.h:804
typedef void(APR_THREAD_FUNC *PFN_HSE_IO_COMPLETION)(EXTENSION_CONTROL_BLOCK *ecb
const dav_hooks_vsn * vsn
Definition: mod_dav.h:670
int apr_status_t
Definition: apr_errno.h:44
int collection
Definition: mod_dav.h:396
request_rec * out_req
Definition: mod_dav.h:2060
request_rec * r
Definition: mod_dav.h:519
dav_get_props_result propresult
Definition: mod_dav.h:505
Definition: mod_dav.h:956
dav_lockdb * lockdb
Definition: mod_dav.h:1731
request_rec * rnew
Definition: mod_dav.h:514
Definition: mod_dav.h:524
Definition: mod_dav.h:1035
void * walk_ctx
Definition: mod_dav.h:1722
void * ctx
Definition: mod_dav.h:2486
const dav_hooks_liveprop * hooks
Definition: mod_dav.h:959
dav_resource int parent_only
Definition: mod_dav.h:2122
Definition: mod_dav.h:313
struct dav_response * next
Definition: mod_dav.h:509
Definition: mod_dav.h:534
apr_text_header * phdr
Definition: mod_dav.h:636
int def_depth
Definition: mod_dav.h:583
Definition: mod_dav.h:1253
dav_prop_insert
Definition: mod_dav.h:523
Definition: mod_dav.h:1051
Definition: mod_dav.h:1036
struct dav_locktoken_list dav_locktoken_list
int propid
Definition: mod_dav.h:944
const dav_hooks_locks * locks
Definition: mod_dav.h:669
int exists
Definition: mod_dav.h:394
apr_pool_t * pool
Definition: mod_dav.h:1703
Definition: mod_dav.h:1265
Definition: mod_dav.h:1255
int(* report_label_header_allowed)(const apr_xml_doc *doc)
Definition: mod_dav.h:2287
const dav_hooks_locks * hooks
Definition: mod_dav.h:1245
Definition: mod_dav.h:2578
dav_error * err
Definition: mod_dav.h:1671
Definition: mod_dav.h:772
const char * auth_user
Definition: mod_dav.h:1314
const char * href
Definition: mod_dav.h:501
dav_resource int dav_locktoken dav_response int flags
Definition: mod_dav.h:1350
Definition: mod_dav.h:499
int resource_checkedout
Definition: mod_dav.h:2097
int(* is_parent_resource)(const dav_resource *res1, const dav_resource *res2)
Definition: mod_dav.h:1874
dav_lock_private * info
Definition: mod_dav.h:1316
struct dav_lock dav_lock
Definition: mod_dav.h:307
Definition: mod_dav.h:801
dav_resource int int unlock
Definition: mod_dav.h:2143
off_t apr_off_t
Definition: apr.h:377
Definition: mod_dav.h:1044
dav_locktoken * locktoken
Definition: mod_dav.h:803
const char * ns_uri
Definition: mod_dav.h:993
Definition: mod_dav.h:2161
Definition: mod_dav.h:451
const char * owner
Definition: mod_dav.h:1313
Definition: mod_dav.h:2154