svn_ra_svn.h File Reference

libsvn_ra_svn functions used by the server More...

#include <apr.h>
#include <apr_pools.h>
#include <apr_network_io.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...

Defines

#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_ABSENT_ENTRIES   "absent-entries"
#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().

Typedefs

typedef 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 svn_error_t *(*) svn_ra_svn_edit_callback (void *baton)

Functions

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)
 Initialize a connection structure for the given socket or input/output files.
svn_error_tsvn_ra_svn_set_capabilities (svn_ra_svn_conn_t *conn, apr_array_header_t *list)
 Initialize a connection's capabilities to the ones specified in list, which 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).
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_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.
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.
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.
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.
svn_error_tsvn_ra_svn_start_list (svn_ra_svn_conn_t *conn, apr_pool_t *pool)
 Begin a list.
svn_error_tsvn_ra_svn_end_list (svn_ra_svn_conn_t *conn, apr_pool_t *pool)
 End a list.
svn_error_tsvn_ra_svn_flush (svn_ra_svn_conn_t *conn, apr_pool_t *pool)
 Flush the write buffer.
svn_error_tsvn_ra_svn_parse_tuple (apr_array_header_t *list, apr_pool_t *pool, const char *fmt,...)
 Write a tuple, using a printf-like interface.
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().
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().
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)
 Accept commands over the network and handle them according to commands.
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().
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().
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.
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.
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.
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.
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.
const svn_version_tsvn_ra_svn_version (void)
 Get libsvn_ra_svn version information.


Detailed Description

libsvn_ra_svn functions used by the server

Definition in file svn_ra_svn.h.


Define Documentation

#define SVN_CMD_ERR ( expr   ) 

Value:

do {                                                        \
    svn_error_t *svn_err__temp = (expr);                      \
    if (svn_err__temp)                                        \
      return svn_error_create(SVN_ERR_RA_SVN_CMD_ERR,         \
                              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 86 of file svn_ra_svn.h.


Function Documentation

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 
)

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

Either sock or in_file/out_file must be set, not both.

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.

svn_error_t* svn_ra_svn_end_list ( svn_ra_svn_conn_t conn,
apr_pool_t *  pool 
)

End a list.

Writes will be buffered until the next read or flush.

svn_error_t* svn_ra_svn_flush ( svn_ra_svn_conn_t conn,
apr_pool_t *  pool 
)

Flush the write buffer.

Normally this shouldn't be necessary, since the write buffer is flushed when a read is attempted.

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.

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 
)

Accept commands over the network and handle them according to commands.

Command handlers will be passed conn, a subpool of pool (cleared after each command is handled), the parameters of the command, and baton. Commands will be accepted until a terminating command is received (a command with "terminate" set in the command table). If a command handler returns an error wrapped in SVN_RA_SVN_CMD_ERR (see the SVN_CMD_ERR macro), the error will be reported to the other side of the connection and the command loop will continue; any other kind of error (typically a network or protocol error) is passed through to the caller.

svn_error_t* svn_ra_svn_parse_tuple ( apr_array_header_t *  list,
apr_pool_t *  pool,
const char *  fmt,
  ... 
)

Write a tuple, using a printf-like interface.

The format string fmt may contain:

   Spec  Argument type         Item type
   ----  --------------------  ---------
   n     apr_uint64_t          Number
   r     svn_revnum_t          Number
   s     const svn_string_t *  String
   c     const char *          String
   w     const char *          Word
   b     svn_boolean_t         Word ("true" or "false")
   (                           Begin tuple
   )                           End tuple
   ?                           Remaining elements optional
   ! (at beginning or end)     Suppress opening or closing of tuple
 

Inside the optional part of a tuple, 'r' values may be SVN_INVALID_REVNUM, 'n' values may be SVN_RA_SVN_UNSPECIFIED_NUMBER, and 's', 'c', and 'w' values may be NULL; in these cases no data will be written. 'b' and '(' may not appear in the optional part of a tuple. Either all or none of the optional values should be valid.

(If we ever have a need for an optional boolean value, we should invent a 'B' specifier which stores a boolean into an int, using -1 for unspecified. Right now there is no need for such a thing.)

Use the '!' format specifier to write partial tuples when you have to transmit an array or other unusual data. For example, to write a tuple containing a revision, an array of words, and a boolean: SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "r(!", rev)); for (i = 0; i < n; i++) SVN_ERR(svn_ra_svn_write_word(conn, pool, words[i])); SVN_ERR(svn_ra_svn_write_tuple(conn, pool, "!)b", flag)); */ svn_error_t *svn_ra_svn_write_tuple(svn_ra_svn_conn_t *conn, apr_pool_t *pool, const char *fmt, ...);

/** Read an item from the network into *item. */ svn_error_t *svn_ra_svn_read_item(svn_ra_svn_conn_t *conn, apr_pool_t *pool, svn_ra_svn_item_t **item);

/** 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). This function is appropriate for beginning a client connection opened in tunnel mode, since people's dotfiles sometimes write output to stdout. It may only be called at the beginning of a client connection. */ svn_error_t *svn_ra_svn_skip_leading_garbage(svn_ra_svn_conn_t *conn, apr_pool_t *pool);

/** Parse an array of svn_sort__item_t structures as a tuple, using a printf-like interface. The format string fmt may contain:

*

   Spec  Argument type          Item type
   ----  --------------------   ---------
   n     apr_uint64_t *         Number
   r     svn_revnum_t *         Number
   s     svn_string_t **        String
   c     const char **          String
   w     const char **          Word
   b     svn_boolean_t *        Word ("true" or "false")
   l     apr_array_header_t **  List
   (                            Begin tuple
   )                            End tuple
   ?                            Tuple is allowed to end here
 *

Note that a tuple is only allowed to end precisely at a '?', or at the end of the specification. So if fmt is "c?cc" and list contains two elements, an error will result.

If an optional part of a tuple contains no data, 'r' values will be set to SVN_INVALID_REVNUM, 'n' values will be set to SVN_RA_SVN_UNSPECIFIED_NUMBER, and 's', 'c', 'w', and 'l' values will be set to NULL. 'b' may not appear inside an optional tuple specification.

svn_error_t* svn_ra_svn_start_list ( svn_ra_svn_conn_t conn,
apr_pool_t *  pool 
)

Begin a list.

Writes will be buffered until the next read or flush.

const svn_version_t* svn_ra_svn_version ( void   ) 

Get libsvn_ra_svn version information.

Since:
New in 1.1.

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().

Do not use partial tuples with this function; if you need to use partial tuples, just write out the "success" and argument tuple by hand.

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.

Writes will be buffered until the next read or flush.

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.

Writes will be buffered until the next read or flush.

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.

Writes will be buffered until the next read or flush.

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.

Writes will be buffered until the next read or flush.


Generated on Sun Sep 16 17:38:08 2007 for Subversion by  doxygen 1.5.1