2 * ra_neon.h : Private declarations for the Neon-based DAV RA module.
4 * ====================================================================
5 * Copyright (c) 2000-2008 CollabNet. All rights reserved.
7 * This software is licensed as described in the file COPYING, which
8 * you should have received as part of this distribution. The terms
9 * are also available at http://subversion.tigris.org/license-1.html.
10 * If newer versions of this license are posted there, you may use a
11 * newer version instead, at your option.
13 * This software consists of voluntary contributions made by many
14 * individuals. For exact contribution history, see the revision
15 * history and logs, available at http://subversion.tigris.org/.
16 * ====================================================================
21 #ifndef SVN_LIBSVN_RA_NEON_H
22 #define SVN_LIBSVN_RA_NEON_H
24 #include <apr_pools.h>
25 #include <apr_tables.h>
27 #include <ne_request.h>
29 #include <ne_207.h> /* for NE_ELM_207_UNUSED */
30 #include <ne_props.h> /* for ne_propname */
32 #include "svn_types.h"
33 #include "svn_string.h"
34 #include "svn_delta.h"
38 #include "private/svn_dav_protocol.h"
39 #include "svn_private_config.h"
43 #endif /* __cplusplus */
47 /* Rename these types and constants to abstract from Neon */
49 #define SVN_RA_NEON__XML_DECLINE NE_XML_DECLINE
50 #define SVN_RA_NEON__XML_INVALID NE_XML_ABORT
52 #define SVN_RA_NEON__XML_CDATA (1<<1)
53 #define SVN_RA_NEON__XML_COLLECT ((1<<2) | SVN_RA_NEON__XML_CDATA)
55 typedef int svn_ra_neon__xml_elmid
;
65 /** XML tag id to be passed to a handler. */
66 svn_ra_neon__xml_elmid id
;
68 /** Processing flags for this namespace:tag.
70 * 0 (zero) - regular element, may have children,
71 * SVN_RA_NEON__XML_CDATA - child-less element,
72 * SVN_RA_NEON__XML_COLLECT - complete contents of such element must be
73 * collected as CDATA, includes *_CDATA flag. */
76 } svn_ra_neon__xml_elm_t
;
82 svn_stringbuf_t
*url
; /* original, unparsed session url */
83 ne_uri root
; /* parsed version of above */
84 const char *repos_root
; /* URL for repository root */
86 ne_session
*ne_sess
; /* HTTP session to server */
88 svn_boolean_t main_session_busy
; /* TRUE when requests should be created
89 and issued on sess2; currently
90 only used by fetch.c */
92 const svn_ra_callbacks2_t
*callbacks
; /* callbacks to get auth data */
95 svn_auth_iterstate_t
*auth_iterstate
; /* state of authentication retries */
96 const char *auth_username
; /* last authenticated username used */
98 svn_auth_iterstate_t
*p11pin_iterstate
; /* state of PKCS#11 pin retries */
100 svn_boolean_t compression
; /* should we use http compression? */
101 const char *uuid
; /* repository UUID */
103 svn_ra_progress_notify_func_t progress_func
;
104 void *progress_baton
;
106 /* Maps SVN_RA_CAPABILITY_foo keys to "yes" or "no" values.
107 If a capability is not yet discovered, it is absent from the table.
108 The table itself is allocated in the svn_ra_neon__session_t's pool;
109 keys and values must have at least that lifetime. Most likely
110 the keys and values are constants anyway (and sufficiently
111 well-informed internal code may just compare against those
112 constants' addresses, therefore). */
113 apr_hash_t
*capabilities
;
114 } svn_ra_neon__session_t
;
118 ne_request
*ne_req
; /* neon request structure */
119 ne_session
*ne_sess
; /* neon session structure */
120 svn_ra_neon__session_t
*sess
; /* DAV session structure */
123 int rv
; /* Return value from
124 ne_request_dispatch() or -1 if
125 not dispatched yet. */
126 int code
; /* HTTP return code, or 0 if none */
127 const char *code_desc
; /* Textual description of CODE */
128 svn_error_t
*err
; /* error encountered while executing
130 svn_boolean_t marshalled_error
; /* TRUE if the error was server-side */
131 apr_pool_t
*pool
; /* where this struct is allocated */
132 apr_pool_t
*iterpool
; /* iteration pool
133 for use within callbacks */
134 } svn_ra_neon__request_t
;
137 /* Statement macro to set the request error,
138 * making sure we don't leak any in case we encounter more than one error.
140 * Sets the 'err' field of REQ to the value obtained by evaluating NEW_ERR.
142 #define SVN_RA_NEON__REQ_ERR(req, new_err) \
144 svn_error_t *svn_err__tmp = (new_err); \
145 if ((req)->err && !(req)->marshalled_error) \
146 svn_error_clear(svn_err__tmp); \
147 else if (svn_err__tmp) \
149 svn_error_clear((req)->err); \
150 (req)->err = svn_err__tmp; \
151 (req)->marshalled_error = FALSE; \
156 /* Allocate an internal request structure allocated in a newly created
157 * subpool of POOL. Create an associated neon request with the parameters
160 * When a request is being dispatched on the primary Neon session,
161 * the request is allocated to the secondary neon session of SESS.
163 * Register a pool cleanup for any allocated Neon resources.
165 svn_ra_neon__request_t
*
166 svn_ra_neon__request_create(svn_ra_neon__session_t
*sess
,
167 const char *method
, const char *url
,
171 /* Our version of ne_block_reader, which returns an
172 * svn_error_t * instead of an int. */
173 typedef svn_error_t
*(*svn_ra_neon__block_reader
)(void *baton
,
177 /* Add a response body reader function to REQ.
179 * Use the associated session parameters to determine the use of
182 * Register a pool cleanup on the pool of REQ to clean up any allocated
186 svn_ra_neon__add_response_body_reader(svn_ra_neon__request_t
*req
,
187 ne_accept_response accpt
,
188 svn_ra_neon__block_reader reader
,
192 /* Destroy request REQ and any associated resources */
193 #define svn_ra_neon__request_destroy(req) svn_pool_destroy((req)->pool)
196 #define DEBUG_CR "\n"
202 /** vtable function prototypes */
204 svn_error_t
*svn_ra_neon__get_latest_revnum(svn_ra_session_t
*session
,
205 svn_revnum_t
*latest_revnum
,
208 svn_error_t
*svn_ra_neon__get_dated_revision(svn_ra_session_t
*session
,
209 svn_revnum_t
*revision
,
210 apr_time_t timestamp
,
213 svn_error_t
*svn_ra_neon__change_rev_prop(svn_ra_session_t
*session
,
216 const svn_string_t
*value
,
219 svn_error_t
*svn_ra_neon__rev_proplist(svn_ra_session_t
*session
,
224 svn_error_t
*svn_ra_neon__rev_prop(svn_ra_session_t
*session
,
227 svn_string_t
**value
,
230 svn_error_t
* svn_ra_neon__get_commit_editor(svn_ra_session_t
*session
,
231 const svn_delta_editor_t
**editor
,
233 apr_hash_t
*revprop_table
,
234 svn_commit_callback2_t callback
,
235 void *callback_baton
,
236 apr_hash_t
*lock_tokens
,
237 svn_boolean_t keep_locks
,
240 svn_error_t
* svn_ra_neon__get_file(svn_ra_session_t
*session
,
242 svn_revnum_t revision
,
243 svn_stream_t
*stream
,
244 svn_revnum_t
*fetched_rev
,
248 svn_error_t
*svn_ra_neon__get_dir(svn_ra_session_t
*session
,
249 apr_hash_t
**dirents
,
250 svn_revnum_t
*fetched_rev
,
253 svn_revnum_t revision
,
254 apr_uint32_t dirent_fields
,
257 svn_error_t
* svn_ra_neon__abort_commit(void *session_baton
,
260 svn_error_t
* svn_ra_neon__get_mergeinfo(svn_ra_session_t
*session
,
261 apr_hash_t
**mergeinfo
,
262 const apr_array_header_t
*paths
,
263 svn_revnum_t revision
,
264 svn_mergeinfo_inheritance_t inherit
,
265 svn_boolean_t include_descendants
,
268 svn_error_t
* svn_ra_neon__do_update(svn_ra_session_t
*session
,
269 const svn_ra_reporter3_t
**reporter
,
271 svn_revnum_t revision_to_update_to
,
272 const char *update_target
,
274 svn_boolean_t send_copyfrom_args
,
275 const svn_delta_editor_t
*wc_update
,
276 void *wc_update_baton
,
279 svn_error_t
* svn_ra_neon__do_status(svn_ra_session_t
*session
,
280 const svn_ra_reporter3_t
**reporter
,
282 const char *status_target
,
283 svn_revnum_t revision
,
285 const svn_delta_editor_t
*wc_status
,
286 void *wc_status_baton
,
289 svn_error_t
* svn_ra_neon__do_switch(svn_ra_session_t
*session
,
290 const svn_ra_reporter3_t
**reporter
,
292 svn_revnum_t revision_to_update_to
,
293 const char *update_target
,
295 const char *switch_url
,
296 const svn_delta_editor_t
*wc_update
,
297 void *wc_update_baton
,
300 svn_error_t
* svn_ra_neon__do_diff(svn_ra_session_t
*session
,
301 const svn_ra_reporter3_t
**reporter
,
303 svn_revnum_t revision
,
304 const char *diff_target
,
306 svn_boolean_t ignore_ancestry
,
307 svn_boolean_t text_deltas
,
308 const char *versus_url
,
309 const svn_delta_editor_t
*wc_diff
,
313 svn_error_t
* svn_ra_neon__get_log(svn_ra_session_t
*session
,
314 const apr_array_header_t
*paths
,
318 svn_boolean_t discover_changed_paths
,
319 svn_boolean_t strict_node_history
,
320 svn_boolean_t include_merged_revisions
,
321 const apr_array_header_t
*revprops
,
322 svn_log_entry_receiver_t receiver
,
323 void *receiver_baton
,
326 svn_error_t
*svn_ra_neon__do_check_path(svn_ra_session_t
*session
,
328 svn_revnum_t revision
,
329 svn_node_kind_t
*kind
,
332 svn_error_t
*svn_ra_neon__do_stat(svn_ra_session_t
*session
,
334 svn_revnum_t revision
,
335 svn_dirent_t
**dirent
,
338 svn_error_t
*svn_ra_neon__get_file_revs(svn_ra_session_t
*session
,
342 svn_boolean_t include_merged_revisions
,
343 svn_file_rev_handler_t handler
,
349 ** SVN_RA_NEON__LP_*: local properties for RA/DAV
351 ** ra_neon and ra_serf store properties on the client containing information needed
352 ** to operate against the SVN server. Some of this informations is strictly
353 ** necessary to store, and some is simply stored as a cached value.
356 #define SVN_RA_NEON__LP_NAMESPACE SVN_PROP_WC_PREFIX "ra_dav:"
358 /* store the URL where Activities can be created */
359 /* ### should fix the name to be "activity-coll" at some point */
360 #define SVN_RA_NEON__LP_ACTIVITY_COLL SVN_RA_NEON__LP_NAMESPACE "activity-url"
362 /* store the URL of the version resource (from the DAV:checked-in property) */
363 #define SVN_RA_NEON__LP_VSN_URL SVN_RA_NEON__LP_NAMESPACE "version-url"
367 ** SVN_RA_NEON__PROP_*: properties that we fetch from the server
369 ** These are simply symbolic names for some standard properties that we fetch.
371 #define SVN_RA_NEON__PROP_BASELINE_COLLECTION "DAV:baseline-collection"
372 #define SVN_RA_NEON__PROP_CHECKED_IN "DAV:checked-in"
373 #define SVN_RA_NEON__PROP_VCC "DAV:version-controlled-configuration"
374 #define SVN_RA_NEON__PROP_VERSION_NAME "DAV:" SVN_DAV__VERSION_NAME
375 #define SVN_RA_NEON__PROP_CREATIONDATE "DAV:creationdate"
376 #define SVN_RA_NEON__PROP_CREATOR_DISPLAYNAME "DAV:creator-displayname"
377 #define SVN_RA_NEON__PROP_GETCONTENTLENGTH "DAV:getcontentlength"
379 #define SVN_RA_NEON__PROP_BASELINE_RELPATH \
380 SVN_DAV_PROP_NS_DAV "baseline-relative-path"
382 #define SVN_RA_NEON__PROP_MD5_CHECKSUM SVN_DAV_PROP_NS_DAV "md5-checksum"
384 #define SVN_RA_NEON__PROP_REPOSITORY_UUID SVN_DAV_PROP_NS_DAV "repository-uuid"
386 #define SVN_RA_NEON__PROP_DEADPROP_COUNT SVN_DAV_PROP_NS_DAV "deadprop-count"
389 /* what is the URL for this resource */
392 /* is this resource a collection? (from the DAV:resourcetype element) */
395 /* PROPSET: NAME -> VALUE (const char * -> const svn_string_t *) */
398 /* --- only used during response processing --- */
399 /* when we see a DAV:href element, what element is the parent? */
404 } svn_ra_neon__resource_t
;
406 /* ### WARNING: which_props can only identify properties which props.c
407 ### knows about. see the elem_definitions[] array. */
409 /* fetch a bunch of properties from the server. */
410 svn_error_t
* svn_ra_neon__get_props(apr_hash_t
**results
,
411 svn_ra_neon__session_t
*sess
,
415 const ne_propname
*which_props
,
418 /* fetch a single resource's props from the server. */
419 svn_error_t
* svn_ra_neon__get_props_resource(svn_ra_neon__resource_t
**rsrc
,
420 svn_ra_neon__session_t
*sess
,
423 const ne_propname
*which_props
,
426 /* fetch a single resource's starting props from the server. */
427 svn_error_t
* svn_ra_neon__get_starting_props(svn_ra_neon__resource_t
**rsrc
,
428 svn_ra_neon__session_t
*sess
,
433 /* Shared helper func: given a public URL which may not exist in HEAD,
434 use SESS to search up parent directories until we can retrieve a
435 *RSRC (allocated in POOL) containing a standard set of "starting"
436 props: {VCC, resourcetype, baseline-relative-path}.
438 Also return *MISSING_PATH (allocated in POOL), which is the
439 trailing portion of the URL that did not exist. If an error
440 occurs, *MISSING_PATH isn't changed. */
442 svn_ra_neon__search_for_starting_props(svn_ra_neon__resource_t
**rsrc
,
443 const char **missing_path
,
444 svn_ra_neon__session_t
*sess
,
448 /* fetch a single property from a single resource */
449 svn_error_t
* svn_ra_neon__get_one_prop(const svn_string_t
**propval
,
450 svn_ra_neon__session_t
*sess
,
453 const ne_propname
*propname
,
456 /* Get various Baseline-related information for a given "public" URL.
458 Given a session SESS and a URL, return whether the URL is a
459 directory in *IS_DIR. IS_DIR may be NULL if this flag is unneeded.
461 REVISION may be SVN_INVALID_REVNUM to indicate that the operation
462 should work against the latest (HEAD) revision, or whether it should
463 return information about that specific revision.
465 If BC_URL is not NULL, then it will be filled in with the URL for
466 the Baseline Collection for the specified revision, or the HEAD.
468 If BC_RELATIVE is not NULL, then it will be filled in with a
469 relative pathname for the baselined resource corresponding to the
470 revision of the resource specified by URL.
472 If LATEST_REV is not NULL, then it will be filled in with the revision
473 that this information corresponds to. Generally, this will be the same
474 as the REVISION parameter, unless we are working against the HEAD. In
475 that case, the HEAD revision number is returned.
477 Allocation for BC_URL->data, BC_RELATIVE->data, and temporary data,
480 Note: a Baseline Collection is a complete tree for a specified Baseline.
481 DeltaV baselines correspond one-to-one to Subversion revisions. Thus,
482 the entire state of a revision can be found in a Baseline Collection.
484 svn_error_t
*svn_ra_neon__get_baseline_info(svn_boolean_t
*is_dir
,
485 svn_string_t
*bc_url
,
486 svn_string_t
*bc_relative
,
487 svn_revnum_t
*latest_rev
,
488 svn_ra_neon__session_t
*sess
,
490 svn_revnum_t revision
,
493 /* Fetch a baseline resource populated with specific properties.
495 Given a session SESS and a URL, set *BLN_RSRC to a baseline of
496 REVISION, populated with whatever properties are specified by
497 WHICH_PROPS. To fetch all properties, pass NULL for WHICH_PROPS.
499 If BC_RELATIVE is not NULL, then it will be filled in with a
500 relative pathname for the baselined resource corresponding to the
501 revision of the resource specified by URL.
503 svn_error_t
*svn_ra_neon__get_baseline_props(svn_string_t
*bc_relative
,
504 svn_ra_neon__resource_t
**bln_rsrc
,
505 svn_ra_neon__session_t
*sess
,
507 svn_revnum_t revision
,
508 const ne_propname
*which_props
,
511 /* Fetch the repository's unique Version-Controlled-Configuration url.
513 Given a session SESS and a URL, set *VCC to the url of the
514 repository's version-controlled-configuration resource.
516 svn_error_t
*svn_ra_neon__get_vcc(const char **vcc
,
517 svn_ra_neon__session_t
*sess
,
521 /* Issue a PROPPATCH request on URL, transmitting PROP_CHANGES (a hash
522 of const svn_string_t * values keyed on Subversion user-visible
523 property names) and PROP_DELETES (an array of property names to
524 delete). Send any extra request headers in EXTRA_HEADERS. Use POOL
525 for all allocations. */
526 svn_error_t
*svn_ra_neon__do_proppatch(svn_ra_neon__session_t
*ras
,
528 apr_hash_t
*prop_changes
,
529 apr_array_header_t
*prop_deletes
,
530 apr_hash_t
*extra_headers
,
533 extern const ne_propname svn_ra_neon__vcc_prop
;
534 extern const ne_propname svn_ra_neon__checked_in_prop
;
539 /* send an OPTIONS request to fetch the activity-collection-set */
540 svn_error_t
* svn_ra_neon__get_activity_collection
541 (const svn_string_t
**activity_coll
,
542 svn_ra_neon__session_t
*ras
,
547 /* Call ne_set_request_body_pdovider on REQ with a provider function
548 * that pulls data from BODY_FILE.
550 svn_error_t
*svn_ra_neon__set_neon_body_provider(svn_ra_neon__request_t
*req
,
551 apr_file_t
*body_file
);
554 #define SVN_RA_NEON__DEPTH_ZERO 0
555 #define SVN_RA_NEON__DEPTH_ONE 1
556 #define SVN_RA_NEON__DEPTH_INFINITE -1
557 /* Add a 'Depth' header to a hash of headers.
559 * DEPTH is one of the above defined SVN_RA_NEON__DEPTH_* values.
562 svn_ra_neon__add_depth_header(apr_hash_t
*extra_headers
, int depth
);
564 /** Find a given element in the table of elements.
566 * The table of XML elements @a table is searched until element identified by
567 * namespace @a nspace and name @a name is found. If no elements are found,
568 * tries to find and return element identified by @c ELEM_unknown. If that is
569 * not found, returns NULL pointer. */
570 const svn_ra_neon__xml_elm_t
*
571 svn_ra_neon__lookup_xml_elem(const svn_ra_neon__xml_elm_t
*table
,
577 /* Collect CDATA into a stringbuf.
579 * BATON points to a struct of which the first element is
580 * assumed to be an svn_stringbuf_t *.
583 svn_ra_neon__xml_collect_cdata(void *baton
, int state
,
584 const char *cdata
, size_t len
);
587 /* Our equivalent of ne_xml_startelm_cb, the difference being that it
588 * returns errors in a svn_error_t, and returns the element type via
589 * ELEM. To ignore the element *ELEM should be set to
590 * SVN_RA_NEON__XML_DECLINE and SVN_NO_ERROR should be returned.
591 * *ELEM can be set to SVN_RA_NEON__XML_INVALID to indicate invalid XML
592 * (and abort the parse).
594 typedef svn_error_t
* (*svn_ra_neon__startelm_cb_t
)(int *elem
,
601 /* Our equivalent of ne_xml_cdata_cb, the difference being that it returns
602 * errors in a svn_error_t.
604 typedef svn_error_t
* (*svn_ra_neon__cdata_cb_t
)(void *baton
,
609 /* Our equivalent of ne_xml_endelm_cb, the difference being that it returns
610 * errors in a svn_error_t.
612 typedef svn_error_t
* (*svn_ra_neon__endelm_cb_t
)(void *baton
,
618 /* Create a Neon xml parser with callbacks STARTELM_CB, ENDELM_CB and
619 * CDATA_CB. The created parser wraps the Neon callbacks and marshals any
620 * errors returned by the callbacks through the Neon layer. Any errors
621 * raised will be returned by svn_ra_neon__request_dispatch() unless
622 * an earlier error occurred.
624 * Register a pool cleanup on the pool of REQ to clean up any allocated
627 * ACCPT indicates whether the parser wants read the response body
628 * or not. Pass NULL for ACCPT when you don't want the returned parser
629 * to be attached to REQ.
632 svn_ra_neon__xml_parser_create(svn_ra_neon__request_t
*req
,
633 ne_accept_response accpt
,
634 svn_ra_neon__startelm_cb_t startelm_cb
,
635 svn_ra_neon__cdata_cb_t cdata_cb
,
636 svn_ra_neon__endelm_cb_t endelm_cb
,
639 /* Send a METHOD request (e.g., "MERGE", "REPORT", "PROPFIND") to URL
640 * in session SESS, and parse the response. If BODY is non-null, it is
641 * the body of the request, else use the contents of file BODY_FILE
644 * STARTELM_CB, CDATA_CB and ENDELM_CB are start element, cdata and end
645 * element handlers, respectively. BATON is passed to each as userdata.
647 * SET_PARSER is a callback function which, if non-NULL, is called
648 * with the XML parser and BATON. This is useful for providers of
649 * validation and element handlers which require access to the parser.
651 * EXTRA_HEADERS is a hash of (const char *) key/value pairs to be
652 * inserted as extra headers in the request. Can be NULL.
654 * STATUS_CODE is an optional 'out' parameter; if non-NULL, then set
655 * *STATUS_CODE to the http status code returned by the server. This
656 * can be set to a useful value even when the function returns an error
657 * however it is not always set when an error is returned. So any caller
658 * wishing to check *STATUS_CODE when an error has been returned must
659 * initialise *STATUS_CODE before calling the function.
661 * If SPOOL_RESPONSE is set, the request response will be cached to
662 * disk in a tmpfile (in full), then read back and parsed.
664 * Use POOL for any temporary allocation.
667 svn_ra_neon__parsed_request(svn_ra_neon__session_t
*sess
,
671 apr_file_t
*body_file
,
672 void set_parser(ne_xml_parser
*parser
,
674 svn_ra_neon__startelm_cb_t startelm_cb
,
675 svn_ra_neon__cdata_cb_t cdata_cb
,
676 svn_ra_neon__endelm_cb_t endelm_cb
,
678 apr_hash_t
*extra_headers
,
680 svn_boolean_t spool_response
,
684 /* ### add SVN_RA_NEON_ to these to prefix conflicts with (sys) headers? */
686 /* Redefine Neon elements */
687 /* With the new API, we need to be able to use element id also as a return
688 * value from the new `startelm' callback, hence all element ids must be
689 * positive. Root element id is the only id that is not positive, it's zero.
690 * `Root state' is never returned by a callback, it's only passed into it.
691 * Therefore, negative element ids are forbidden from now on. */
692 ELEM_unknown
= 1, /* was (-1), see above why it's (1) now */
693 ELEM_root
= NE_XML_STATEROOT
, /* (0) */
695 ELEM_207_first
= ELEM_UNUSED
,
696 ELEM_multistatus
= ELEM_207_first
,
697 ELEM_response
= ELEM_207_first
+ 1,
698 ELEM_responsedescription
= ELEM_207_first
+ 2,
699 ELEM_href
= ELEM_207_first
+ 3,
700 ELEM_propstat
= ELEM_207_first
+ 4,
701 ELEM_prop
= ELEM_207_first
+ 5, /* `prop' tag in the DAV namespace */
702 ELEM_status
= ELEM_207_first
+ 6,
703 ELEM_207_UNUSED
= ELEM_UNUSED
+ 100,
704 ELEM_PROPS_UNUSED
= ELEM_207_UNUSED
+ 100,
707 ELEM_activity_coll_set
= ELEM_207_UNUSED
,
715 ELEM_creator_displayname
,
719 ELEM_options_response
,
723 ELEM_get_content_length
,
727 ELEM_post_commit_err
,
731 ELEM_absent_directory
,
735 ELEM_baseline_relpath
,
737 ELEM_deleted_path
, /* used in log reports */
738 ELEM_replaced_path
, /* used in log reports */
739 ELEM_added_path
, /* used in log reports */
740 ELEM_modified_path
, /* used in log reports */
750 ELEM_target_revision
,
754 ELEM_SVN_prop
, /* `prop' tag in the Subversion namespace */
755 ELEM_dated_rev_report
,
756 ELEM_name_version_name
,
757 ELEM_name_creationdate
,
758 ELEM_name_creator_displayname
,
761 ELEM_repository_uuid
,
762 ELEM_get_locations_report
,
764 ELEM_get_location_segments_report
,
765 ELEM_location_segment
,
766 ELEM_file_revs_report
,
769 ELEM_get_locks_report
,
775 ELEM_lock_creationdate
,
776 ELEM_lock_expirationdate
,
778 ELEM_lock_activelock
,
785 ELEM_apply_textdelta
,
786 ELEM_change_file_prop
,
787 ELEM_change_dir_prop
,
789 ELEM_close_directory
,
791 ELEM_mergeinfo_report
,
800 svn_error_t
* svn_ra_neon__merge_activity(svn_revnum_t
*new_rev
,
801 const char **committed_date
,
802 const char **committed_author
,
803 const char **post_commit_err
,
804 svn_ra_neon__session_t
*ras
,
805 const char *repos_url
,
806 const char *activity_url
,
807 apr_hash_t
*valid_targets
,
808 apr_hash_t
*lock_tokens
,
809 svn_boolean_t keep_locks
,
810 svn_boolean_t disable_merge_response
,
814 /* Make a buffer for repeated use with svn_stringbuf_set().
815 ### it would be nice to start this buffer with N bytes, but there isn't
816 ### really a way to do that in the string interface (yet), short of
817 ### initializing it with a fake string (and copying it) */
818 #define MAKE_BUFFER(p) svn_stringbuf_ncreate("", 0, (p))
821 svn_ra_neon__copy_href(svn_stringbuf_t
*dst
, const char *src
,
826 /* If RAS contains authentication info, attempt to store it via client
827 callbacks and using POOL for temporary allocations. */
829 svn_ra_neon__maybe_store_auth_info(svn_ra_neon__session_t
*ras
,
833 /* Like svn_ra_neon__maybe_store_auth_info(), but conditional on ERR.
835 Attempt to store auth info only if ERR is NULL or if ERR->apr_err
836 is not SVN_ERR_RA_NOT_AUTHORIZED. If ERR is not null, return it no
837 matter what, otherwise return the result of the attempt (if any) to
838 store auth info, else return SVN_NO_ERROR. */
840 svn_ra_neon__maybe_store_auth_info_after_result(svn_error_t
*err
,
841 svn_ra_neon__session_t
*ras
,
845 /* Create an error of type SVN_ERR_RA_DAV_MALFORMED_DATA for cases where
846 we recieve an element we didn't expect to see. */
847 #define UNEXPECTED_ELEMENT(ns, elem) \
848 (ns ? svn_error_createf(SVN_ERR_RA_DAV_MALFORMED_DATA, \
850 _("Got unexpected element %s:%s"), \
853 : svn_error_createf(SVN_ERR_RA_DAV_MALFORMED_DATA, \
855 _("Got unexpected element %s"), \
858 /* Create an error of type SVN_ERR_RA_DAV_MALFORMED_DATA for cases where
859 we don't receive a necessary attribute. */
860 #define MISSING_ATTR(ns, elem, attr) \
861 (ns ? svn_error_createf(SVN_ERR_RA_DAV_MALFORMED_DATA, \
863 _("Missing attribute '%s' on element %s:%s"), \
867 : svn_error_createf(SVN_ERR_RA_DAV_MALFORMED_DATA, \
869 _("Missing attribute '%s' on element %s"), \
873 /* Given a REQUEST, run it; if CODE_P is
874 non-null, return the http status code in *CODE_P. Return any
875 resulting error (from Neon, a <D:error> body response, or any
876 non-2XX status code) as an svn_error_t, otherwise return SVN_NO_ERROR.
878 EXTRA_HEADERS is a hash with (key -> value) of
879 (const char * -> const char *) where the key is the HTTP header name.
881 BODY is a null terminated string containing an in-memory request
882 body. Use svn_ra_neon__set_neon_body_provider() if you want the
883 request body to be read from a file. For requests which have no
884 body at all, consider passing the empty string ("") instead of
885 NULL, as this will cause Neon to generate a "Content-Length: 0"
886 header (which is important to some proxies).
888 OKAY_1 and OKAY_2 are the "acceptable" result codes. Anything other
889 than one of these will generate an error. OKAY_1 should always be
890 specified (e.g. as 200); use 0 for OKAY_2 if a second result code is
895 svn_ra_neon__request_dispatch(int *code_p
,
896 svn_ra_neon__request_t
*request
,
897 apr_hash_t
*extra_headers
,
903 /* A layer over SVN_RA_NEON__REQUEST_DISPATCH() adding a
904 207 response parser to extract relevant (error) information.
906 Don't use this function if you're expecting 207 as a valid response.
908 BODY may be NULL if the request doesn't have a body. */
910 svn_ra_neon__simple_request(int *code
,
911 svn_ra_neon__session_t
*ras
,
914 apr_hash_t
*extra_headers
,
916 int okay_1
, int okay_2
, apr_pool_t
*pool
);
919 /* Convenience statement macro for setting headers in a hash */
920 #define svn_ra_neon__set_header(hash, hdr, val) \
921 apr_hash_set((hash), (hdr), APR_HASH_KEY_STRING, (val))
924 /* Helper function layered over SVN_RA_NEON__SIMPLE_REQUEST() to issue
927 DEPTH is one of the SVN_RA_NEON__DEPTH_* constants. */
929 svn_ra_neon__copy(svn_ra_neon__session_t
*ras
,
930 svn_boolean_t overwrite
,
936 /* Return the Location HTTP header or NULL if none was sent.
938 * Do allocations in POOL.
941 svn_ra_neon__request_get_location(svn_ra_neon__request_t
*request
,
946 * Implements the get_locations RA layer function. */
948 svn_ra_neon__get_locations(svn_ra_session_t
*session
,
949 apr_hash_t
**locations
,
951 svn_revnum_t peg_revision
,
952 apr_array_header_t
*location_revisions
,
957 * Implements the get_location_segments RA layer function. */
959 svn_ra_neon__get_location_segments(svn_ra_session_t
*session
,
961 svn_revnum_t peg_revision
,
962 svn_revnum_t start_rev
,
963 svn_revnum_t end_rev
,
964 svn_location_segment_receiver_t receiver
,
965 void *receiver_baton
,
969 * Implements the get_locks RA layer function. */
971 svn_ra_neon__get_locks(svn_ra_session_t
*session
,
977 * Implements the lock RA layer function. */
979 svn_ra_neon__lock(svn_ra_session_t
*session
,
980 apr_hash_t
*path_revs
,
983 svn_ra_lock_callback_t lock_func
,
988 * Implements the unlock RA layer function. */
990 svn_ra_neon__unlock(svn_ra_session_t
*session
,
991 apr_hash_t
*path_tokens
,
993 svn_ra_lock_callback_t lock_func
,
998 * Internal implementation of get_lock RA layer function. */
1000 svn_ra_neon__get_lock_internal(svn_ra_neon__session_t
*session
,
1006 * Implements the get_lock RA layer function. */
1008 svn_ra_neon__get_lock(svn_ra_session_t
*session
,
1014 * Implements the replay RA layer function. */
1016 svn_ra_neon__replay(svn_ra_session_t
*session
,
1017 svn_revnum_t revision
,
1018 svn_revnum_t low_water_mark
,
1019 svn_boolean_t send_deltas
,
1020 const svn_delta_editor_t
*editor
,
1025 * Implements the replay_range RA layer function. */
1027 svn_ra_neon__replay_range(svn_ra_session_t
*session
,
1028 svn_revnum_t start_revision
,
1029 svn_revnum_t end_revision
,
1030 svn_revnum_t low_water_mark
,
1031 svn_boolean_t send_deltas
,
1032 svn_ra_replay_revstart_callback_t revstart_func
,
1033 svn_ra_replay_revfinish_callback_t revfinish_func
,
1038 * Implements the has_capability RA layer function. */
1040 svn_ra_neon__has_capability(svn_ra_session_t
*session
,
1042 const char *capability
,
1046 /* Helper function. Loop over LOCK_TOKENS and assemble all keys and
1047 values into a stringbuf allocated in POOL. The string will be of
1050 <S:lock-token-list xmlns:S="svn:">
1052 <S:lock-path>path</S:lock-path>
1053 <S:lock-token>token</S:lock-token>
1056 </S:lock-token-list>
1058 Callers can then send this in the request bodies, as a way of
1059 reliably marshalling potentially unbounded lists of locks. (We do
1060 this because httpd has limits on how much data can be sent in 'If:'
1064 svn_ra_neon__assemble_locktoken_body(svn_stringbuf_t
**body
,
1065 apr_hash_t
*lock_tokens
,
1071 #endif /* __cplusplus */
1073 #endif /* SVN_LIBSVN_RA_NEON_H */