2 Bacula® - The Network Backup Solution
4 Copyright (C) 2008-2008 Free Software Foundation Europe e.V.
6 The main author of Bacula is Kern Sibbald, with contributions from
7 many others, a complete list can be found in the file AUTHORS.
8 This program is Free Software; you can redistribute it and/or
9 modify it under the terms of version three of the GNU Affero General Public
10 License as published by the Free Software Foundation, which is
11 listed in the file LICENSE.
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU Affero General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 Bacula® is a registered trademark of Kern Sibbald.
24 The licensor of Bacula is the Free Software Foundation Europe
25 (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
26 Switzerland, email:ftf@fsfeurope.org.
29 * Written by James Harper, October 2008
32 #define NODE_TYPE_UNKNOWN 0
33 #define NODE_TYPE_ROOT 1
34 #define NODE_TYPE_SERVICE 2
35 #define NODE_TYPE_STORAGE_GROUP 3
36 #define NODE_TYPE_STORE 4
37 #define NODE_TYPE_DATABASE_INFO 5
38 #define NODE_TYPE_FILE 6
50 node_t(char *name, int type);
51 node_t(char *name, int type, node_t *parent_node);
54 char *make_full_path();
56 virtual bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp) = 0;
57 virtual bRC endBackupFile(exchange_fd_context_t *context) = 0;
59 virtual bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp) = 0;
60 virtual bRC endRestoreFile(exchange_fd_context_t *context) = 0;
62 virtual bRC pluginIoOpen(exchange_fd_context_t *context, struct io_pkt *io);
63 virtual bRC pluginIoRead(exchange_fd_context_t *context, struct io_pkt *io);
64 virtual bRC pluginIoWrite(exchange_fd_context_t *context, struct io_pkt *io);
65 virtual bRC pluginIoClose(exchange_fd_context_t *context, struct io_pkt *io);
68 class file_node_t : public node_t {
72 VOID *backup_file_handle;
73 VOID *restore_file_handle;
74 uint64_t section_size;
75 bool restore_at_file_level;
77 file_node_t(char *name, node_t *parent_node);
78 virtual ~file_node_t();
79 bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp);
80 bRC endBackupFile(exchange_fd_context_t *context);
82 bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp);
83 bRC endRestoreFile(exchange_fd_context_t *context);
85 bRC pluginIoOpen(exchange_fd_context_t *context, struct io_pkt *io);
86 bRC pluginIoRead(exchange_fd_context_t *context, struct io_pkt *io);
87 bRC pluginIoWrite(exchange_fd_context_t *context, struct io_pkt *io);
88 bRC pluginIoClose(exchange_fd_context_t *context, struct io_pkt *io);
91 class dbi_node_t : public node_t {
93 DATABASE_BACKUP_INFO *dbi;
97 WCHAR *restore_display_name;
99 WCHAR *restore_input_streams;
100 WCHAR *restore_output_streams;
102 dbi_node_t(char *name, node_t *parent_node);
103 virtual ~dbi_node_t();
104 bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp);
105 bRC endBackupFile(exchange_fd_context_t *context);
107 bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp);
108 bRC endRestoreFile(exchange_fd_context_t *context);
110 bRC pluginIoOpen(exchange_fd_context_t *context, struct io_pkt *io);
111 bRC pluginIoRead(exchange_fd_context_t *context, struct io_pkt *io);
112 bRC pluginIoWrite(exchange_fd_context_t *context, struct io_pkt *io);
113 bRC pluginIoClose(exchange_fd_context_t *context, struct io_pkt *io);
116 class store_node_t : public node_t {
119 DATABASE_BACKUP_INFO *dbi;
121 file_node_t *file_node;
122 dbi_node_t *dbi_node;
123 WCHAR *out_stream_ptr;
125 store_node_t(char *name, node_t *parent_node);
126 virtual ~store_node_t();
127 bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp);
128 bRC endBackupFile(exchange_fd_context_t *context);
130 bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp);
131 bRC endRestoreFile(exchange_fd_context_t *context);
134 class storage_group_node_t : public node_t {
137 INSTANCE_BACKUP_INFO *ibi;
138 store_node_t *store_node;
139 file_node_t *file_node;
140 uint32_t current_dbi;
143 RESTORE_ENVIRONMENT *restore_environment;
145 WCHAR *storage_group_name;
146 WCHAR *saved_log_path;
147 storage_group_node_t *next;
149 storage_group_node_t(char *name, node_t *parent_node);
150 virtual ~storage_group_node_t();
151 bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp);
152 bRC endBackupFile(exchange_fd_context_t *context);
154 bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp);
155 bRC endRestoreFile(exchange_fd_context_t *context);
158 class service_node_t : public node_t {
161 INSTANCE_BACKUP_INFO *ibi;
163 uint32_t current_ibi;
164 storage_group_node_t *first_storage_group_node;
166 service_node_t(char *name, node_t *parent_node);
167 virtual ~service_node_t();
168 bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp);
169 bRC endBackupFile(exchange_fd_context_t *context);
171 bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp);
172 bRC endRestoreFile(exchange_fd_context_t *context);
175 class root_node_t : public node_t {
177 service_node_t *service_node;
179 root_node_t(char *name);
180 virtual ~root_node_t();
181 bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp);
182 bRC endBackupFile(exchange_fd_context_t *context);
184 bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp);
185 bRC endRestoreFile(exchange_fd_context_t *context);