svn_ra_svn_private.h revision 299742
1/**
2 * @copyright
3 * ====================================================================
4 *    Licensed to the Apache Software Foundation (ASF) under one
5 *    or more contributor license agreements.  See the NOTICE file
6 *    distributed with this work for additional information
7 *    regarding copyright ownership.  The ASF licenses this file
8 *    to you under the Apache License, Version 2.0 (the
9 *    "License"); you may not use this file except in compliance
10 *    with the License.  You may obtain a copy of the License at
11 *
12 *      http://www.apache.org/licenses/LICENSE-2.0
13 *
14 *    Unless required by applicable law or agreed to in writing,
15 *    software distributed under the License is distributed on an
16 *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 *    KIND, either express or implied.  See the License for the
18 *    specific language governing permissions and limitations
19 *    under the License.
20 * ====================================================================
21 * @endcopyright
22 *
23 * @file svn_ra_svn_private.h
24 * @brief Functions used by the server - Internal routines
25 */
26
27#ifndef SVN_RA_SVN_PRIVATE_H
28#define SVN_RA_SVN_PRIVATE_H
29
30#include "svn_ra_svn.h"
31#include "svn_editor.h"
32
33#ifdef __cplusplus
34extern "C" {
35#endif /* __cplusplus */
36
37
38/**
39 * Set the shim callbacks to be used by @a conn to @a shim_callbacks.
40 */
41svn_error_t *
42svn_ra_svn__set_shim_callbacks(svn_ra_svn_conn_t *conn,
43                               svn_delta_shim_callbacks_t *shim_callbacks);
44
45/**
46 * Return the memory pool used to allocate @a conn.
47 */
48apr_pool_t *
49svn_ra_svn__get_pool(svn_ra_svn_conn_t *conn);
50
51/**
52 * @defgroup ra_svn_deprecated ra_svn low-level functions
53 * @{
54 */
55
56/** Write a number over the net.
57 *
58 * Writes will be buffered until the next read or flush.
59 */
60svn_error_t *
61svn_ra_svn__write_number(svn_ra_svn_conn_t *conn,
62                         apr_pool_t *pool,
63                         apr_uint64_t number);
64
65/** Write a string over the net.
66 *
67 * Writes will be buffered until the next read or flush.
68 */
69svn_error_t *
70svn_ra_svn__write_string(svn_ra_svn_conn_t *conn,
71                         apr_pool_t *pool,
72                         const svn_string_t *str);
73
74/** Write a cstring over the net.
75 *
76 * Writes will be buffered until the next read or flush.
77 */
78svn_error_t *
79svn_ra_svn__write_cstring(svn_ra_svn_conn_t *conn,
80                          apr_pool_t *pool,
81                          const char *s);
82
83/** Write a word over the net.
84 *
85 * Writes will be buffered until the next read or flush.
86 */
87svn_error_t *
88svn_ra_svn__write_word(svn_ra_svn_conn_t *conn,
89                       apr_pool_t *pool,
90                       const char *word);
91
92/** Write a boolean over the net.
93 *
94 * Writes will be buffered until the next read or flush.
95 */
96svn_error_t *
97svn_ra_svn__write_boolean(svn_ra_svn_conn_t *conn,
98                          apr_pool_t *pool,
99                          svn_boolean_t value);
100
101/** Write a list of properties over the net.  @a props is allowed to be NULL,
102 * in which case an empty list will be written out.
103 *
104 * @since New in 1.5.
105 */
106svn_error_t *
107svn_ra_svn__write_proplist(svn_ra_svn_conn_t *conn,
108                           apr_pool_t *pool,
109                           apr_hash_t *props);
110
111/** Begin a list.  Writes will be buffered until the next read or flush. */
112svn_error_t *
113svn_ra_svn__start_list(svn_ra_svn_conn_t *conn,
114                       apr_pool_t *pool);
115
116/** End a list.  Writes will be buffered until the next read or flush. */
117svn_error_t *
118svn_ra_svn__end_list(svn_ra_svn_conn_t *conn,
119                     apr_pool_t *pool);
120
121/** Flush the write buffer.
122 *
123 * Normally this shouldn't be necessary, since the write buffer is flushed
124 * when a read is attempted.
125 */
126svn_error_t *
127svn_ra_svn__flush(svn_ra_svn_conn_t *conn,
128                  apr_pool_t *pool);
129
130/** Write a tuple, using a printf-like interface.
131 *
132 * The format string @a fmt may contain:
133 *
134 *@verbatim
135     Spec  Argument type         Item type
136     ----  --------------------  ---------
137     n     apr_uint64_t          Number
138     r     svn_revnum_t          Number
139     s     const svn_string_t *  String
140     c     const char *          String
141     w     const char *          Word
142     b     svn_boolean_t         Word ("true" or "false")
143     (                           Begin tuple
144     )                           End tuple
145     ?                           Remaining elements optional
146     ! (at beginning or end)     Suppress opening or closing of tuple
147  @endverbatim
148 *
149 * Inside the optional part of a tuple, 'r' values may be @c
150 * SVN_INVALID_REVNUM, 'n' values may be
151 * SVN_RA_SVN_UNSPECIFIED_NUMBER, and 's', 'c', and 'w' values may be
152 * @c NULL; in these cases no data will be written.  'b' and '(' may
153 * not appear in the optional part of a tuple.  Either all or none of
154 * the optional values should be valid.
155 *
156 * (If we ever have a need for an optional boolean value, we should
157 * invent a 'B' specifier which stores a boolean into an int, using -1
158 * for unspecified.  Right now there is no need for such a thing.)
159 *
160 * Use the '!' format specifier to write partial tuples when you have
161 * to transmit an array or other unusual data.  For example, to write
162 * a tuple containing a revision, an array of words, and a boolean:
163 * @code
164     SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "r(!", rev));
165     for (i = 0; i < n; i++)
166       SVN_ERR(svn_ra_svn_write_word(conn, pool, words[i]));
167     SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "!)b", flag)); @endcode
168 */
169svn_error_t *
170svn_ra_svn__write_tuple(svn_ra_svn_conn_t *conn,
171                        apr_pool_t *pool,
172                        const char *fmt, ...);
173
174/** Read an item from the network into @a *item. */
175svn_error_t *
176svn_ra_svn__read_item(svn_ra_svn_conn_t *conn,
177                      apr_pool_t *pool,
178                      svn_ra_svn_item_t **item);
179
180/** Scan data on @a conn until we find something which looks like the
181 * beginning of an svn server greeting (an open paren followed by a
182 * whitespace character).  This function is appropriate for beginning
183 * a client connection opened in tunnel mode, since people's dotfiles
184 * sometimes write output to stdout.  It may only be called at the
185 * beginning of a client connection.
186 */
187svn_error_t *
188svn_ra_svn__skip_leading_garbage(svn_ra_svn_conn_t *conn,
189                                 apr_pool_t *pool);
190
191/** Parse an array of @c svn_sort__item_t structures as a tuple, using a
192 * printf-like interface.  The format string @a fmt may contain:
193 *
194 *@verbatim
195     Spec  Argument type          Item type
196     ----  --------------------   ---------
197     n     apr_uint64_t *         Number
198     r     svn_revnum_t *         Number
199     s     svn_string_t **        String
200     c     const char **          String
201     w     const char **          Word
202     b     svn_boolean_t *        Word ("true" or "false")
203     B     apr_uint64_t *         Word ("true" or "false")
204     3     svn_tristate_t *       Word ("true" or "false")
205     l     apr_array_header_t **  List
206     (                            Begin tuple
207     )                            End tuple
208     ?                            Tuple is allowed to end here
209  @endverbatim
210 *
211 * Note that a tuple is only allowed to end precisely at a '?', or at
212 * the end of the specification.  So if @a fmt is "c?cc" and @a list
213 * contains two elements, an error will result.
214 *
215 * '3' is similar to 'b', but may be used in the optional tuple specification.
216 * It returns #svn_tristate_true, #svn_tristate_false or #svn_tristate_unknown.
217 *
218 * 'B' is similar to '3', but it returns @c TRUE, @c FALSE, or
219 * #SVN_RA_SVN_UNSPECIFIED_NUMBER.  'B' is deprecated; new code should
220 * use '3' instead.
221 *
222 * If an optional part of a tuple contains no data, 'r' values will be
223 * set to @c SVN_INVALID_REVNUM; 'n' and 'B' values will be set to
224 * #SVN_RA_SVN_UNSPECIFIED_NUMBER; 's', 'c', 'w', and 'l' values
225 * will be set to @c NULL; and '3' values will be set to #svn_tristate_unknown
226 * 'b' may not appear inside an optional tuple specification; use '3' instead.
227 */
228svn_error_t *
229svn_ra_svn__parse_tuple(const apr_array_header_t *list,
230                        apr_pool_t *pool,
231                        const char *fmt, ...);
232
233/** Read a tuple from the network and parse it as a tuple, using the
234 * format string notation from svn_ra_svn_parse_tuple().
235 */
236svn_error_t *
237svn_ra_svn__read_tuple(svn_ra_svn_conn_t *conn,
238                       apr_pool_t *pool,
239                       const char *fmt, ...);
240
241/** Parse an array of @c svn_ra_svn_item_t structures as a list of
242 * properties, storing the properties in a hash table.
243 *
244 * @since New in 1.5.
245 */
246svn_error_t *
247svn_ra_svn__parse_proplist(const apr_array_header_t *list,
248                           apr_pool_t *pool,
249                           apr_hash_t **props);
250
251/** Read a command response from the network and parse it as a tuple, using
252 * the format string notation from svn_ra_svn_parse_tuple().
253 */
254svn_error_t *
255svn_ra_svn__read_cmd_response(svn_ra_svn_conn_t *conn,
256                              apr_pool_t *pool,
257                              const char *fmt, ...);
258
259/** Check the receive buffer and socket of @a conn whether there is some
260 * unprocessed incoming data without waiting for new data to come in.
261 * If data is found, set @a *has_command to TRUE.  If the connection does
262 * not contain any more data and has been closed, set @a *terminated to
263 * TRUE.
264 */
265svn_error_t *
266svn_ra_svn__has_command(svn_boolean_t *has_command,
267                        svn_boolean_t *terminated,
268                        svn_ra_svn_conn_t *conn,
269                        apr_pool_t *pool);
270
271/** Accept a single command from @a conn and handle them according
272 * to @a cmd_hash.  Command handlers will be passed @a conn, @a pool,
273 * the parameters of the command, and @a baton.  @a *terminate will be
274 * set if either @a error_on_disconnect is FALSE and the connection got
275 * closed, or if the command being handled has the "terminate" flag set
276 * in the command table.
277 */
278svn_error_t *
279svn_ra_svn__handle_command(svn_boolean_t *terminate,
280                           apr_hash_t *cmd_hash,
281                           void *baton,
282                           svn_ra_svn_conn_t *conn,
283                           svn_boolean_t error_on_disconnect,
284                           apr_pool_t *pool);
285
286/** Accept commands over the network and handle them according to @a
287 * commands.  Command handlers will be passed @a conn, a subpool of @a
288 * pool (cleared after each command is handled), the parameters of the
289 * command, and @a baton.  Commands will be accepted until a
290 * terminating command is received (a command with "terminate" set in
291 * the command table).  If a command handler returns an error wrapped
292 * in SVN_RA_SVN_CMD_ERR (see the @c SVN_CMD_ERR macro), the error
293 * will be reported to the other side of the connection and the
294 * command loop will continue; any other kind of error (typically a
295 * network or protocol error) is passed through to the caller.
296 *
297 * @since New in 1.6.
298 *
299 */
300svn_error_t *
301svn_ra_svn__handle_commands2(svn_ra_svn_conn_t *conn,
302                             apr_pool_t *pool,
303                             const svn_ra_svn_cmd_entry_t *commands,
304                             void *baton,
305                             svn_boolean_t error_on_disconnect);
306
307/** Write a successful command response over the network, using the
308 * same format string notation as svn_ra_svn_write_tuple().  Do not use
309 * partial tuples with this function; if you need to use partial
310 * tuples, just write out the "success" and argument tuple by hand.
311 */
312svn_error_t *
313svn_ra_svn__write_cmd_response(svn_ra_svn_conn_t *conn,
314                               apr_pool_t *pool,
315                               const char *fmt, ...);
316
317/** Write an unsuccessful command response over the network.
318 *
319 * @note This does not clear @a err. */
320svn_error_t *
321svn_ra_svn__write_cmd_failure(svn_ra_svn_conn_t *conn,
322                              apr_pool_t *pool,
323                              const svn_error_t *err);
324
325/**
326 * @}
327 */
328
329/**
330 * @defgroup svn_commands sending ra_svn commands
331 * @{
332 */
333
334/** Sets the target revision of connection @a conn to @a rev.  Use @a pool
335 * for allocations.
336 */
337svn_error_t *
338svn_ra_svn__write_cmd_target_rev(svn_ra_svn_conn_t *conn,
339                                 apr_pool_t *pool,
340                                 svn_revnum_t rev);
341
342/** Send a "open-root" command over connection @a conn.  Open the
343 * repository root at revision @a rev and associate it with @a token.
344 * Use @a pool for allocations.
345 */
346svn_error_t *
347svn_ra_svn__write_cmd_open_root(svn_ra_svn_conn_t *conn,
348                                apr_pool_t *pool,
349                                svn_revnum_t rev,
350                                const char *token);
351
352/** Send a "delete-entry" command over connection @a conn.  Delete the
353 * @a path at optional revision @a rev below @a parent_token.
354 * Use @a pool for allocations.
355 */
356svn_error_t *
357svn_ra_svn__write_cmd_delete_entry(svn_ra_svn_conn_t *conn,
358                                   apr_pool_t *pool,
359                                   const char *path,
360                                   svn_revnum_t rev,
361                                   const char *parent_token);
362
363/** Send a "add-dir" command over connection @a conn.  Add a new directory
364 * node named @a path under the directory identified by @a parent_token.
365 * Associate the new directory with the given @a token.  * @a copy_path
366 * and @a copy_rev are optional and describe the copy source.
367 * Use @a pool for allocations.
368 */
369svn_error_t *
370svn_ra_svn__write_cmd_add_dir(svn_ra_svn_conn_t *conn,
371                              apr_pool_t *pool,
372                              const char *path,
373                              const char *parent_token,
374                              const char *token,
375                              const char *copy_path,
376                              svn_revnum_t copy_rev);
377
378/** Send a "open-dir" command over connection @a conn.  Associate to
379 * @a token the directory node named @a path under the directory
380 * identified by @a parent_token in revision @a rev.
381 * Use @a pool for allocations.
382 */
383svn_error_t *
384svn_ra_svn__write_cmd_open_dir(svn_ra_svn_conn_t *conn,
385                               apr_pool_t *pool,
386                               const char *path,
387                               const char *parent_token,
388                               const char *token,
389                               svn_revnum_t rev);
390
391/** Send a "change-dir-prop" command over connection @a conn.  Set the
392 * property @a name to the optional @a value on the directory identified
393 * to @a token.  Use @a pool for allocations.
394 */
395svn_error_t *
396svn_ra_svn__write_cmd_change_dir_prop(svn_ra_svn_conn_t *conn,
397                                      apr_pool_t *pool,
398                                      const char *token,
399                                      const char *name,
400                                      const svn_string_t *value);
401
402/** Send a "close-dir" command over connection @a conn.  Identify the node
403 * to close with @a token.  The latter will then no longer be associated
404 * with that node.  Use @a pool for allocations.
405 */
406svn_error_t *
407svn_ra_svn__write_cmd_close_dir(svn_ra_svn_conn_t *conn,
408                                apr_pool_t *pool,
409                                const char *token);
410
411/** Send a "absent-dir" command over connection @a conn.  Directory node
412 * named @a path under the directory identified by @a parent_token is
413 * absent.  Use @a pool for allocations.
414 */
415svn_error_t *
416svn_ra_svn__write_cmd_absent_dir(svn_ra_svn_conn_t *conn,
417                                 apr_pool_t *pool,
418                                 const char *path,
419                                 const char *parent_token);
420
421/** Send a "add-file" command over connection @a conn.  Add a new file
422 * node named @a path under the directory identified by @a parent_token.
423 * Associate the new file with the given @a token.  * @a copy_path and
424 * @a copy_rev are optional and describe the copy source.
425 * Use @a pool for allocations.
426 */
427svn_error_t *
428svn_ra_svn__write_cmd_add_file(svn_ra_svn_conn_t *conn,
429                               apr_pool_t *pool,
430                               const char *path,
431                               const char *parent_token,
432                               const char *token,
433                               const char *copy_path,
434                               svn_revnum_t copy_rev);
435
436/** Send a "open-file" command over connection @a conn.  Associate to
437 * @a token the file node named @a path under the directory identified by
438 * @a parent_token in revision @a rev.
439 * Use @a pool for allocations.
440 */
441svn_error_t *
442svn_ra_svn__write_cmd_open_file(svn_ra_svn_conn_t *conn,
443                                apr_pool_t *pool,
444                                const char *path,
445                                const char *parent_token,
446                                const char *token,
447                                svn_revnum_t rev);
448
449/** Send a "change-file-prop" command over connection @a conn.  Set the
450 * property @a name to the optional @a value on the file identified to
451 * @a token.  Use @a pool for allocations.
452 */
453svn_error_t *
454svn_ra_svn__write_cmd_change_file_prop(svn_ra_svn_conn_t *conn,
455                                       apr_pool_t *pool,
456                                       const char *token,
457                                       const char *name,
458                                       const svn_string_t *value);
459
460/** Send a "close-dir" command over connection @a conn.  Identify the node
461 * to close with @a token and provide an optional @a check_sum.  The token
462 * will then no longer be associated with that node.
463 * Use @a pool for allocations.
464 */
465svn_error_t *
466svn_ra_svn__write_cmd_close_file(svn_ra_svn_conn_t *conn,
467                                 apr_pool_t *pool,
468                                 const char *token,
469                                 const char *text_checksum);
470
471/** Send a "absent-file" command over connection @a conn.  File node
472 * named @a path in the directory identified by @a parent_token is
473 * absent.  Use @a pool for allocations.
474 */
475svn_error_t *
476svn_ra_svn__write_cmd_absent_file(svn_ra_svn_conn_t *conn,
477                                  apr_pool_t *pool,
478                                  const char *path,
479                                  const char *parent_token);
480
481/** Send a "apply-textdelta" command over connection @a conn.  Starts a
482 * series of text deltas to be applied to the file identified by @a token.
483 * Optionally, specify the file's current checksum in @a base_checksum.
484 * Use @a pool for allocations.
485 */
486svn_error_t *
487svn_ra_svn__write_cmd_apply_textdelta(svn_ra_svn_conn_t *conn,
488                                      apr_pool_t *pool,
489                                      const char *token,
490                                      const char *base_checksum);
491
492/** Send a "textdelta-chunk" command over connection @a conn.  Apply
493 * textdelta @a chunk to the file identified by @a token.
494 * Use @a pool for allocations.
495 */
496svn_error_t *
497svn_ra_svn__write_cmd_textdelta_chunk(svn_ra_svn_conn_t *conn,
498                                      apr_pool_t *pool,
499                                      const char *token,
500                                      const svn_string_t *chunk);
501
502/** Send a "textdelta-end" command over connection @a conn.  Ends the
503 * series of text deltas to be applied to the file identified by @a token.
504 * Use @a pool for allocations.
505 */
506svn_error_t *
507svn_ra_svn__write_cmd_textdelta_end(svn_ra_svn_conn_t *conn,
508                                    apr_pool_t *pool,
509                                    const char *token);
510
511/** Send a "close-edit" command over connection @a conn.  Ends the editor
512 * drive (successfully).  Use @a pool for allocations.
513 */
514svn_error_t *
515svn_ra_svn__write_cmd_close_edit(svn_ra_svn_conn_t *conn,
516                                 apr_pool_t *pool);
517
518/** Send a "abort-edit" command over connection @a conn.  Prematurely ends
519 * the editor drive, e.g. due to some problem on the other side.
520 * Use @a pool for allocations.
521 */
522svn_error_t *
523svn_ra_svn__write_cmd_abort_edit(svn_ra_svn_conn_t *conn,
524                                 apr_pool_t *pool);
525
526/** Send a "set-path" command over connection @a conn.
527 * Use @a pool for allocations.
528 *
529 * @see set_path() in #svn_ra_reporter3_t for a description.
530 */
531svn_error_t *
532svn_ra_svn__write_cmd_set_path(svn_ra_svn_conn_t *conn,
533                               apr_pool_t *pool,
534                               const char *path,
535                               svn_revnum_t rev,
536                               svn_boolean_t start_empty,
537                               const char *lock_token,
538                               svn_depth_t depth);
539
540/** Send a "delete-path" command over connection @a conn.
541 * Use @a pool for allocations.
542 *
543 * @see delete_path() in #svn_ra_reporter3_t for a description.
544 */
545svn_error_t *
546svn_ra_svn__write_cmd_delete_path(svn_ra_svn_conn_t *conn,
547                                  apr_pool_t *pool,
548                                  const char *path);
549
550/** Send a "link-path" command over connection @a conn.
551 * Use @a pool for allocations.
552 *
553 * @see link_path() in #svn_ra_reporter3_t for a description.
554 */
555svn_error_t *
556svn_ra_svn__write_cmd_link_path(svn_ra_svn_conn_t *conn,
557                                apr_pool_t *pool,
558                                const char *path,
559                                const char *url,
560                                svn_revnum_t rev,
561                                svn_boolean_t start_empty,
562                                const char *lock_token,
563                                svn_depth_t depth);
564
565/** Send a "finish-report" command over connection @a conn.
566 * Use @a pool for allocations.
567 *
568 * @see finish_report() in #svn_ra_reporter3_t for a description.
569 */
570svn_error_t *
571svn_ra_svn__write_cmd_finish_report(svn_ra_svn_conn_t *conn,
572                                    apr_pool_t *pool);
573
574/** Send a "abort-report" command over connection @a conn.
575 * Use @a pool for allocations.
576 *
577 * @see abort_report() in #svn_ra_reporter3_t for a description.
578 */
579svn_error_t *
580svn_ra_svn__write_cmd_abort_report(svn_ra_svn_conn_t *conn,
581                                   apr_pool_t *pool);
582
583/** Send a "reparent" command over connection @a conn.
584 * Use @a pool for allocations.
585 *
586 * @see #svn_ra_reparent for a description.
587 */
588svn_error_t *
589svn_ra_svn__write_cmd_reparent(svn_ra_svn_conn_t *conn,
590                               apr_pool_t *pool,
591                               const char *url);
592
593/** Send a "get-latest-rev" command over connection @a conn.
594 * Use @a pool for allocations.
595 *
596 * @see #svn_ra_get_latest_revnum for a description.
597 */
598svn_error_t *
599svn_ra_svn__write_cmd_get_latest_rev(svn_ra_svn_conn_t *conn,
600                                     apr_pool_t *pool);
601
602/** Send a "get-dated-rev" command over connection @a conn.
603 * Use @a pool for allocations.
604 *
605 * @see #svn_ra_get_dated_revision for a description.
606 */
607svn_error_t *
608svn_ra_svn__write_cmd_get_dated_rev(svn_ra_svn_conn_t *conn,
609                                    apr_pool_t *pool,
610                                    apr_time_t tm);
611
612/** Send a "change-rev-prop2" command over connection @a conn.
613 * Use @a pool for allocations.
614 *
615 * If @a dont_care is false then check that the old value matches
616 * @a old_value. If @a dont_care is true then do not check the old
617 * value; in this case @a old_value must be NULL.
618 *
619 * @see #svn_ra_change_rev_prop2 for the rest of the description.
620 */
621svn_error_t *
622svn_ra_svn__write_cmd_change_rev_prop2(svn_ra_svn_conn_t *conn,
623                                       apr_pool_t *pool,
624                                       svn_revnum_t rev,
625                                       const char *name,
626                                       const svn_string_t *value,
627                                       svn_boolean_t dont_care,
628                                       const svn_string_t *old_value);
629
630/** Send a "change-rev-prop" command over connection @a conn.
631 * Use @a pool for allocations.
632 *
633 * @see #svn_ra_change_rev_prop for a description.
634 */
635svn_error_t *
636svn_ra_svn__write_cmd_change_rev_prop(svn_ra_svn_conn_t *conn,
637                                      apr_pool_t *pool,
638                                      svn_revnum_t rev,
639                                      const char *name,
640                                      const svn_string_t *value);
641
642/** Send a "rev-proplist" command over connection @a conn.
643 * Use @a pool for allocations.
644 *
645 * @see #svn_ra_rev_proplist for a description.
646 */
647svn_error_t *
648svn_ra_svn__write_cmd_rev_proplist(svn_ra_svn_conn_t *conn,
649                                   apr_pool_t *pool,
650                                   svn_revnum_t rev);
651
652/** Send a "rev-prop" command over connection @a conn.
653 * Use @a pool for allocations.
654 *
655 * @see #svn_ra_rev_prop for a description.
656 */
657svn_error_t *
658svn_ra_svn__write_cmd_rev_prop(svn_ra_svn_conn_t *conn,
659                               apr_pool_t *pool,
660                               svn_revnum_t rev,
661                               const char *name);
662
663/** Send a "get-file" command over connection @a conn.
664 * Use @a pool for allocations.
665 *
666 * @see #svn_ra_get_file for a description.
667 */
668svn_error_t *
669svn_ra_svn__write_cmd_get_file(svn_ra_svn_conn_t *conn,
670                               apr_pool_t *pool,
671                               const char *path,
672                               svn_revnum_t rev,
673                               svn_boolean_t props,
674                               svn_boolean_t stream);
675
676/** Send a "update" command over connection @a conn.
677 * Use @a pool for allocations.
678 *
679 * @see #svn_ra_do_update3 for a description.
680 */
681svn_error_t *
682svn_ra_svn__write_cmd_update(svn_ra_svn_conn_t *conn,
683                             apr_pool_t *pool,
684                             svn_revnum_t rev,
685                             const char *target,
686                             svn_boolean_t recurse,
687                             svn_depth_t depth,
688                             svn_boolean_t send_copyfrom_args,
689                             svn_boolean_t ignore_ancestry);
690
691/** Send a "switch" command over connection @a conn.
692 * Use @a pool for allocations.
693 *
694 * @see #svn_ra_do_switch3 for a description.
695 */
696svn_error_t *
697svn_ra_svn__write_cmd_switch(svn_ra_svn_conn_t *conn,
698                             apr_pool_t *pool,
699                             svn_revnum_t rev,
700                             const char *target,
701                             svn_boolean_t recurse,
702                             const char *switch_url,
703                             svn_depth_t depth,
704                             svn_boolean_t send_copyfrom_args,
705                             svn_boolean_t ignore_ancestry);
706
707/** Send a "status" command over connection @a conn.
708 * Use @a pool for allocations.
709 *
710 * @see #svn_ra_do_status2 for a description.
711 */
712svn_error_t *
713svn_ra_svn__write_cmd_status(svn_ra_svn_conn_t *conn,
714                             apr_pool_t *pool,
715                             const char *target,
716                             svn_boolean_t recurse,
717                             svn_revnum_t rev,
718                             svn_depth_t depth);
719
720/** Send a "diff" command over connection @a conn.
721 * Use @a pool for allocations.
722 *
723 * @see #svn_ra_do_diff3 for a description.
724 */
725svn_error_t *
726svn_ra_svn__write_cmd_diff(svn_ra_svn_conn_t *conn,
727                           apr_pool_t *pool,
728                           svn_revnum_t rev,
729                           const char *target,
730                           svn_boolean_t recurse,
731                           svn_boolean_t ignore_ancestry,
732                           const char *versus_url,
733                           svn_boolean_t text_deltas,
734                           svn_depth_t depth);
735
736/** Send a "check-path" command over connection @a conn.
737 * Use @a pool for allocations.
738 *
739 * @see #svn_ra_check_path for a description.
740 */
741svn_error_t *
742svn_ra_svn__write_cmd_check_path(svn_ra_svn_conn_t *conn,
743                                 apr_pool_t *pool,
744                                 const char *path,
745                                 svn_revnum_t rev);
746
747/** Send a "stat" command over connection @a conn.
748 * Use @a pool for allocations.
749 *
750 * @see #svn_ra_stat for a description.
751 */
752svn_error_t *
753svn_ra_svn__write_cmd_stat(svn_ra_svn_conn_t *conn,
754                           apr_pool_t *pool,
755                           const char *path,
756                           svn_revnum_t rev);
757
758/** Send a "get-file-revs" command over connection @a conn.
759 * Use @a pool for allocations.
760 *
761 * @see #svn_ra_get_file_revs2 for a description.
762 */
763svn_error_t *
764svn_ra_svn__write_cmd_get_file_revs(svn_ra_svn_conn_t *conn,
765                                    apr_pool_t *pool,
766                                    const char *path,
767                                    svn_revnum_t start,
768                                    svn_revnum_t end,
769                                    svn_boolean_t include_merged_revisions);
770
771/** Send a "lock" command over connection @a conn.
772 * Use @a pool for allocations.
773 *
774 * @see #svn_ra_lock for a description.
775 */
776svn_error_t *
777svn_ra_svn__write_cmd_lock(svn_ra_svn_conn_t *conn,
778                           apr_pool_t *pool,
779                           const char *path,
780                           const char *comment,
781                           svn_boolean_t steal_lock,
782                           svn_revnum_t revnum);
783
784/** Send a "unlock" command over connection @a conn.
785 * Use @a pool for allocations.
786 *
787 * @see #svn_ra_unlock for a description.
788 */
789svn_error_t *
790svn_ra_svn__write_cmd_unlock(svn_ra_svn_conn_t *conn,
791                             apr_pool_t *pool,
792                             const char *path,
793                             const char *token,
794                             svn_boolean_t break_lock);
795
796/** Send a "get-lock" command over connection @a conn.
797 * Use @a pool for allocations.
798 *
799 * @see #svn_ra_get_lock for a description.
800 */
801svn_error_t *
802svn_ra_svn__write_cmd_get_lock(svn_ra_svn_conn_t *conn,
803                               apr_pool_t *pool,
804                               const char *path);
805
806/** Send a "get-locks" command over connection @a conn.
807 * Use @a pool for allocations.
808 *
809 * @see #svn_ra_get_locks2 for a description.
810 */
811svn_error_t *
812svn_ra_svn__write_cmd_get_locks(svn_ra_svn_conn_t *conn,
813                                apr_pool_t *pool,
814                                const char *path,
815                                svn_depth_t depth);
816
817/** Send a "replay" command over connection @a conn.
818 * Use @a pool for allocations.
819 *
820 * @see #svn_ra_replay for a description.
821 */
822svn_error_t *
823svn_ra_svn__write_cmd_replay(svn_ra_svn_conn_t *conn,
824                             apr_pool_t *pool,
825                             svn_revnum_t rev,
826                             svn_revnum_t low_water_mark,
827                             svn_boolean_t send_deltas);
828
829/** Send a "replay-range" command over connection @a conn.
830 * Use @a pool for allocations.
831 *
832 * @see #svn_ra_replay_range for a description.
833 */
834svn_error_t *
835svn_ra_svn__write_cmd_replay_range(svn_ra_svn_conn_t *conn,
836                                   apr_pool_t *pool,
837                                   svn_revnum_t start_revision,
838                                   svn_revnum_t end_revision,
839                                   svn_revnum_t low_water_mark,
840                                   svn_boolean_t send_deltas);
841
842/** Send a "get-deleted-rev" command over connection @a conn.
843 * Use @a pool for allocations.
844 *
845 * @see #svn_ra_get_deleted_rev for a description.
846 */
847svn_error_t *
848svn_ra_svn__write_cmd_get_deleted_rev(svn_ra_svn_conn_t *conn,
849                                      apr_pool_t *pool,
850                                      const char *path,
851                                      svn_revnum_t peg_revision,
852                                      svn_revnum_t end_revision);
853
854/** Send a "get-iprops" command over connection @a conn.
855 * Use @a pool for allocations.
856 *
857 * @see #svn_ra_get_inherited_props for a description.
858 */
859svn_error_t *
860svn_ra_svn__write_cmd_get_iprops(svn_ra_svn_conn_t *conn,
861                                 apr_pool_t *pool,
862                                 const char *path,
863                                 svn_revnum_t revision);
864
865/** Send a "finish-replay" command over connection @a conn.
866 * Use @a pool for allocations.
867 */
868svn_error_t *
869svn_ra_svn__write_cmd_finish_replay(svn_ra_svn_conn_t *conn,
870                                    apr_pool_t *pool);
871
872/**
873 * @}
874 */
875
876/**
877 * @defgroup svn_send_data sending data structures over ra_svn
878 * @{
879 */
880
881/** Send a changed path (as part of transmitting a log entry) over connection
882 * @a conn.  Use @a pool for allocations.
883 *
884 * @see svn_log_changed_path2_t for a description of the other parameters.
885 */
886svn_error_t *
887svn_ra_svn__write_data_log_changed_path(svn_ra_svn_conn_t *conn,
888                                        apr_pool_t *pool,
889                                        const char *path,
890                                        char action,
891                                        const char *copyfrom_path,
892                                        svn_revnum_t copyfrom_rev,
893                                        svn_node_kind_t node_kind,
894                                        svn_boolean_t text_modified,
895                                        svn_boolean_t props_modified);
896
897/** Send a the details of a log entry (as part of transmitting a log entry
898 * and without revprops and changed paths) over connection @a conn.
899 * Use @a pool for allocations.
900 *
901 * @a author, @a date and @a message have been extracted and removed from
902 * the revprops to follow.  @a has_children is taken directly from the
903 * #svn_log_entry_t struct.  @a revision is too, except when it equals
904 * #SVN_INVALID_REVNUM.  In that case, @a revision must be 0 and
905 * @a invalid_revnum be set to TRUE.  @a revprop_count is the number of
906 * revprops that will follow in the revprops list.
907 */
908svn_error_t *
909svn_ra_svn__write_data_log_entry(svn_ra_svn_conn_t *conn,
910                                 apr_pool_t *pool,
911                                 svn_revnum_t revision,
912                                 const svn_string_t *author,
913                                 const svn_string_t *date,
914                                 const svn_string_t *message,
915                                 svn_boolean_t has_children,
916                                 svn_boolean_t invalid_revnum,
917                                 unsigned revprop_count);
918
919/**
920 * @}
921 */
922
923/**
924 * @defgroup svn_read_data reading data structures from ra_svn
925 * @{
926 */
927
928/** Take the data tuple ITEMS received over ra_svn and convert it to the
929 * a changed path (as part of receiving a log entry).
930 *
931 * @see svn_log_changed_path2_t for a description of the output parameters.
932 */
933svn_error_t *
934svn_ra_svn__read_data_log_changed_entry(const apr_array_header_t *items,
935                                        svn_string_t **cpath,
936                                        const char **action,
937                                        const char **copy_path,
938                                        svn_revnum_t *copy_rev,
939                                        const char **kind_str,
940                                        apr_uint64_t *text_mods,
941                                        apr_uint64_t *prop_mods);
942/**
943 * @}
944 */
945
946#ifdef __cplusplus
947}
948#endif /* __cplusplus */
949
950#endif /* SVN_RA_SVN_PRIVATE_H */
951