2 Bacula(R) - The Network Backup Solution
4 Copyright (C) 2000-2018 Kern Sibbald
6 The original author of Bacula is Kern Sibbald, with contributions
7 from many others, a complete list can be found in the file AUTHORS.
9 You may use this file and others of this release according to the
10 license defined in the LICENSE file, which includes the Affero General
11 Public License, v3.0 ("AGPLv3") and some additional permissions and
12 terms pursuant to its AGPLv3 Section 7.
14 This notice must be preserved when any source code is
15 conveyed and/or propagated.
17 Bacula(R) is a registered trademark of Kern Sibbald.
20 * Written by James Harper, October 2008
23 #define NODE_TYPE_UNKNOWN 0
24 #define NODE_TYPE_ROOT 1
25 #define NODE_TYPE_SERVICE 2
26 #define NODE_TYPE_STORAGE_GROUP 3
27 #define NODE_TYPE_STORE 4
28 #define NODE_TYPE_DATABASE_INFO 5
29 #define NODE_TYPE_FILE 6
41 node_t(char *name, int type);
42 node_t(char *name, int type, node_t *parent_node);
45 char *make_full_path();
47 virtual bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp) = 0;
48 virtual bRC endBackupFile(exchange_fd_context_t *context) = 0;
50 virtual bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp) = 0;
51 virtual bRC endRestoreFile(exchange_fd_context_t *context) = 0;
53 virtual bRC pluginIoOpen(exchange_fd_context_t *context, struct io_pkt *io);
54 virtual bRC pluginIoRead(exchange_fd_context_t *context, struct io_pkt *io);
55 virtual bRC pluginIoWrite(exchange_fd_context_t *context, struct io_pkt *io);
56 virtual bRC pluginIoClose(exchange_fd_context_t *context, struct io_pkt *io);
59 class file_node_t : public node_t {
63 VOID *backup_file_handle;
64 VOID *restore_file_handle;
65 uint64_t section_size;
66 bool restore_at_file_level;
68 file_node_t(char *name, node_t *parent_node);
69 virtual ~file_node_t();
70 bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp);
71 bRC endBackupFile(exchange_fd_context_t *context);
73 bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp);
74 bRC endRestoreFile(exchange_fd_context_t *context);
76 bRC pluginIoOpen(exchange_fd_context_t *context, struct io_pkt *io);
77 bRC pluginIoRead(exchange_fd_context_t *context, struct io_pkt *io);
78 bRC pluginIoWrite(exchange_fd_context_t *context, struct io_pkt *io);
79 bRC pluginIoClose(exchange_fd_context_t *context, struct io_pkt *io);
82 class dbi_node_t : public node_t {
84 DATABASE_BACKUP_INFO *dbi;
88 WCHAR *restore_display_name;
90 WCHAR *restore_input_streams;
91 WCHAR *restore_output_streams;
93 dbi_node_t(char *name, node_t *parent_node);
94 virtual ~dbi_node_t();
95 bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp);
96 bRC endBackupFile(exchange_fd_context_t *context);
98 bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp);
99 bRC endRestoreFile(exchange_fd_context_t *context);
101 bRC pluginIoOpen(exchange_fd_context_t *context, struct io_pkt *io);
102 bRC pluginIoRead(exchange_fd_context_t *context, struct io_pkt *io);
103 bRC pluginIoWrite(exchange_fd_context_t *context, struct io_pkt *io);
104 bRC pluginIoClose(exchange_fd_context_t *context, struct io_pkt *io);
107 class store_node_t : public node_t {
110 DATABASE_BACKUP_INFO *dbi;
112 file_node_t *file_node;
113 dbi_node_t *dbi_node;
114 WCHAR *out_stream_ptr;
116 store_node_t(char *name, node_t *parent_node);
117 virtual ~store_node_t();
118 bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp);
119 bRC endBackupFile(exchange_fd_context_t *context);
121 bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp);
122 bRC endRestoreFile(exchange_fd_context_t *context);
125 class storage_group_node_t : public node_t {
128 INSTANCE_BACKUP_INFO *ibi;
129 store_node_t *store_node;
130 file_node_t *file_node;
131 uint32_t current_dbi;
134 RESTORE_ENVIRONMENT *restore_environment;
136 WCHAR *storage_group_name;
137 WCHAR *saved_log_path;
138 storage_group_node_t *next;
140 storage_group_node_t(char *name, node_t *parent_node);
141 virtual ~storage_group_node_t();
142 bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp);
143 bRC endBackupFile(exchange_fd_context_t *context);
145 bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp);
146 bRC endRestoreFile(exchange_fd_context_t *context);
149 class service_node_t : public node_t {
152 INSTANCE_BACKUP_INFO *ibi;
154 uint32_t current_ibi;
155 storage_group_node_t *first_storage_group_node;
157 service_node_t(char *name, node_t *parent_node);
158 virtual ~service_node_t();
159 bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp);
160 bRC endBackupFile(exchange_fd_context_t *context);
162 bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp);
163 bRC endRestoreFile(exchange_fd_context_t *context);
166 class root_node_t : public node_t {
168 service_node_t *service_node;
170 root_node_t(char *name);
171 virtual ~root_node_t();
172 bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp);
173 bRC endBackupFile(exchange_fd_context_t *context);
175 bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp);
176 bRC endRestoreFile(exchange_fd_context_t *context);