]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/filed/backup.h
Use Bacula in place of Libz variables so we can build with/without libz and lzo
[bacula/bacula] / bacula / src / filed / backup.h
1 /*
2    Bacula(R) - The Network Backup Solution
3
4    Copyright (C) 2000-2017 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 __BACKUP_H
21 #define __BACKUP_H
22
23 #include "ch.h"
24
25 /*
26  * Define a backup context
27  */
28 struct bctx_t {
29    /* Global variables */
30    JCR *jcr;
31    FF_PKT *ff_pkt;                    /* find file packet */
32    int data_stream;
33    BSOCK *sd;
34    uint64_t fileAddr;
35    char *rbuf, *wbuf;
36    int32_t rsize;
37    POOLMEM *msgsave;
38
39    /* Crypto variables */
40    DIGEST *digest;
41    DIGEST *signing_digest;
42    int digest_stream;
43    SIGNATURE *sig;
44    CIPHER_CONTEXT *cipher_ctx;
45    const uint8_t *cipher_input;
46    uint32_t cipher_input_len;
47    uint32_t cipher_block_size;
48    uint32_t encrypted_len;
49
50    /* Compression variables */
51    /* These are the same as used by libz, but I find it very
52     *  uncomfortable to define variables like this rather than
53     *  specifying a number of bits. Defining them here allows us
54     *  to have code that compiles with and without libz and lzo.
55     *
56     *  uLong == unsigned long int
57     *  Bytef == unsigned char
58     */
59    unsigned long int max_compress_len;
60    unsigned long int compress_len;
61    unsigned char *cbuf;
62    unsigned char *cbuf2;
63
64 #ifdef HAVE_LZO
65    comp_stream_header ch;
66 #endif
67
68 };
69
70 bool crypto_setup_digests(bctx_t &bctx);
71 bool crypto_terminate_digests(bctx_t &bctx);
72 bool crypto_session_start(JCR *jcr);
73 void crypto_session_end(JCR *jcr);
74 bool crypto_session_send(JCR *jcr, BSOCK *sd);
75 bool crypto_allocate_ctx(bctx_t &bctx);
76 void crypto_free(bctx_t &bctx);
77
78 bool encode_and_send_attributes(bctx_t &bctx);
79
80 bool process_and_send_data(bctx_t &bctx);
81
82 #ifdef HAVE_WIN32
83 DWORD WINAPI read_efs_data_cb(PBYTE pbData, PVOID pvCallbackContext, ULONG ulLength);
84 #endif
85
86 #endif