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