1 /* 2 Bacula(R) - The Network Backup Solution 3 4 Copyright (C) 2000-2020 Kern Sibbald 5 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. 8 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. 13 14 This notice must be preserved when any source code is 15 conveyed and/or propagated. 16 17 Bacula(R) is a registered trademark of Kern Sibbald. 18 */ 19 20 #ifndef __RESTORE_H 21 #define __RESTORE_H 22 23 struct RESTORE_DATA_STREAM { 24 int32_t stream; /* stream less new bits */ 25 char *content; /* stream data */ 26 uint32_t content_length; /* stream length */ 27 }; 28 29 struct RESTORE_CIPHER_CTX { 30 CIPHER_CONTEXT *cipher; 31 uint32_t block_size; 32 33 POOLMEM *buf; /* Pointer to descryption buffer */ 34 int32_t buf_len; /* Count of bytes currently in buf */ 35 int32_t packet_len; /* Total bytes in packet */ 36 }; 37 38 struct r_ctx { 39 JCR *jcr; 40 int32_t stream; /* stream less new bits */ 41 int32_t prev_stream; /* previous stream */ 42 int32_t full_stream; /* full stream including new bits */ 43 int32_t comp_stream; /* last compressed stream found. needed only to restore encrypted compressed backup */ 44 BFILE bfd; /* File content */ 45 uint64_t fileAddr; /* file write address */ 46 uint32_t size; /* Size of file */ 47 int flags; /* Options for extract_data() */ 48 BFILE forkbfd; /* Alternative data stream */ 49 uint64_t fork_addr; /* Write address for alternative stream */ 50 int64_t fork_size; /* Size of alternate stream */ 51 int fork_flags; /* Options for extract_data() */ 52 int32_t type; /* file type FT_ */ 53 ATTR *attr; /* Pointer to attributes */ 54 bool extract; /* set when extracting */ 55 alist *delayed_streams; /* streams that should be restored as last */ 56 worker *efs; /* Windows EFS worker thread */ 57 int32_t count; /* Debug count */ 58 59 SIGNATURE *sig; /* Cryptographic signature (if any) for file */ 60 CRYPTO_SESSION *cs; /* Cryptographic session data (if any) for file */ 61 RESTORE_CIPHER_CTX cipher_ctx; /* Cryptographic restore context (if any) for file */ 62 RESTORE_CIPHER_CTX fork_cipher_ctx; /* Cryptographic restore context (if any) for alternative stream */ 63 }; 64 65 #endif 66 67 #ifdef TEST_WORKER 68 bool test_write_efs_data(r_ctx &rctx, char *data, const int32_t length); 69 #endif 70 71 #ifdef HAVE_WIN32 72 bool win_write_efs_data(r_ctx &rctx, char *data, const int32_t length); 73 #endif 74