1 /*
2  *      rsvndump - remote svn repository dump
3  *      Copyright (C) 2008-2012 Jonas Gehring
4  *
5  *      This program is free software: you can redistribute it and/or modify
6  *      it under the terms of the GNU General Public License as published by
7  *      the Free Software Foundation, either version 3 of the License, or
8  *      (at your option) any later version.
9  *
10  *      This program is distributed in the hope that it will be useful,
11  *      but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *      GNU General Public License for more details.
14  *
15  *      You should have received a copy of the GNU General Public License
16  *      along with this program.  If not, see <http://www.gnu.org/licenses/>.
17  *
18  *
19  *      file: session.h
20  *      desc: Subversion session abstraction
21  */
22 
23 
24 #ifndef SESSION_H_
25 #define SESSION_H_
26 
27 
28 #include "main.h"
29 
30 #include <svn_types.h>
31 
32 
33 /* Flags for the session data */
34 enum session_flags {
35 	SF_NO_CHECK_CERTIFICATE = 0x01,
36 	SF_NON_INTERACTIVE = 0x02,
37 	SF_NO_AUTH_CACHE = 0x04,
38 	SF_OBFUSCATE = 0x08
39 };
40 
41 /* Session data */
42 typedef struct {
43 	struct svn_ra_session_t *ra;
44 	struct apr_pool_t *pool;
45 	char *url;
46 	const char *encoded_url;
47 	const char *root;
48 	const char *prefix;
49 #ifdef USE_SINGLEFILE_DUMP
50 	const char *file; /* Only set if the target is a file */
51 #endif
52 	char *username;
53 	char *password;
54 	char *config_dir;
55 	int flags;
56 
57 	struct apr_hash_t *obf_hash;
58 	struct apr_hash_t *obf_taken;
59 } session_t;
60 
61 
62 /* Creates and initializes a new session_t object */
63 extern session_t session_create();
64 
65 /* Frees a session_t object */
66 extern void session_free(session_t *session);
67 
68 /* Opens a session */
69 extern char session_open(session_t *session);
70 
71 /* Closes a session */
72 extern char session_close(session_t *session);
73 
74 /* Reparents the session if the current root is a file */
75 extern char session_check_reparent(session_t *session, svn_revnum_t rev);
76 
77 /* Returns the obfuscated name for a path if necessary */
78 extern const char *session_obfuscate(session_t *session, struct apr_pool_t *pool, const char *path);
79 
80 /* Returns a one-time obfuscated string if necesssary */
81 extern const char *session_obfuscate_once(session_t *session, struct apr_pool_t *pool, const char *str);
82 
83 
84 #endif
85