Subversion
|
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. More... | |
#define | SVN_RA_SVN_CAP_EDIT_PIPELINE "edit-pipeline" |
Currently-defined capabilities. More... | |
#define | SVN_RA_SVN_CAP_SVNDIFF1 "svndiff1" |
#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_DIRENT_KIND "kind" |
The ra_svn way of saying SVN_DIRENT_KIND . More... | |
#define | SVN_RA_SVN_DIRENT_SIZE "size" |
The ra_svn way of saying SVN_DIRENT_SIZE . More... | |
#define | SVN_RA_SVN_DIRENT_HAS_PROPS "has-props" |
The ra_svn way of saying SVN_DIRENT_HAS_PROPS . More... | |
#define | SVN_RA_SVN_DIRENT_CREATED_REV "created-rev" |
The ra_svn way of saying SVN_DIRENT_CREATED_REV . More... | |
#define | SVN_RA_SVN_DIRENT_TIME "time" |
The ra_svn way of saying SVN_DIRENT_TIME . More... | |
#define | SVN_RA_SVN_DIRENT_LAST_AUTHOR "last-author" |
The ra_svn way of saying SVN_DIRENT_LAST_AUTHOR . More... | |
#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. More... | |
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(). More... | |
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. More... | |
typedef svn_error_t *(* | svn_ra_svn_edit_callback )(void *baton) |
Functions | |
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) |
Initialize a connection structure for the given socket or input/output streams. More... | |
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. More... | |
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. More... | |
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. More... | |
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. 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. More... | |
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. More... | |
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_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. More... | |
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. More... | |
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. More... | |
const svn_version_t * | svn_ra_svn_version (void) |
Get libsvn_ra_svn version information. More... | |
svn_error_t * | svn_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_t * | svn_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_t * | svn_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_t * | svn_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_t * | svn_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_t * | svn_ra_svn_start_list (svn_ra_svn_conn_t *conn, apr_pool_t *pool) |
Begin a list. More... | |
svn_error_t * | svn_ra_svn_end_list (svn_ra_svn_conn_t *conn, apr_pool_t *pool) |
End a list. More... | |
svn_error_t * | svn_ra_svn_flush (svn_ra_svn_conn_t *conn, apr_pool_t *pool) |
Flush the write buffer. More... | |
svn_error_t * | svn_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_t * | svn_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_t * | svn_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_t * | svn_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_t * | svn_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_t * | svn_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_t * | svn_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_t * | svn_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_t * | svn_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_t * | svn_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_t * | svn_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_t * | svn_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... | |
libsvn_ra_svn functions used by the server
Definition in file svn_ra_svn.h.
#define SVN_CMD_ERR | ( | expr | ) |
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 112 of file svn_ra_svn.h.
#define SVN_RA_SVN_CAP_EDIT_PIPELINE "edit-pipeline" |
Currently-defined capabilities.
Definition at line 50 of file svn_ra_svn.h.
#define SVN_RA_SVN_PORT 3690 |
The well-known svn port number.
Definition at line 47 of file svn_ra_svn.h.
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().
Definition at line 124 of file svn_ra_svn.h.
typedef struct svn_ra_svn_conn_st svn_ra_svn_conn_t |
an ra_svn connection.
Definition at line 121 of file svn_ra_svn.h.
typedef struct svn_ra_svn_item_t svn_ra_svn_item_t |
Memory representation of an on-the-wire data item.
int svn_ra_svn_compression_level | ( | svn_ra_svn_conn_t * | conn | ) |
Return the data compression level to use for network transmissions.
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.
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_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.
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.
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.
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 | ||
) |
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 (zlib) from 0 (no compression) to 9 (best but slowest).
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.
Allocate the result in pool.
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.
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.
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. 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.
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_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.
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.
const svn_version_t* svn_ra_svn_version | ( | void | ) |
Get libsvn_ra_svn version information.
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.