]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/filed/backup.h
Backport from Bacula Enterprise
[bacula/bacula] / bacula / src / filed / backup.h
1 /*
2    Bacula(R) - The Network Backup Solution
3
4    Copyright (C) 2000-2015 Kern Sibbald
5    Copyright (C) 2014 Free Software Foundation Europe e.V.
6
7    The original author of Bacula is Kern Sibbald, with contributions
8    from many others, a complete list can be found in the file AUTHORS.
9
10    You may use this file and others of this release according to the
11    license defined in the LICENSE file, which includes the Affero General
12    Public License, v3.0 ("AGPLv3") and some additional permissions and
13    terms pursuant to its AGPLv3 Section 7.
14
15    This notice must be preserved when any source code is 
16    conveyed and/or propagated.
17
18    Bacula(R) is a registered trademark of Kern Sibbald.
19 */
20
21 #ifndef __BACKUP_H
22 #define __BACKUP_H
23
24 #include "ch.h"
25
26 /*
27  * Define a backup context
28  */
29 struct bctx_t {
30    /* Global variables */
31    JCR *jcr;
32    FF_PKT *ff_pkt;                    /* find file packet */
33    int data_stream;
34    BSOCK *sd;
35    uint64_t fileAddr;
36    char *rbuf, *wbuf;
37    int32_t rsize;
38    POOLMEM *msgsave;
39
40    /* Crypto variables */
41    DIGEST *digest;
42    DIGEST *signing_digest;
43    int digest_stream;
44    SIGNATURE *sig;
45    CIPHER_CONTEXT *cipher_ctx;
46    const uint8_t *cipher_input;
47    uint32_t cipher_input_len;
48    uint32_t cipher_block_size;
49    uint32_t encrypted_len;
50
51    /* Compression variables */
52 #if defined(HAVE_LIBZ) || defined(HAVE_LZO)
53    uLong compress_len;
54    uLong max_compress_len;
55    Bytef *cbuf;
56    Bytef *cbuf2;
57 #endif
58 #ifdef HAVE_LZO
59    comp_stream_header ch;
60 #endif
61
62 };
63
64 bool crypto_setup_digests(bctx_t &bctx);
65 bool crypto_terminate_digests(bctx_t &bctx);
66 bool crypto_session_start(JCR *jcr);
67 void crypto_session_end(JCR *jcr);
68 bool crypto_session_send(JCR *jcr, BSOCK *sd);
69 bool crypto_allocate_ctx(bctx_t &bctx);
70 void crypto_free(bctx_t &bctx);
71
72 bool encode_and_send_attributes(bctx_t &bctx);
73
74 bool process_and_send_data(bctx_t &bctx);
75
76 #ifdef HAVE_WIN32
77 DWORD WINAPI read_efs_data_cb(PBYTE pbData, PVOID pvCallbackContext, ULONG ulLength);
78 #endif
79
80 #endif