]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/win32/filed/plugins/exch_node.h
Restore win32 dir from Branch-5.2 and update it
[bacula/bacula] / bacula / src / win32 / filed / plugins / exch_node.h
1 /* 
2  *  Written by James Harper, July 2010
3  */
4
5 #define NODE_TYPE_UNKNOWN          0
6 #define NODE_TYPE_ROOT        1
7 #define NODE_TYPE_SERVICE          2
8 #define NODE_TYPE_STORAGE_GROUP    3
9 #define NODE_TYPE_STORE       4
10 #define NODE_TYPE_DATABASE_INFO    5
11 #define NODE_TYPE_FILE        6
12
13 class node_t {
14 public:
15    int type;
16    int state;
17    node_t *parent;
18    char *name;
19    char *full_path;
20    size_t size;
21    int level;
22
23    node_t(char *name, int type);
24    node_t(char *name, int type, node_t *parent_node);
25    virtual ~node_t();
26
27    char *make_full_path();
28
29    virtual bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp) = 0;
30    virtual bRC endBackupFile(exchange_fd_context_t *context) = 0;
31
32    virtual bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp) = 0;
33    virtual bRC endRestoreFile(exchange_fd_context_t *context) = 0;
34
35    virtual bRC pluginIoOpen(exchange_fd_context_t *context, struct io_pkt *io);
36    virtual bRC pluginIoRead(exchange_fd_context_t *context, struct io_pkt *io);
37    virtual bRC pluginIoWrite(exchange_fd_context_t *context, struct io_pkt *io);
38    virtual bRC pluginIoClose(exchange_fd_context_t *context, struct io_pkt *io);
39 };
40
41 class file_node_t : public node_t {
42 public:
43    WCHAR *filename;
44    HCCX hccx;
45    VOID *backup_file_handle;
46    VOID *restore_file_handle;
47    uint64_t section_size;
48    bool restore_at_file_level;
49
50    file_node_t(char *name, node_t *parent_node);
51    virtual ~file_node_t();
52    bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp);
53    bRC endBackupFile(exchange_fd_context_t *context);
54
55    bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp);
56    bRC endRestoreFile(exchange_fd_context_t *context);
57
58    bRC pluginIoOpen(exchange_fd_context_t *context, struct io_pkt *io);
59    bRC pluginIoRead(exchange_fd_context_t *context, struct io_pkt *io);
60    bRC pluginIoWrite(exchange_fd_context_t *context, struct io_pkt *io);
61    bRC pluginIoClose(exchange_fd_context_t *context, struct io_pkt *io);
62 };
63
64 class dbi_node_t : public node_t {
65 public:
66    DATABASE_BACKUP_INFO *dbi;
67    char *buffer;
68    uint32_t buffer_size;
69    uint32_t buffer_pos;
70    WCHAR *restore_display_name;
71    GUID restore_guid;
72    WCHAR *restore_input_streams;
73    WCHAR *restore_output_streams;
74
75    dbi_node_t(char *name, node_t *parent_node);
76    virtual ~dbi_node_t();
77    bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp);
78    bRC endBackupFile(exchange_fd_context_t *context);
79
80    bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp);
81    bRC endRestoreFile(exchange_fd_context_t *context);
82
83    bRC pluginIoOpen(exchange_fd_context_t *context, struct io_pkt *io);
84    bRC pluginIoRead(exchange_fd_context_t *context, struct io_pkt *io);
85    bRC pluginIoWrite(exchange_fd_context_t *context, struct io_pkt *io);
86    bRC pluginIoClose(exchange_fd_context_t *context, struct io_pkt *io);
87 };
88
89 class store_node_t : public node_t {
90 public:
91    HCCX hccx;
92    DATABASE_BACKUP_INFO *dbi;
93    WCHAR *stream_ptr;
94    file_node_t *file_node;
95    dbi_node_t *dbi_node;
96    WCHAR *out_stream_ptr;
97
98    store_node_t(char *name, node_t *parent_node);
99    virtual ~store_node_t();
100    bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp);
101    bRC endBackupFile(exchange_fd_context_t *context);
102
103    bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp);
104    bRC endRestoreFile(exchange_fd_context_t *context);
105 };
106
107 class storage_group_node_t : public node_t {
108 public:
109    HCCX hccx;
110    INSTANCE_BACKUP_INFO *ibi;
111    store_node_t *store_node;
112    file_node_t *file_node;
113    uint32_t current_dbi;
114    WCHAR *logfiles;
115    WCHAR *logfile_ptr;
116    RESTORE_ENVIRONMENT *restore_environment;
117    WCHAR *service_name;
118    WCHAR *storage_group_name;
119    WCHAR *saved_log_path;
120    storage_group_node_t *next;
121
122    storage_group_node_t(char *name, node_t *parent_node);
123    virtual ~storage_group_node_t();
124    bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp);
125    bRC endBackupFile(exchange_fd_context_t *context);
126
127    bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp);
128    bRC endRestoreFile(exchange_fd_context_t *context);
129 };
130
131 class service_node_t : public node_t {
132 public:
133    uint32_t ibi_count;
134    INSTANCE_BACKUP_INFO *ibi;
135    HCCX hccx;
136    uint32_t current_ibi;
137    storage_group_node_t *first_storage_group_node;
138
139    service_node_t(char *name, node_t *parent_node);
140    virtual ~service_node_t();
141    bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp);
142    bRC endBackupFile(exchange_fd_context_t *context);
143
144    bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp);
145    bRC endRestoreFile(exchange_fd_context_t *context);
146 };
147
148 class root_node_t : public node_t {
149 public:
150    service_node_t *service_node;
151
152    root_node_t(char *name);
153    virtual ~root_node_t();
154    bRC startBackupFile(exchange_fd_context_t *context, struct save_pkt *sp);
155    bRC endBackupFile(exchange_fd_context_t *context);
156
157    bRC createFile(exchange_fd_context_t *context, struct restore_pkt *rp);
158    bRC endRestoreFile(exchange_fd_context_t *context);
159 };