Subversion
Data Structures | Macros | Typedefs | Enumerations | Functions
svn_ra_svn.h File Reference

libsvn_ra_svn functions used by the server More...

#include <apr.h>
#include <apr_pools.h>
#include <apr_hash.h>
#include <apr_tables.h>
#include <apr_file_io.h>
#include <apr_network_io.h>
#include "svn_types.h"
#include "svn_string.h"
#include "svn_config.h"
#include "svn_delta.h"

Go to the source code of this file.

Data Structures

struct  svn_ra_svn_cmd_entry_t
 Command table, used by svn_ra_svn_handle_commands(). More...
 
struct  svn_ra_svn_item_t
 Memory representation of an on-the-wire data item. More...
 

Macros

#define SVN_RA_SVN_PORT   3690
 The well-known svn port number.
 
#define SVN_RA_SVN_CAP_EDIT_PIPELINE   "edit-pipeline"
 Currently-defined capabilities.
 
#define SVN_RA_SVN_CAP_SVNDIFF1   "svndiff1"
 
#define SVN_RA_SVN_CAP_SVNDIFF2_ACCEPTED   "accepts-svndiff2"
 
#define SVN_RA_SVN_CAP_ABSENT_ENTRIES   "absent-entries"
 
#define SVN_RA_SVN_CAP_COMMIT_REVPROPS   "commit-revprops"
 
#define SVN_RA_SVN_CAP_MERGEINFO   "mergeinfo"
 
#define SVN_RA_SVN_CAP_DEPTH   "depth"
 
#define SVN_RA_SVN_CAP_LOG_REVPROPS   "log-revprops"
 
#define SVN_RA_SVN_CAP_PARTIAL_REPLAY   "partial-replay"
 
#define SVN_RA_SVN_CAP_ATOMIC_REVPROPS   "atomic-revprops"
 
#define SVN_RA_SVN_CAP_INHERITED_PROPS   "inherited-props"
 
#define SVN_RA_SVN_CAP_EPHEMERAL_TXNPROPS   "ephemeral-txnprops"
 
#define SVN_RA_SVN_CAP_GET_FILE_REVS_REVERSE   "file-revs-reverse"
 
#define SVN_RA_SVN_CAP_LIST   "list"
 
#define SVN_RA_SVN_DIRENT_KIND   "kind"
 The ra_svn way of saying SVN_DIRENT_KIND.
 
#define SVN_RA_SVN_DIRENT_SIZE   "size"
 The ra_svn way of saying SVN_DIRENT_SIZE.
 
#define SVN_RA_SVN_DIRENT_HAS_PROPS   "has-props"
 The ra_svn way of saying SVN_DIRENT_HAS_PROPS.
 
#define SVN_RA_SVN_DIRENT_CREATED_REV   "created-rev"
 The ra_svn way of saying SVN_DIRENT_CREATED_REV.
 
#define SVN_RA_SVN_DIRENT_TIME   "time"
 The ra_svn way of saying SVN_DIRENT_TIME.
 
#define SVN_RA_SVN_DIRENT_LAST_AUTHOR   "last-author"
 The ra_svn way of saying SVN_DIRENT_LAST_AUTHOR.
 
#define SVN_RA_SVN_UNSPECIFIED_NUMBER   ~((apr_uint64_t) 0)
 A value used to indicate an optional number element in a tuple that was not received.
 
#define SVN_CMD_ERR(expr)
 A specialized form of SVN_ERR to deal with errors which occur in an svn_ra_svn_command_handler(). More...
 

Typedefs

typedef struct svn_ra_svn_conn_st svn_ra_svn_conn_t
 an ra_svn connection.
 
typedef svn_error_t *(* svn_ra_svn_command_handler) (svn_ra_svn_conn_t *conn, apr_pool_t *pool, apr_array_header_t *params, void *baton)
 Command handler, used by svn_ra_svn_handle_commands().
 
typedef struct svn_ra_svn_cmd_entry_t svn_ra_svn_cmd_entry_t
 Command table, used by svn_ra_svn_handle_commands().
 
typedef struct svn_ra_svn_item_t svn_ra_svn_item_t
 Memory representation of an on-the-wire data item.
 
typedef svn_error_t *(* svn_ra_svn_edit_callback) (void *baton)
 

Enumerations

enum  svn_ra_svn_item_kind_t {
  SVN_RA_SVN_NUMBER,
  SVN_RA_SVN_STRING,
  SVN_RA_SVN_WORD,
  SVN_RA_SVN_LIST
}
 Data types defined by the svn:// protocol. More...
 

Functions

svn_ra_svn_conn_tsvn_ra_svn_create_conn5 (apr_socket_t *sock, svn_stream_t *in_stream, svn_stream_t *out_stream, int compression_level, apr_size_t zero_copy_limit, apr_size_t error_check_interval, apr_uint64_t max_in, apr_uint64_t max_out, apr_pool_t *result_pool)
 Initialize a connection structure for the given socket or input/output streams. More...
 
svn_ra_svn_conn_tsvn_ra_svn_create_conn4 (apr_socket_t *sock, svn_stream_t *in_stream, svn_stream_t *out_stream, int compression_level, apr_size_t zero_copy_limit, apr_size_t error_check_interval, apr_pool_t *result_pool)
 Similar to svn_ra_svn_create_conn5() but with max_in and max_out set to 0. More...
 
svn_ra_svn_conn_tsvn_ra_svn_create_conn3 (apr_socket_t *sock, apr_file_t *in_file, apr_file_t *out_file, int compression_level, apr_size_t zero_copy_limit, apr_size_t error_check_interval, apr_pool_t *pool)
 Similar to svn_ra_svn_create_conn4() but only supports apr_file_t handles instead of the more generic streams. More...
 
svn_ra_svn_conn_tsvn_ra_svn_create_conn2 (apr_socket_t *sock, apr_file_t *in_file, apr_file_t *out_file, int compression_level, apr_pool_t *pool)
 Similar to svn_ra_svn_create_conn3() but disables the zero copy code path and sets the error checking interval to 0. More...
 
svn_ra_svn_conn_tsvn_ra_svn_create_conn (apr_socket_t *sock, apr_file_t *in_file, apr_file_t *out_file, apr_pool_t *pool)
 Similar to svn_ra_svn_create_conn2() but uses the default compression level (SVN_DELTA_COMPRESSION_LEVEL_DEFAULT) for network transmissions. More...
 
svn_error_tsvn_ra_svn_set_capabilities (svn_ra_svn_conn_t *conn, const apr_array_header_t *list)
 Add the capabilities in list to conn's capabilities. More...
 
svn_boolean_t svn_ra_svn_has_capability (svn_ra_svn_conn_t *conn, const char *capability)
 Return TRUE if conn has the capability capability, or FALSE if it does not.
 
int svn_ra_svn_compression_level (svn_ra_svn_conn_t *conn)
 Return the data compression level to use for network transmissions. More...
 
apr_size_t svn_ra_svn_zero_copy_limit (svn_ra_svn_conn_t *conn)
 Return the zero-copy data block limit to use for network transmissions. More...
 
const char * svn_ra_svn_conn_remote_host (svn_ra_svn_conn_t *conn)
 Returns the remote address of the connection as a string, if known, or NULL if inapplicable.
 
void svn_ra_svn_get_editor (const svn_delta_editor_t **editor, void **edit_baton, svn_ra_svn_conn_t *conn, apr_pool_t *pool, svn_ra_svn_edit_callback callback, void *callback_baton)
 Set *editor and *edit_baton to an editor which will pass editing operations over the network, using conn and pool. More...
 
svn_error_tsvn_ra_svn_drive_editor2 (svn_ra_svn_conn_t *conn, apr_pool_t *pool, const svn_delta_editor_t *editor, void *edit_baton, svn_boolean_t *aborted, svn_boolean_t for_replay)
 Receive edit commands over the network and use them to drive editor with edit_baton. More...
 
svn_error_tsvn_ra_svn_drive_editor (svn_ra_svn_conn_t *conn, apr_pool_t *pool, const svn_delta_editor_t *editor, void *edit_baton, svn_boolean_t *aborted)
 Like svn_ra_svn_drive_editor2, but with for_replay always FALSE. More...
 
svn_error_tsvn_ra_svn_cram_server (svn_ra_svn_conn_t *conn, apr_pool_t *pool, svn_config_t *pwdb, const char **user, svn_boolean_t *success)
 This function is only intended for use by svnserve. More...
 
const svn_version_tsvn_ra_svn_version (void)
 Get libsvn_ra_svn version information. More...
 
svn_error_tsvn_ra_svn_write_number (svn_ra_svn_conn_t *conn, apr_pool_t *pool, apr_uint64_t number)
 Write a number over the net. More...
 
svn_error_tsvn_ra_svn_write_string (svn_ra_svn_conn_t *conn, apr_pool_t *pool, const svn_string_t *str)
 Write a string over the net. More...
 
svn_error_tsvn_ra_svn_write_cstring (svn_ra_svn_conn_t *conn, apr_pool_t *pool, const char *s)
 Write a cstring over the net. More...
 
svn_error_tsvn_ra_svn_write_word (svn_ra_svn_conn_t *conn, apr_pool_t *pool, const char *word)
 Write a word over the net. More...
 
svn_error_tsvn_ra_svn_write_proplist (svn_ra_svn_conn_t *conn, apr_pool_t *pool, apr_hash_t *props)
 Write a list of properties over the net. More...
 
svn_error_tsvn_ra_svn_start_list (svn_ra_svn_conn_t *conn, apr_pool_t *pool)
 Begin a list. More...
 
svn_error_tsvn_ra_svn_end_list (svn_ra_svn_conn_t *conn, apr_pool_t *pool)
 End a list. More...
 
svn_error_tsvn_ra_svn_flush (svn_ra_svn_conn_t *conn, apr_pool_t *pool)
 Flush the write buffer. More...
 
svn_error_tsvn_ra_svn_write_tuple (svn_ra_svn_conn_t *conn, apr_pool_t *pool, const char *fmt,...)
 Write a tuple, using a printf-like interface. More...
 
svn_error_tsvn_ra_svn_read_item (svn_ra_svn_conn_t *conn, apr_pool_t *pool, svn_ra_svn_item_t **item)
 Read an item from the network into *item. More...
 
svn_error_tsvn_ra_svn_skip_leading_garbage (svn_ra_svn_conn_t *conn, apr_pool_t *pool)
 Scan data on conn until we find something which looks like the beginning of an svn server greeting (an open paren followed by a whitespace character). More...
 
svn_error_tsvn_ra_svn_parse_tuple (const apr_array_header_t *list, apr_pool_t *pool, const char *fmt,...)
 Parse an array of svn_sort__item_t structures as a tuple, using a printf-like interface. More...
 
svn_error_tsvn_ra_svn_read_tuple (svn_ra_svn_conn_t *conn, apr_pool_t *pool, const char *fmt,...)
 Read a tuple from the network and parse it as a tuple, using the format string notation from svn_ra_svn_parse_tuple(). More...
 
svn_error_tsvn_ra_svn_parse_proplist (const apr_array_header_t *list, apr_pool_t *pool, apr_hash_t **props)
 Parse an array of svn_ra_svn_item_t structures as a list of properties, storing the properties in a hash table. More...
 
svn_error_tsvn_ra_svn_read_cmd_response (svn_ra_svn_conn_t *conn, apr_pool_t *pool, const char *fmt,...)
 Read a command response from the network and parse it as a tuple, using the format string notation from svn_ra_svn_parse_tuple(). More...
 
svn_error_tsvn_ra_svn_handle_commands2 (svn_ra_svn_conn_t *conn, apr_pool_t *pool, const svn_ra_svn_cmd_entry_t *commands, void *baton, svn_boolean_t error_on_disconnect)
 Accept commands over the network and handle them according to commands. More...
 
svn_error_tsvn_ra_svn_handle_commands (svn_ra_svn_conn_t *conn, apr_pool_t *pool, const svn_ra_svn_cmd_entry_t *commands, void *baton)
 Similar to svn_ra_svn_handle_commands2 but error_on_disconnect is always FALSE. More...
 
svn_error_tsvn_ra_svn_write_cmd (svn_ra_svn_conn_t *conn, apr_pool_t *pool, const char *cmdname, const char *fmt,...)
 Write a command over the network, using the same format string notation as svn_ra_svn_write_tuple(). More...
 
svn_error_tsvn_ra_svn_write_cmd_response (svn_ra_svn_conn_t *conn, apr_pool_t *pool, const char *fmt,...)
 Write a successful command response over the network, using the same format string notation as svn_ra_svn_write_tuple(). More...
 
svn_error_tsvn_ra_svn_write_cmd_failure (svn_ra_svn_conn_t *conn, apr_pool_t *pool, svn_error_t *err)
 Write an unsuccessful command response over the network. More...
 

Detailed Description

libsvn_ra_svn functions used by the server

@if copyrights

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations

under the License.

Definition in file svn_ra_svn.h.

Macro Definition Documentation

◆ SVN_CMD_ERR

#define SVN_CMD_ERR (   expr)
Value:
do { \
svn_error_t *svn_err__temp = (expr); \
if (svn_err__temp) \
svn_err__temp, NULL); \
} while (0)

A specialized form of SVN_ERR to deal with errors which occur in an svn_ra_svn_command_handler().

An error returned with this macro will be passed back to the other side of the connection. Use this macro when performing the requested operation; use the regular SVN_ERR when performing I/O with the client.

Definition at line 115 of file svn_ra_svn.h.

Enumeration Type Documentation

◆ svn_ra_svn_item_kind_t

Data types defined by the svn:// protocol.

Since
The typedef name is new in 1.10; the enumerators are not.

Definition at line 150 of file svn_ra_svn.h.

Function Documentation

◆ svn_ra_svn_compression_level()

int svn_ra_svn_compression_level ( svn_ra_svn_conn_t conn)

Return the data compression level to use for network transmissions.

Since
New in 1.7.

◆ svn_ra_svn_cram_server()

svn_error_t* svn_ra_svn_cram_server ( svn_ra_svn_conn_t conn,
apr_pool_t *  pool,
svn_config_t pwdb,
const char **  user,
svn_boolean_t success 
)

This function is only intended for use by svnserve.

Perform CRAM-MD5 password authentication. On success, return SVN_NO_ERROR with *user set to the username and *success set to TRUE. On an error which can be reported to the client, report the error and return SVN_NO_ERROR with *success set to FALSE. On communications failure, return an error.

◆ svn_ra_svn_create_conn()

svn_ra_svn_conn_t* svn_ra_svn_create_conn ( apr_socket_t *  sock,
apr_file_t *  in_file,
apr_file_t *  out_file,
apr_pool_t *  pool 
)

Similar to svn_ra_svn_create_conn2() but uses the default compression level (SVN_DELTA_COMPRESSION_LEVEL_DEFAULT) for network transmissions.

Deprecated:
Provided for backward compatibility with the 1.6 API.

◆ svn_ra_svn_create_conn2()

svn_ra_svn_conn_t* svn_ra_svn_create_conn2 ( apr_socket_t *  sock,
apr_file_t *  in_file,
apr_file_t *  out_file,
int  compression_level,
apr_pool_t *  pool 
)

Similar to svn_ra_svn_create_conn3() but disables the zero copy code path and sets the error checking interval to 0.

Since
New in 1.7.
Deprecated:
Provided for backward compatibility with the 1.7 API.

◆ svn_ra_svn_create_conn3()

svn_ra_svn_conn_t* svn_ra_svn_create_conn3 ( apr_socket_t *  sock,
apr_file_t *  in_file,
apr_file_t *  out_file,
int  compression_level,
apr_size_t  zero_copy_limit,
apr_size_t  error_check_interval,
apr_pool_t *  pool 
)

Similar to svn_ra_svn_create_conn4() but only supports apr_file_t handles instead of the more generic streams.

Since
New in 1.8
Deprecated:
Provided for backward compatibility with the 1.8 API.

◆ svn_ra_svn_create_conn4()

svn_ra_svn_conn_t* svn_ra_svn_create_conn4 ( apr_socket_t *  sock,
svn_stream_t in_stream,
svn_stream_t out_stream,
int  compression_level,
apr_size_t  zero_copy_limit,
apr_size_t  error_check_interval,
apr_pool_t *  result_pool 
)

Similar to svn_ra_svn_create_conn5() but with max_in and max_out set to 0.

Since
New in 1.9
Deprecated:
Provided for backward compatibility with the 1.9 API.

◆ svn_ra_svn_create_conn5()

svn_ra_svn_conn_t* svn_ra_svn_create_conn5 ( apr_socket_t *  sock,
svn_stream_t in_stream,
svn_stream_t out_stream,
int  compression_level,
apr_size_t  zero_copy_limit,
apr_size_t  error_check_interval,
apr_uint64_t  max_in,
apr_uint64_t  max_out,
apr_pool_t *  result_pool 
)

Initialize a connection structure for the given socket or input/output streams.

Either sock or in_stream/out_stream must be set, not both. compression_level specifies the desired network data compression level from 0 (no compression) to 9 (best but slowest). The effect of the parameter depends on the compression algorithm; for example, it is used verbatim by zlib/deflate but ignored by LZ4.

If zero_copy_limit is not 0, cached file contents smaller than the given limit may be sent directly to the network socket. Otherwise, it will be copied into a temporary buffer before being forwarded to the network stack. Since the zero-copy code path has to enforce strict time-outs, the receiver must be able to process zero_copy_limit bytes within one second. Even temporary failure to do so may cause the server to cancel the respective operation with a time-out error.

To reduce the overhead of checking for cancellation requests from the data receiver, set error_check_interval to some non-zero value. It defines the number of bytes that must have been sent since the last check before the next check will be made.

If max_in is not 0, error out and close the connection whenever more than max_in bytes are received for a command (e.g. a client request). If max_out is not 0, error out and close the connection whenever more than max_out bytes have been send as response to some command.

Note
The limits enforced may vary slightly by +/- the I/O buffer size.
If out_stream is an wrapped apr_file_t* the backing file will be used for some operations.

Allocate the result in pool.

Since
New in 1.10

◆ svn_ra_svn_drive_editor()

svn_error_t* svn_ra_svn_drive_editor ( svn_ra_svn_conn_t conn,
apr_pool_t *  pool,
const svn_delta_editor_t editor,
void *  edit_baton,
svn_boolean_t aborted 
)

Like svn_ra_svn_drive_editor2, but with for_replay always FALSE.

Deprecated:
Provided for backward compatibility with the 1.3 API.

◆ svn_ra_svn_drive_editor2()

svn_error_t* svn_ra_svn_drive_editor2 ( svn_ra_svn_conn_t conn,
apr_pool_t *  pool,
const svn_delta_editor_t editor,
void *  edit_baton,
svn_boolean_t aborted,
svn_boolean_t  for_replay 
)

Receive edit commands over the network and use them to drive editor with edit_baton.

On return, *aborted will be set if the edit was aborted. The drive can be terminated with a finish-replay command only if for_replay is TRUE.

Since
New in 1.4.
Note
The copyfrom_path parameter passed to the add_file and add_directory methods of the receiving editor will be canonicalized either as a URL or as a relative path (starting with a slash) according to which kind was sent by the driving end of the connection. See svn_ra_svn_get_editor() for information on the driving end of the connection.

◆ svn_ra_svn_get_editor()

void svn_ra_svn_get_editor ( const svn_delta_editor_t **  editor,
void **  edit_baton,
svn_ra_svn_conn_t conn,
apr_pool_t *  pool,
svn_ra_svn_edit_callback  callback,
void *  callback_baton 
)

Set *editor and *edit_baton to an editor which will pass editing operations over the network, using conn and pool.

Upon successful completion of the edit, the editor will invoke callback with callback_baton as an argument.

Note
The copyfrom_path parameter passed to the add_file and add_directory methods of the returned editor may be either a URL or a relative path, and is transferred verbatim to the receiving end of the connection. See svn_ra_svn_drive_editor2() for information on the receiving end of the connection.

◆ svn_ra_svn_set_capabilities()

svn_error_t* svn_ra_svn_set_capabilities ( svn_ra_svn_conn_t conn,
const apr_array_header_t *  list 
)

Add the capabilities in list to conn's capabilities.

list contains svn_ra_svn_item_t entries (which should be of type SVN_RA_SVN_WORD; a malformed data error will result if any are not).

This is idempotent: if a given capability was already set for conn, it remains set.

◆ svn_ra_svn_version()

const svn_version_t* svn_ra_svn_version ( void  )

Get libsvn_ra_svn version information.

Since
New in 1.1.

◆ svn_ra_svn_zero_copy_limit()

apr_size_t svn_ra_svn_zero_copy_limit ( svn_ra_svn_conn_t conn)

Return the zero-copy data block limit to use for network transmissions.

See also
http://en.wikipedia.org/wiki/Zero-copy
Since
New in 1.8.
SVN_ERR_RA_SVN_CMD_ERR
@ SVN_ERR_RA_SVN_CMD_ERR
"Special code for wrapping server errors to report to client"
Definition: svn_error_codes.h:1564
svn_error_create
svn_error_t * svn_error_create(apr_status_t apr_err, svn_error_t *child, const char *message)
Create a nested exception structure.