]> git.sur5r.net Git - bacula/bacula/blob - bacula/src/findlib/win32filter.h
Restore win32 dir from Branch-5.2 and update it
[bacula/bacula] / bacula / src / findlib / win32filter.h
1 /*
2    Bacula(R) - The Network Backup Solution
3
4    Copyright (C) 2000-2018 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 /* Pulled from other files by Alain Spineux */
21
22 #ifndef WIN32FILTER_H_
23 #define WIN32FILTER_H_
24
25 #include "bacula.h"
26
27 /* this should physically correspond to WIN32_STREAM_ID
28  * from winbase.h on Win32. We didn't inlcude cStreamName
29  * as we don't use it and don't need it for a correct struct size.
30  */
31
32 #define WIN32_BACKUP_DATA 1
33
34 typedef struct _BWIN32_STREAM_ID {
35         int32_t        dwStreamId;
36         int32_t        dwStreamAttributes;
37         int64_t        Size;
38         int32_t        dwStreamNameSize;
39 } BWIN32_STREAM_ID, *LPBWIN32_STREAM_ID ;
40
41 class Win32Filter
42 {
43 public:
44    bool    initialized;
45    int64_t skip_size;   /* how many bytes we have to skip before next header */
46    int64_t data_size;   /* how many data are expected in the stream */
47    int     header_pos;  /* the part of the header that was filled in by previous record */
48
49    BWIN32_STREAM_ID header;
50
51    Win32Filter() {
52       init();
53    };
54    
55    void init() {
56       initialized = false;
57       skip_size = 0;
58       data_size = 0;
59       header_pos = 0;
60    };
61
62    void copy(Win32Filter *f)
63    {
64       skip_size = f->skip_size;
65       data_size = f->data_size;
66       header_pos = f->header_pos;
67       header = f->header;
68       initialized = (skip_size != 0  ||
69                      data_size != 0  ||
70                      header_pos != 0);
71    };
72
73    /* If the stream is HHHDDDDD, you can call  have_data("HHHDDDDD", 8, <not used>)
74     * and it will return  "DDDDD", 0, 5
75     */
76    bool have_data(char **raw, int64_t *raw_len, int64_t *data_len);
77 };
78
79 #endif