1251881Speter/** 2251881Speter * @copyright 3251881Speter * ==================================================================== 4251881Speter * Licensed to the Apache Software Foundation (ASF) under one 5251881Speter * or more contributor license agreements. See the NOTICE file 6251881Speter * distributed with this work for additional information 7251881Speter * regarding copyright ownership. The ASF licenses this file 8251881Speter * to you under the Apache License, Version 2.0 (the 9251881Speter * "License"); you may not use this file except in compliance 10251881Speter * with the License. You may obtain a copy of the License at 11251881Speter * 12251881Speter * http://www.apache.org/licenses/LICENSE-2.0 13251881Speter * 14251881Speter * Unless required by applicable law or agreed to in writing, 15251881Speter * software distributed under the License is distributed on an 16251881Speter * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 17251881Speter * KIND, either express or implied. See the License for the 18251881Speter * specific language governing permissions and limitations 19251881Speter * under the License. 20251881Speter * ==================================================================== 21251881Speter * @endcopyright 22251881Speter * 23251881Speter * @file svn_ra_svn.h 24251881Speter * @brief libsvn_ra_svn functions used by the server 25251881Speter */ 26251881Speter 27251881Speter#ifndef SVN_RA_SVN_H 28251881Speter#define SVN_RA_SVN_H 29251881Speter 30251881Speter#include <apr.h> 31251881Speter#include <apr_pools.h> 32251881Speter#include <apr_hash.h> 33251881Speter#include <apr_tables.h> 34251881Speter#include <apr_file_io.h> /* for apr_file_t */ 35251881Speter#include <apr_network_io.h> /* for apr_socket_t */ 36251881Speter 37251881Speter#include "svn_types.h" 38251881Speter#include "svn_string.h" 39251881Speter#include "svn_config.h" 40251881Speter#include "svn_delta.h" 41251881Speter 42251881Speter#ifdef __cplusplus 43251881Speterextern "C" { 44251881Speter#endif /* __cplusplus */ 45251881Speter 46251881Speter/** The well-known svn port number. */ 47251881Speter#define SVN_RA_SVN_PORT 3690 48251881Speter 49251881Speter/** Currently-defined capabilities. */ 50251881Speter#define SVN_RA_SVN_CAP_EDIT_PIPELINE "edit-pipeline" 51251881Speter#define SVN_RA_SVN_CAP_SVNDIFF1 "svndiff1" 52362181Sdim#define SVN_RA_SVN_CAP_SVNDIFF2_ACCEPTED "accepts-svndiff2" 53251881Speter#define SVN_RA_SVN_CAP_ABSENT_ENTRIES "absent-entries" 54251881Speter/* maps to SVN_RA_CAPABILITY_COMMIT_REVPROPS: */ 55251881Speter#define SVN_RA_SVN_CAP_COMMIT_REVPROPS "commit-revprops" 56251881Speter/* maps to SVN_RA_CAPABILITY_MERGEINFO: */ 57251881Speter#define SVN_RA_SVN_CAP_MERGEINFO "mergeinfo" 58251881Speter/* maps to SVN_RA_CAPABILITY_DEPTH: */ 59251881Speter#define SVN_RA_SVN_CAP_DEPTH "depth" 60251881Speter/* maps to SVN_RA_CAPABILITY_LOG_REVPROPS */ 61251881Speter#define SVN_RA_SVN_CAP_LOG_REVPROPS "log-revprops" 62251881Speter/* maps to SVN_RA_CAPABILITY_PARTIAL_REPLAY */ 63251881Speter#define SVN_RA_SVN_CAP_PARTIAL_REPLAY "partial-replay" 64251881Speter/* maps to SVN_RA_CAPABILITY_ATOMIC_REVPROPS */ 65251881Speter#define SVN_RA_SVN_CAP_ATOMIC_REVPROPS "atomic-revprops" 66251881Speter/* maps to SVN_RA_CAPABILITY_INHERITED_PROPERTIES: */ 67251881Speter#define SVN_RA_SVN_CAP_INHERITED_PROPS "inherited-props" 68251881Speter/* maps to SVN_RA_CAPABILITY_EPHEMERAL_TXNPROPS */ 69251881Speter#define SVN_RA_SVN_CAP_EPHEMERAL_TXNPROPS "ephemeral-txnprops" 70251881Speter/* maps to SVN_RA_CAPABILITY_GET_FILE_REVS_REVERSE */ 71251881Speter#define SVN_RA_SVN_CAP_GET_FILE_REVS_REVERSE "file-revs-reverse" 72362181Sdim/* maps to SVN_RA_CAPABILITY_LIST */ 73362181Sdim#define SVN_RA_SVN_CAP_LIST "list" 74251881Speter 75251881Speter 76251881Speter/** ra_svn passes @c svn_dirent_t fields over the wire as a list of 77251881Speter * words, these are the values used to represent each field. 78251881Speter * 79251881Speter * @defgroup ra_svn_dirent_fields Definitions of ra_svn dirent fields 80251881Speter * @{ 81251881Speter */ 82251881Speter 83251881Speter/** The ra_svn way of saying @c SVN_DIRENT_KIND. */ 84251881Speter#define SVN_RA_SVN_DIRENT_KIND "kind" 85251881Speter 86251881Speter/** The ra_svn way of saying @c SVN_DIRENT_SIZE. */ 87251881Speter#define SVN_RA_SVN_DIRENT_SIZE "size" 88251881Speter 89251881Speter/** The ra_svn way of saying @c SVN_DIRENT_HAS_PROPS. */ 90251881Speter#define SVN_RA_SVN_DIRENT_HAS_PROPS "has-props" 91251881Speter 92251881Speter/** The ra_svn way of saying @c SVN_DIRENT_CREATED_REV. */ 93251881Speter#define SVN_RA_SVN_DIRENT_CREATED_REV "created-rev" 94251881Speter 95251881Speter/** The ra_svn way of saying @c SVN_DIRENT_TIME. */ 96251881Speter#define SVN_RA_SVN_DIRENT_TIME "time" 97251881Speter 98251881Speter/** The ra_svn way of saying @c SVN_DIRENT_LAST_AUTHOR. */ 99251881Speter#define SVN_RA_SVN_DIRENT_LAST_AUTHOR "last-author" 100251881Speter 101251881Speter/** @} */ 102251881Speter 103251881Speter/** A value used to indicate an optional number element in a tuple that was 104251881Speter * not received. 105251881Speter */ 106251881Speter#define SVN_RA_SVN_UNSPECIFIED_NUMBER ~((apr_uint64_t) 0) 107251881Speter 108251881Speter/** A specialized form of @c SVN_ERR to deal with errors which occur in an 109251881Speter * svn_ra_svn_command_handler(). 110251881Speter * 111251881Speter * An error returned with this macro will be passed back to the other side 112251881Speter * of the connection. Use this macro when performing the requested operation; 113251881Speter * use the regular @c SVN_ERR when performing I/O with the client. 114251881Speter */ 115251881Speter#define SVN_CMD_ERR(expr) \ 116251881Speter do { \ 117251881Speter svn_error_t *svn_err__temp = (expr); \ 118251881Speter if (svn_err__temp) \ 119251881Speter return svn_error_create(SVN_ERR_RA_SVN_CMD_ERR, \ 120251881Speter svn_err__temp, NULL); \ 121251881Speter } while (0) 122251881Speter 123251881Speter/** an ra_svn connection. */ 124251881Spetertypedef struct svn_ra_svn_conn_st svn_ra_svn_conn_t; 125251881Speter 126251881Speter/** Command handler, used by svn_ra_svn_handle_commands(). */ 127251881Spetertypedef svn_error_t *(*svn_ra_svn_command_handler)(svn_ra_svn_conn_t *conn, 128251881Speter apr_pool_t *pool, 129251881Speter apr_array_header_t *params, 130251881Speter void *baton); 131251881Speter 132251881Speter/** Command table, used by svn_ra_svn_handle_commands(). 133251881Speter */ 134251881Spetertypedef struct svn_ra_svn_cmd_entry_t 135251881Speter{ 136251881Speter /** Name of the command */ 137251881Speter const char *cmdname; 138251881Speter 139251881Speter /** Handler for the command */ 140251881Speter svn_ra_svn_command_handler handler; 141251881Speter 142251881Speter /** Termination flag. If set, command-handling will cease after 143251881Speter * command is processed. */ 144251881Speter svn_boolean_t terminate; 145251881Speter} svn_ra_svn_cmd_entry_t; 146251881Speter 147362181Sdim/** Data types defined by the svn:// protocol. 148362181Sdim * 149362181Sdim * @since The typedef name is new in 1.10; the enumerators are not. */ 150362181Sdimtypedef enum 151362181Sdim{ 152362181Sdim SVN_RA_SVN_NUMBER, 153362181Sdim SVN_RA_SVN_STRING, 154362181Sdim SVN_RA_SVN_WORD, 155362181Sdim SVN_RA_SVN_LIST 156362181Sdim} svn_ra_svn_item_kind_t; 157362181Sdim 158251881Speter/** Memory representation of an on-the-wire data item. */ 159251881Spetertypedef struct svn_ra_svn_item_t 160251881Speter{ 161251881Speter /** Variant indicator. */ 162362181Sdim svn_ra_svn_item_kind_t kind; 163362181Sdim 164251881Speter /** Variant data. */ 165251881Speter union { 166251881Speter apr_uint64_t number; 167251881Speter svn_string_t *string; 168251881Speter const char *word; 169251881Speter 170251881Speter /** Contains @c svn_ra_svn_item_t's. */ 171251881Speter apr_array_header_t *list; 172251881Speter } u; 173251881Speter} svn_ra_svn_item_t; 174251881Speter 175251881Spetertypedef svn_error_t *(*svn_ra_svn_edit_callback)(void *baton); 176251881Speter 177251881Speter/** Initialize a connection structure for the given socket or 178289180Speter * input/output streams. 179251881Speter * 180289180Speter * Either @a sock or @a in_stream/@a out_stream must be set, not both. 181251881Speter * @a compression_level specifies the desired network data compression 182362181Sdim * level from 0 (no compression) to 9 (best but slowest). The effect 183362181Sdim * of the parameter depends on the compression algorithm; for example, 184362181Sdim * it is used verbatim by zlib/deflate but ignored by LZ4. 185251881Speter * 186251881Speter * If @a zero_copy_limit is not 0, cached file contents smaller than the 187251881Speter * given limit may be sent directly to the network socket. Otherwise, 188251881Speter * it will be copied into a temporary buffer before being forwarded to 189251881Speter * the network stack. Since the zero-copy code path has to enforce strict 190251881Speter * time-outs, the receiver must be able to process @a zero_copy_limit 191251881Speter * bytes within one second. Even temporary failure to do so may cause 192251881Speter * the server to cancel the respective operation with a time-out error. 193251881Speter * 194251881Speter * To reduce the overhead of checking for cancellation requests from the 195251881Speter * data receiver, set @a error_check_interval to some non-zero value. 196251881Speter * It defines the number of bytes that must have been sent since the last 197251881Speter * check before the next check will be made. 198251881Speter * 199362181Sdim * If @a max_in is not 0, error out and close the connection whenever more 200362181Sdim * than @a max_in bytes are received for a command (e.g. a client request). 201362181Sdim * If @a max_out is not 0, error out and close the connection whenever more 202362181Sdim * than @a max_out bytes have been send as response to some command. 203362181Sdim * 204362181Sdim * @note The limits enforced may vary slightly by +/- the I/O buffer size. 205362181Sdim * 206289180Speter * @note If @a out_stream is an wrapped apr_file_t* the backing file will be 207289180Speter * used for some operations. 208289180Speter * 209251881Speter * Allocate the result in @a pool. 210251881Speter * 211362181Sdim * @since New in 1.10 212362181Sdim */ 213362181Sdimsvn_ra_svn_conn_t *svn_ra_svn_create_conn5(apr_socket_t *sock, 214362181Sdim svn_stream_t *in_stream, 215362181Sdim svn_stream_t *out_stream, 216362181Sdim int compression_level, 217362181Sdim apr_size_t zero_copy_limit, 218362181Sdim apr_size_t error_check_interval, 219362181Sdim apr_uint64_t max_in, 220362181Sdim apr_uint64_t max_out, 221362181Sdim apr_pool_t *result_pool); 222362181Sdim 223362181Sdim 224362181Sdim/** Similar to svn_ra_svn_create_conn5() but with @a max_in and @a max_out 225362181Sdim * set to 0. 226362181Sdim * 227289180Speter * @since New in 1.9 228362181Sdim * @deprecated Provided for backward compatibility with the 1.9 API. 229289180Speter */ 230362181SdimSVN_DEPRECATED 231289180Spetersvn_ra_svn_conn_t *svn_ra_svn_create_conn4(apr_socket_t *sock, 232289180Speter svn_stream_t *in_stream, 233289180Speter svn_stream_t *out_stream, 234289180Speter int compression_level, 235289180Speter apr_size_t zero_copy_limit, 236289180Speter apr_size_t error_check_interval, 237289180Speter apr_pool_t *result_pool); 238289180Speter 239289180Speter 240289180Speter/** Similar to svn_ra_svn_create_conn4() but only supports apr_file_t handles 241289180Speter * instead of the more generic streams. 242289180Speter * 243251881Speter * @since New in 1.8 244289180Speter * @deprecated Provided for backward compatibility with the 1.8 API. 245251881Speter */ 246289180SpeterSVN_DEPRECATED 247251881Spetersvn_ra_svn_conn_t *svn_ra_svn_create_conn3(apr_socket_t *sock, 248251881Speter apr_file_t *in_file, 249251881Speter apr_file_t *out_file, 250251881Speter int compression_level, 251251881Speter apr_size_t zero_copy_limit, 252251881Speter apr_size_t error_check_interval, 253251881Speter apr_pool_t *pool); 254251881Speter 255251881Speter/** Similar to svn_ra_svn_create_conn3() but disables the zero copy code 256251881Speter * path and sets the error checking interval to 0. 257251881Speter * 258251881Speter * @since New in 1.7. 259251881Speter * 260251881Speter * @deprecated Provided for backward compatibility with the 1.7 API. 261251881Speter */ 262251881SpeterSVN_DEPRECATED 263251881Spetersvn_ra_svn_conn_t * 264251881Spetersvn_ra_svn_create_conn2(apr_socket_t *sock, 265251881Speter apr_file_t *in_file, 266251881Speter apr_file_t *out_file, 267251881Speter int compression_level, 268251881Speter apr_pool_t *pool); 269251881Speter 270251881Speter/** Similar to svn_ra_svn_create_conn2() but uses the default 271251881Speter * compression level (#SVN_DELTA_COMPRESSION_LEVEL_DEFAULT) for network 272251881Speter * transmissions. 273251881Speter * 274251881Speter * @deprecated Provided for backward compatibility with the 1.6 API. 275251881Speter */ 276251881SpeterSVN_DEPRECATED 277251881Spetersvn_ra_svn_conn_t * 278251881Spetersvn_ra_svn_create_conn(apr_socket_t *sock, 279251881Speter apr_file_t *in_file, 280251881Speter apr_file_t *out_file, 281251881Speter apr_pool_t *pool); 282251881Speter 283251881Speter/** Add the capabilities in @a list to @a conn's capabilities. 284251881Speter * @a list contains svn_ra_svn_item_t entries (which should be of type 285251881Speter * SVN_RA_SVN_WORD; a malformed data error will result if any are not). 286251881Speter * 287251881Speter * This is idempotent: if a given capability was already set for 288251881Speter * @a conn, it remains set. 289251881Speter */ 290251881Spetersvn_error_t * 291251881Spetersvn_ra_svn_set_capabilities(svn_ra_svn_conn_t *conn, 292251881Speter const apr_array_header_t *list); 293251881Speter 294251881Speter/** Return @c TRUE if @a conn has the capability @a capability, or 295251881Speter * @c FALSE if it does not. */ 296251881Spetersvn_boolean_t 297251881Spetersvn_ra_svn_has_capability(svn_ra_svn_conn_t *conn, 298251881Speter const char *capability); 299251881Speter 300251881Speter/** Return the data compression level to use for network transmissions. 301251881Speter * 302251881Speter * @since New in 1.7. 303251881Speter */ 304251881Speterint 305251881Spetersvn_ra_svn_compression_level(svn_ra_svn_conn_t *conn); 306251881Speter 307251881Speter/** Return the zero-copy data block limit to use for network 308251881Speter * transmissions. 309251881Speter * 310251881Speter * @see http://en.wikipedia.org/wiki/Zero-copy 311251881Speter * 312251881Speter * @since New in 1.8. 313251881Speter */ 314251881Speterapr_size_t 315251881Spetersvn_ra_svn_zero_copy_limit(svn_ra_svn_conn_t *conn); 316251881Speter 317251881Speter/** Returns the remote address of the connection as a string, if known, 318251881Speter * or NULL if inapplicable. */ 319251881Speterconst char * 320251881Spetersvn_ra_svn_conn_remote_host(svn_ra_svn_conn_t *conn); 321251881Speter 322251881Speter/** Set @a *editor and @a *edit_baton to an editor which will pass editing 323251881Speter * operations over the network, using @a conn and @a pool. 324251881Speter * 325251881Speter * Upon successful completion of the edit, the editor will invoke @a callback 326251881Speter * with @a callback_baton as an argument. 327289180Speter * 328289180Speter * @note The @c copyfrom_path parameter passed to the @c add_file and 329289180Speter * @c add_directory methods of the returned editor may be either a URL or a 330289180Speter * relative path, and is transferred verbatim to the receiving end of the 331289180Speter * connection. See svn_ra_svn_drive_editor2() for information on the 332289180Speter * receiving end of the connection. 333251881Speter */ 334251881Spetervoid 335251881Spetersvn_ra_svn_get_editor(const svn_delta_editor_t **editor, 336251881Speter void **edit_baton, 337251881Speter svn_ra_svn_conn_t *conn, 338251881Speter apr_pool_t *pool, 339251881Speter svn_ra_svn_edit_callback callback, 340251881Speter void *callback_baton); 341251881Speter 342251881Speter/** Receive edit commands over the network and use them to drive @a editor 343251881Speter * with @a edit_baton. On return, @a *aborted will be set if the edit was 344251881Speter * aborted. The drive can be terminated with a finish-replay command only 345251881Speter * if @a for_replay is TRUE. 346251881Speter * 347251881Speter * @since New in 1.4. 348289180Speter * 349289180Speter * @note The @c copyfrom_path parameter passed to the @c add_file and 350289180Speter * @c add_directory methods of the receiving editor will be canonicalized 351289180Speter * either as a URL or as a relative path (starting with a slash) according 352289180Speter * to which kind was sent by the driving end of the connection. See 353289180Speter * svn_ra_svn_get_editor() for information on the driving end of the 354289180Speter * connection. 355251881Speter */ 356251881Spetersvn_error_t * 357251881Spetersvn_ra_svn_drive_editor2(svn_ra_svn_conn_t *conn, 358251881Speter apr_pool_t *pool, 359251881Speter const svn_delta_editor_t *editor, 360251881Speter void *edit_baton, 361251881Speter svn_boolean_t *aborted, 362251881Speter svn_boolean_t for_replay); 363251881Speter 364251881Speter/** Like svn_ra_svn_drive_editor2, but with @a for_replay always FALSE. 365251881Speter * 366251881Speter * @deprecated Provided for backward compatibility with the 1.3 API. 367251881Speter */ 368251881SpeterSVN_DEPRECATED 369251881Spetersvn_error_t * 370251881Spetersvn_ra_svn_drive_editor(svn_ra_svn_conn_t *conn, 371251881Speter apr_pool_t *pool, 372251881Speter const svn_delta_editor_t *editor, 373251881Speter void *edit_baton, 374251881Speter svn_boolean_t *aborted); 375251881Speter 376251881Speter/** This function is only intended for use by svnserve. 377251881Speter * 378251881Speter * Perform CRAM-MD5 password authentication. On success, return 379251881Speter * SVN_NO_ERROR with *user set to the username and *success set to 380251881Speter * TRUE. On an error which can be reported to the client, report the 381251881Speter * error and return SVN_NO_ERROR with *success set to FALSE. On 382251881Speter * communications failure, return an error. 383251881Speter */ 384251881Spetersvn_error_t * 385251881Spetersvn_ra_svn_cram_server(svn_ra_svn_conn_t *conn, 386251881Speter apr_pool_t *pool, 387251881Speter svn_config_t *pwdb, 388251881Speter const char **user, 389251881Speter svn_boolean_t *success); 390251881Speter 391251881Speter/** 392251881Speter * Get libsvn_ra_svn version information. 393251881Speter * @since New in 1.1. 394251881Speter */ 395251881Speterconst svn_version_t * 396251881Spetersvn_ra_svn_version(void); 397251881Speter 398251881Speter/** 399251881Speter * @defgroup ra_svn_deprecated ra_svn low-level functions 400251881Speter * @{ 401251881Speter */ 402251881Speter 403251881Speter/** Write a number over the net. 404251881Speter * 405251881Speter * Writes will be buffered until the next read or flush. 406251881Speter * 407251881Speter * @deprecated Provided for backward compatibility with the 1.7 API. 408251881Speter * RA_SVN low-level functions are no longer considered public. 409251881Speter */ 410251881SpeterSVN_DEPRECATED 411251881Spetersvn_error_t * 412251881Spetersvn_ra_svn_write_number(svn_ra_svn_conn_t *conn, 413251881Speter apr_pool_t *pool, 414251881Speter apr_uint64_t number); 415251881Speter 416251881Speter/** Write a string over the net. 417251881Speter * 418251881Speter * Writes will be buffered until the next read or flush. 419251881Speter * 420251881Speter * @deprecated Provided for backward compatibility with the 1.7 API. 421251881Speter * RA_SVN low-level functions are no longer considered public. 422251881Speter */ 423251881SpeterSVN_DEPRECATED 424251881Spetersvn_error_t * 425251881Spetersvn_ra_svn_write_string(svn_ra_svn_conn_t *conn, 426251881Speter apr_pool_t *pool, 427251881Speter const svn_string_t *str); 428251881Speter 429251881Speter/** Write a cstring over the net. 430251881Speter * 431251881Speter * Writes will be buffered until the next read or flush. 432251881Speter * 433251881Speter * @deprecated Provided for backward compatibility with the 1.7 API. 434251881Speter * RA_SVN low-level functions are no longer considered public. 435251881Speter */ 436251881SpeterSVN_DEPRECATED 437251881Spetersvn_error_t * 438251881Spetersvn_ra_svn_write_cstring(svn_ra_svn_conn_t *conn, 439251881Speter apr_pool_t *pool, 440251881Speter const char *s); 441251881Speter 442251881Speter/** Write a word over the net. 443251881Speter * 444251881Speter * Writes will be buffered until the next read or flush. 445251881Speter * 446251881Speter * @deprecated Provided for backward compatibility with the 1.7 API. 447251881Speter * RA_SVN low-level functions are no longer considered public. 448251881Speter */ 449251881SpeterSVN_DEPRECATED 450251881Spetersvn_error_t * 451251881Spetersvn_ra_svn_write_word(svn_ra_svn_conn_t *conn, 452251881Speter apr_pool_t *pool, 453251881Speter const char *word); 454251881Speter 455251881Speter/** Write a list of properties over the net. @a props is allowed to be NULL, 456251881Speter * in which case an empty list will be written out. 457251881Speter * 458251881Speter * @since New in 1.5. 459251881Speter * 460251881Speter * @deprecated Provided for backward compatibility with the 1.7 API. 461251881Speter * RA_SVN low-level functions are no longer considered public. 462251881Speter */ 463251881SpeterSVN_DEPRECATED 464251881Spetersvn_error_t * 465251881Spetersvn_ra_svn_write_proplist(svn_ra_svn_conn_t *conn, 466251881Speter apr_pool_t *pool, 467251881Speter apr_hash_t *props); 468251881Speter 469251881Speter/** Begin a list. Writes will be buffered until the next read or flush. 470251881Speter * 471251881Speter * @deprecated Provided for backward compatibility with the 1.7 API. 472251881Speter * RA_SVN low-level functions are no longer considered public. 473251881Speter */ 474251881SpeterSVN_DEPRECATED 475251881Spetersvn_error_t * 476251881Spetersvn_ra_svn_start_list(svn_ra_svn_conn_t *conn, 477251881Speter apr_pool_t *pool); 478251881Speter 479251881Speter/** End a list. Writes will be buffered until the next read or flush. 480251881Speter * 481251881Speter * @deprecated Provided for backward compatibility with the 1.7 API. 482251881Speter * RA_SVN low-level functions are no longer considered public. 483251881Speter */ 484251881SpeterSVN_DEPRECATED 485251881Spetersvn_error_t * 486251881Spetersvn_ra_svn_end_list(svn_ra_svn_conn_t *conn, 487251881Speter apr_pool_t *pool); 488251881Speter 489251881Speter/** Flush the write buffer. 490251881Speter * 491251881Speter * Normally this shouldn't be necessary, since the write buffer is flushed 492251881Speter * when a read is attempted. 493251881Speter * 494251881Speter * @deprecated Provided for backward compatibility with the 1.7 API. 495251881Speter * RA_SVN low-level functions are no longer considered public. 496251881Speter */ 497251881SpeterSVN_DEPRECATED 498251881Spetersvn_error_t * 499251881Spetersvn_ra_svn_flush(svn_ra_svn_conn_t *conn, 500251881Speter apr_pool_t *pool); 501251881Speter 502251881Speter/** Write a tuple, using a printf-like interface. 503251881Speter * 504251881Speter * The format string @a fmt may contain: 505251881Speter * 506251881Speter *@verbatim 507251881Speter Spec Argument type Item type 508251881Speter ---- -------------------- --------- 509251881Speter n apr_uint64_t Number 510251881Speter r svn_revnum_t Number 511251881Speter s const svn_string_t * String 512251881Speter c const char * String 513251881Speter w const char * Word 514251881Speter b svn_boolean_t Word ("true" or "false") 515251881Speter ( Begin tuple 516251881Speter ) End tuple 517251881Speter ? Remaining elements optional 518251881Speter ! (at beginning or end) Suppress opening or closing of tuple 519251881Speter @endverbatim 520251881Speter * 521251881Speter * Inside the optional part of a tuple, 'r' values may be @c 522251881Speter * SVN_INVALID_REVNUM, 'n' values may be 523251881Speter * SVN_RA_SVN_UNSPECIFIED_NUMBER, and 's', 'c', and 'w' values may be 524251881Speter * @c NULL; in these cases no data will be written. 'b' and '(' may 525251881Speter * not appear in the optional part of a tuple. Either all or none of 526251881Speter * the optional values should be valid. 527251881Speter * 528251881Speter * (If we ever have a need for an optional boolean value, we should 529251881Speter * invent a 'B' specifier which stores a boolean into an int, using -1 530251881Speter * for unspecified. Right now there is no need for such a thing.) 531251881Speter * 532251881Speter * Use the '!' format specifier to write partial tuples when you have 533251881Speter * to transmit an array or other unusual data. For example, to write 534251881Speter * a tuple containing a revision, an array of words, and a boolean: 535251881Speter * @code 536251881Speter SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "r(!", rev)); 537251881Speter for (i = 0; i < n; i++) 538251881Speter SVN_ERR(svn_ra_svn_write_word(conn, pool, words[i])); 539251881Speter SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "!)b", flag)); @endcode 540251881Speter * 541251881Speter * @deprecated Provided for backward compatibility with the 1.7 API. 542251881Speter * RA_SVN low-level functions are no longer considered public. 543251881Speter */ 544251881SpeterSVN_DEPRECATED 545251881Spetersvn_error_t * 546251881Spetersvn_ra_svn_write_tuple(svn_ra_svn_conn_t *conn, 547251881Speter apr_pool_t *pool, 548251881Speter const char *fmt, ...); 549251881Speter 550251881Speter/** Read an item from the network into @a *item. 551251881Speter * 552251881Speter * @deprecated Provided for backward compatibility with the 1.7 API. 553251881Speter * RA_SVN low-level functions are no longer considered public. 554251881Speter */ 555251881SpeterSVN_DEPRECATED 556251881Spetersvn_error_t * 557251881Spetersvn_ra_svn_read_item(svn_ra_svn_conn_t *conn, 558251881Speter apr_pool_t *pool, 559251881Speter svn_ra_svn_item_t **item); 560251881Speter 561251881Speter/** Scan data on @a conn until we find something which looks like the 562251881Speter * beginning of an svn server greeting (an open paren followed by a 563251881Speter * whitespace character). This function is appropriate for beginning 564251881Speter * a client connection opened in tunnel mode, since people's dotfiles 565251881Speter * sometimes write output to stdout. It may only be called at the 566251881Speter * beginning of a client connection. 567251881Speter * 568251881Speter * @deprecated Provided for backward compatibility with the 1.7 API. 569251881Speter * RA_SVN low-level functions are no longer considered public. 570251881Speter */ 571251881SpeterSVN_DEPRECATED 572251881Spetersvn_error_t * 573251881Spetersvn_ra_svn_skip_leading_garbage(svn_ra_svn_conn_t *conn, 574251881Speter apr_pool_t *pool); 575251881Speter 576251881Speter/** Parse an array of @c svn_sort__item_t structures as a tuple, using a 577251881Speter * printf-like interface. The format string @a fmt may contain: 578251881Speter * 579251881Speter *@verbatim 580251881Speter Spec Argument type Item type 581251881Speter ---- -------------------- --------- 582251881Speter n apr_uint64_t * Number 583251881Speter r svn_revnum_t * Number 584251881Speter s svn_string_t ** String 585251881Speter c const char ** String 586251881Speter w const char ** Word 587251881Speter b svn_boolean_t * Word ("true" or "false") 588251881Speter B apr_uint64_t * Word ("true" or "false") 589251881Speter l apr_array_header_t ** List 590251881Speter ( Begin tuple 591251881Speter ) End tuple 592251881Speter ? Tuple is allowed to end here 593251881Speter @endverbatim 594251881Speter * 595251881Speter * Note that a tuple is only allowed to end precisely at a '?', or at 596251881Speter * the end of the specification. So if @a fmt is "c?cc" and @a list 597251881Speter * contains two elements, an error will result. 598251881Speter * 599251881Speter * 'B' is similar to 'b', but may be used in the optional tuple specification. 600251881Speter * It returns TRUE, FALSE, or SVN_RA_SVN_UNSPECIFIED_NUMBER. 601251881Speter * 602251881Speter * If an optional part of a tuple contains no data, 'r' values will be 603251881Speter * set to @c SVN_INVALID_REVNUM, 'n' and 'B' values will be set to 604251881Speter * SVN_RA_SVN_UNSPECIFIED_NUMBER, and 's', 'c', 'w', and 'l' values 605251881Speter * will be set to @c NULL. 'b' may not appear inside an optional 606251881Speter * tuple specification; use 'B' instead. 607251881Speter * 608251881Speter * @deprecated Provided for backward compatibility with the 1.7 API. 609251881Speter * RA_SVN low-level functions are no longer considered public. 610251881Speter */ 611251881SpeterSVN_DEPRECATED 612251881Spetersvn_error_t * 613251881Spetersvn_ra_svn_parse_tuple(const apr_array_header_t *list, 614251881Speter apr_pool_t *pool, 615251881Speter const char *fmt, ...); 616251881Speter 617251881Speter/** Read a tuple from the network and parse it as a tuple, using the 618251881Speter * format string notation from svn_ra_svn_parse_tuple(). 619251881Speter * 620251881Speter * @deprecated Provided for backward compatibility with the 1.7 API. 621251881Speter * RA_SVN low-level functions are no longer considered public. 622251881Speter */ 623251881SpeterSVN_DEPRECATED 624251881Spetersvn_error_t * 625251881Spetersvn_ra_svn_read_tuple(svn_ra_svn_conn_t *conn, 626251881Speter apr_pool_t *pool, 627251881Speter const char *fmt, ...); 628251881Speter 629251881Speter/** Parse an array of @c svn_ra_svn_item_t structures as a list of 630251881Speter * properties, storing the properties in a hash table. 631251881Speter * 632251881Speter * @since New in 1.5. 633251881Speter * 634251881Speter * @deprecated Provided for backward compatibility with the 1.7 API. 635251881Speter * RA_SVN low-level functions are no longer considered public. 636251881Speter */ 637251881SpeterSVN_DEPRECATED 638251881Spetersvn_error_t * 639251881Spetersvn_ra_svn_parse_proplist(const apr_array_header_t *list, 640251881Speter apr_pool_t *pool, 641251881Speter apr_hash_t **props); 642251881Speter 643251881Speter/** Read a command response from the network and parse it as a tuple, using 644251881Speter * the format string notation from svn_ra_svn_parse_tuple(). 645251881Speter * 646251881Speter * @deprecated Provided for backward compatibility with the 1.7 API. 647251881Speter * RA_SVN low-level functions are no longer considered public. 648251881Speter */ 649251881SpeterSVN_DEPRECATED 650251881Spetersvn_error_t * 651251881Spetersvn_ra_svn_read_cmd_response(svn_ra_svn_conn_t *conn, 652251881Speter apr_pool_t *pool, 653251881Speter const char *fmt, ...); 654251881Speter 655251881Speter/** Accept commands over the network and handle them according to @a 656251881Speter * commands. Command handlers will be passed @a conn, a subpool of @a 657251881Speter * pool (cleared after each command is handled), the parameters of the 658251881Speter * command, and @a baton. Commands will be accepted until a 659251881Speter * terminating command is received (a command with "terminate" set in 660251881Speter * the command table). If a command handler returns an error wrapped 661251881Speter * in SVN_RA_SVN_CMD_ERR (see the @c SVN_CMD_ERR macro), the error 662251881Speter * will be reported to the other side of the connection and the 663251881Speter * command loop will continue; any other kind of error (typically a 664251881Speter * network or protocol error) is passed through to the caller. 665251881Speter * 666251881Speter * @since New in 1.6. 667251881Speter * 668251881Speter * @deprecated Provided for backward compatibility with the 1.7 API. 669251881Speter * RA_SVN low-level functions are no longer considered public. 670251881Speter */ 671251881SpeterSVN_DEPRECATED 672251881Spetersvn_error_t * 673251881Spetersvn_ra_svn_handle_commands2(svn_ra_svn_conn_t *conn, 674251881Speter apr_pool_t *pool, 675251881Speter const svn_ra_svn_cmd_entry_t *commands, 676251881Speter void *baton, 677251881Speter svn_boolean_t error_on_disconnect); 678251881Speter 679251881Speter/** Similar to svn_ra_svn_handle_commands2 but @a error_on_disconnect 680251881Speter * is always @c FALSE. 681251881Speter * 682251881Speter * @deprecated Provided for backward compatibility with the 1.5 API. 683251881Speter */ 684251881SpeterSVN_DEPRECATED 685251881Spetersvn_error_t * 686251881Spetersvn_ra_svn_handle_commands(svn_ra_svn_conn_t *conn, 687251881Speter apr_pool_t *pool, 688251881Speter const svn_ra_svn_cmd_entry_t *commands, 689251881Speter void *baton); 690251881Speter 691251881Speter/** Write a command over the network, using the same format string notation 692251881Speter * as svn_ra_svn_write_tuple(). 693251881Speter * 694251881Speter * @deprecated Provided for backward compatibility with the 1.7 API. 695251881Speter * RA_SVN low-level functions are no longer considered public. 696251881Speter */ 697251881SpeterSVN_DEPRECATED 698251881Spetersvn_error_t * 699251881Spetersvn_ra_svn_write_cmd(svn_ra_svn_conn_t *conn, 700251881Speter apr_pool_t *pool, 701251881Speter const char *cmdname, 702251881Speter const char *fmt, ...); 703251881Speter 704251881Speter/** Write a successful command response over the network, using the 705251881Speter * same format string notation as svn_ra_svn_write_tuple(). Do not use 706251881Speter * partial tuples with this function; if you need to use partial 707251881Speter * tuples, just write out the "success" and argument tuple by hand. 708251881Speter * 709251881Speter * @deprecated Provided for backward compatibility with the 1.7 API. 710251881Speter * RA_SVN low-level functions are no longer considered public. 711251881Speter */ 712251881SpeterSVN_DEPRECATED 713251881Spetersvn_error_t * 714251881Spetersvn_ra_svn_write_cmd_response(svn_ra_svn_conn_t *conn, 715251881Speter apr_pool_t *pool, 716251881Speter const char *fmt, ...); 717251881Speter 718251881Speter/** Write an unsuccessful command response over the network. 719251881Speter * 720251881Speter * @deprecated Provided for backward compatibility with the 1.7 API. 721251881Speter * RA_SVN low-level functions are no longer considered public. 722251881Speter */ 723251881SpeterSVN_DEPRECATED 724251881Spetersvn_error_t * 725251881Spetersvn_ra_svn_write_cmd_failure(svn_ra_svn_conn_t *conn, 726251881Speter apr_pool_t *pool, 727251881Speter svn_error_t *err); 728251881Speter 729251881Speter/** 730251881Speter * @} 731251881Speter */ 732251881Speter 733251881Speter#ifdef __cplusplus 734251881Speter} 735251881Speter#endif /* __cplusplus */ 736251881Speter 737251881Speter#endif /* SVN_RA_SVN_H */ 738