Remove no-longer-used svn_*_get_mergeinfo_for_tree APIs.
[svn.git] / subversion / libsvn_ra_svn / ra_svn.h
blob56592c4108eedd75e139d94a1703f411da06b5b8
1 /*
2 * ra_svn.h : private declarations for the ra_svn module
4 * ====================================================================
5 * Copyright (c) 2000-2007 CollabNet. All rights reserved.
7 * This software is licensed as described in the file COPYING, which
8 * you should have received as part of this distribution. The terms
9 * are also available at http://subversion.tigris.org/license-1.html.
10 * If newer versions of this license are posted there, you may use a
11 * newer version instead, at your option.
13 * This software consists of voluntary contributions made by many
14 * individuals. For exact contribution history, see the revision
15 * history and logs, available at http://subversion.tigris.org/.
16 * ====================================================================
21 #ifndef RA_SVN_H
22 #define RA_SVN_H
24 #ifdef __cplusplus
25 extern "C" {
26 #endif /* __cplusplus */
28 #include <apr_network_io.h>
29 #include <apr_file_io.h>
30 #include <apr_thread_proc.h>
31 #include "svn_ra.h"
32 #include "svn_ra_svn.h"
34 /* Callback function that indicates if a svn_ra_svn__stream_t has pending
35 * data.
37 typedef svn_boolean_t (*ra_svn_pending_fn_t)(void *baton);
39 /* Callback function that sets the timeout value for a svn_ra_svn__stream_t. */
40 typedef void (*ra_svn_timeout_fn_t)(void *baton, apr_interval_time_t timeout);
42 /* A stream abstraction for ra_svn.
44 * This is different from svn_stream_t in that it provides timeouts and
45 * the ability to check for pending data.
47 typedef struct svn_ra_svn__stream_st svn_ra_svn__stream_t;
49 /* Handler for blocked writes. */
50 typedef svn_error_t *(*ra_svn_block_handler_t)(svn_ra_svn_conn_t *conn,
51 apr_pool_t *pool,
52 void *baton);
54 /* The size of our per-connection read and write buffers. */
55 #define SVN_RA_SVN__READBUF_SIZE 4096
56 #define SVN_RA_SVN__WRITEBUF_SIZE 4096
58 /* Create forward reference */
59 typedef struct svn_ra_svn__session_baton_t svn_ra_svn__session_baton_t;
61 /* This structure is opaque to the server. The client pokes at the
62 * first few fields during setup and cleanup. */
63 struct svn_ra_svn_conn_st {
64 svn_ra_svn__stream_t *stream;
65 svn_ra_svn__session_baton_t *session;
66 #ifdef SVN_HAVE_SASL
67 /* Although all reads and writes go through the svn_ra_svn__stream_t
68 interface, SASL still needs direct access to the underlying socket
69 for stuff like IP addresses and port numbers. */
70 apr_socket_t *sock;
71 svn_boolean_t encrypted;
72 #endif
73 char read_buf[SVN_RA_SVN__READBUF_SIZE];
74 char *read_ptr;
75 char *read_end;
76 char write_buf[SVN_RA_SVN__WRITEBUF_SIZE];
77 int write_pos;
78 const char *uuid;
79 const char *repos_root;
80 ra_svn_block_handler_t block_handler;
81 void *block_baton;
82 apr_hash_t *capabilities;
83 apr_pool_t *pool;
86 struct svn_ra_svn__session_baton_t {
87 apr_pool_t *pool;
88 svn_ra_svn_conn_t *conn;
89 svn_boolean_t is_tunneled;
90 const char *url;
91 const char *user;
92 const char *hostname; /* The remote hostname. */
93 const char *realm_prefix;
94 const char **tunnel_argv;
95 const svn_ra_callbacks2_t *callbacks;
96 void *callbacks_baton;
97 apr_off_t bytes_read, bytes_written; /* apr_off_t's because that's what
98 the callback interface uses */
101 /* Set a callback for blocked writes on conn. This handler may
102 * perform reads on the connection in order to prevent deadlock due to
103 * pipelining. If callback is NULL, the connection goes back to
104 * normal blocking I/O for writes.
106 void svn_ra_svn__set_block_handler(svn_ra_svn_conn_t *conn,
107 ra_svn_block_handler_t callback,
108 void *baton);
110 /* Return true if there is input waiting on conn. */
111 svn_boolean_t svn_ra_svn__input_waiting(svn_ra_svn_conn_t *conn,
112 apr_pool_t *pool);
114 /* CRAM-MD5 client implementation. */
115 svn_error_t *svn_ra_svn__cram_client(svn_ra_svn_conn_t *conn, apr_pool_t *pool,
116 const char *user, const char *password,
117 const char **message);
119 /* Return an error chain based on @a params (which contains a
120 * command response indicating failure). The error chain will be
121 * in the same order as the errors indicated in @a params. Use
122 * @a pool for temporary allocations. */
123 svn_error_t *svn_ra_svn__handle_failure_status(apr_array_header_t *params,
124 apr_pool_t *pool);
126 /* Returns a stream that reads/writes from/to SOCK. */
127 svn_ra_svn__stream_t *svn_ra_svn__stream_from_sock(apr_socket_t *sock,
128 apr_pool_t *pool);
130 /* Returns a stream that reads from IN_FILE and writes to OUT_FILE. */
131 svn_ra_svn__stream_t *svn_ra_svn__stream_from_files(apr_file_t *in_file,
132 apr_file_t *out_file,
133 apr_pool_t *pool);
135 /* Create an svn_ra_svn__stream_t using READ_CB, WRITE_CB, TIMEOUT_CB,
136 * PENDING_CB, and BATON.
138 svn_ra_svn__stream_t *svn_ra_svn__stream_create(void *baton,
139 svn_read_fn_t read_cb,
140 svn_write_fn_t write_cb,
141 ra_svn_timeout_fn_t timeout_cb,
142 ra_svn_pending_fn_t pending_cb,
143 apr_pool_t *pool);
145 /* Write *LEN bytes from DATA to STREAM, returning the number of bytes
146 * written in *LEN.
148 svn_error_t *svn_ra_svn__stream_write(svn_ra_svn__stream_t *stream,
149 const char *data, apr_size_t *len);
151 /* Read *LEN bytes from STREAM into DATA, returning the number of bytes
152 * read in *LEN.
154 svn_error_t *svn_ra_svn__stream_read(svn_ra_svn__stream_t *stream,
155 char *data, apr_size_t *len);
157 /* Set the timeout for operations on STREAM to INTERVAL. */
158 void svn_ra_svn__stream_timeout(svn_ra_svn__stream_t *stream,
159 apr_interval_time_t interval);
161 /* Return whether or not there is data pending on STREAM. */
162 svn_boolean_t svn_ra_svn__stream_pending(svn_ra_svn__stream_t *stream);
164 /* Respond to an auth request and perform authentication. Use the Cyrus
165 * SASL library for mechanism negotiation and for creating authentication
166 * tokens. */
167 svn_error_t *
168 svn_ra_svn__do_cyrus_auth(svn_ra_svn__session_baton_t *sess,
169 apr_array_header_t *mechlist,
170 const char *realm, apr_pool_t *pool);
172 /* Same as svn_ra_svn__do_cyrus_auth, but uses the built-in implementation of
173 * the CRAM-MD5, ANONYMOUS and EXTERNAL mechanisms. Return the error
174 * SVN_ERR_RA_SVN_NO_MECHANSIMS if we cannot negotiate an authentication
175 * mechanism with the server. */
176 svn_error_t *
177 svn_ra_svn__do_internal_auth(svn_ra_svn__session_baton_t *sess,
178 apr_array_header_t *mechlist,
179 const char *realm, apr_pool_t *pool);
181 /* Having picked a mechanism, start authentication by writing out an
182 * auth response. MECH_ARG may be NULL for mechanisms with no
183 * initial client response. */
184 svn_error_t *svn_ra_svn__auth_response(svn_ra_svn_conn_t *conn,
185 apr_pool_t *pool,
186 const char *mech, const char *mech_arg);
188 /* Initialize the SASL library. */
189 svn_error_t *svn_ra_svn__sasl_init(void);
192 #ifdef __cplusplus
194 #endif /* __cplusplus */
196 #endif /* RA_SVN_H */