2 Bacula® - The Network Backup Solution
4 Copyright (C) 2010-2011 Bacula Systems(R) SA
6 The main author of Bacula is Kern Sibbald, with contributions from
7 many others, a complete list can be found in the file AUTHORS.
8 This program is Free Software; you can redistribute it and/or
9 modify it under the terms of version three of the GNU Affero General Public
10 License as published by the Free Software Foundation, which is
11 listed in the file LICENSE.
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU Affero General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
23 Bacula® is a registered trademark of Kern Sibbald.
24 The licensor of Bacula is the Free Software Foundation Europe
25 (FSFE), Fiduciary Program, Sumatrastrasse 25, 8006 Zürich,
26 Switzerland, email:ftf@fsfeurope.org.
29 * Written by James Harper, October 2008
32 #ifndef _EXCHANGE_FD_H
33 #define _EXCHANGE_FD_H
37 #if defined(BUILDING_DLL)
38 # define DLL_IMP_EXP __declspec(dllexport)
39 #elif defined(USING_DLL)
40 # define DLL_IMP_EXP __declspec(dllimport)
45 #if defined(HAVE_WIN32)
46 #if defined(HAVE_MINGW)
47 #include "mingwconfig.h"
49 #include "winconfig.h"
57 /* Keep M_ABORT=1 for dlist.h */
58 M_ABORT = 1, /* MUST abort immediately */
59 M_DEBUG, /* debug message */
60 M_FATAL, /* Fatal error, stopping job */
61 M_ERROR, /* Error, but recoverable */
62 M_WARNING, /* Warning message */
63 M_INFO, /* Informational message */
64 M_SAVED, /* Info on saved file */
65 M_NOTSAVED, /* Info on notsaved file */
66 M_SKIPPED, /* File skipped during backup by option setting */
67 M_MOUNT, /* Mount requests */
68 M_ERROR_TERM, /* Error termination request (no dump) */
69 M_TERM, /* Terminating daemon normally */
70 M_RESTORED, /* ls -l of restored files */
71 M_SECURITY, /* security violation */
72 M_ALERT, /* tape alert messages */
73 M_VOLMGMT /* Volume management messages */
80 #define _THREAD_SAFE 1
81 #define _POSIX_PTHREAD_SEMANTICS 1
88 #include <sys/types.h>
89 #ifdef HAVE_SYS_BITYPES_H
90 #include <sys/bitypes.h>
95 #include "win32/compat/compat.h"
98 typedef int64_t boffset_t;
99 //#define bstrdup(str) strcpy((char *)bmalloc(strlen((str))+1),(str))
100 #define bstrdup(str) strdup(str)
102 #include "fd_plugins.h"
105 #if defined(HAVE_WIN32)
106 #include "win32/winapi.h"
112 #define EXCHANGE_PLUGIN_VERSION 1
114 #define JOB_TYPE_BACKUP 1
115 #define JOB_TYPE_RESTORE 2
117 #define JOB_LEVEL_FULL ((int)'F')
118 #define JOB_LEVEL_INCREMENTAL ((int)'I')
119 #define JOB_LEVEL_DIFFERENTIAL ((int)'D')
121 struct exchange_fd_context_t;
125 struct exchange_fd_context_t {
126 struct bpContext *bpContext;
127 WCHAR *computer_name;
129 root_node_t *root_node;
130 node_t *current_node;
134 bool notrunconfull_option;
140 static inline char *tocharstring(WCHAR *src)
142 char *tmp = new char[wcslen(src) + 1];
143 wcstombs(tmp, src, wcslen(src) + 1);
147 static inline WCHAR *towcharstring(char *src)
149 WCHAR *tmp = new WCHAR[strlen(src) + 1];
150 mbstowcs(tmp, src, strlen(src) + 1);
155 extern bFuncs *bfuncs;
158 #define _DebugMessage(level, message, ...) bfuncs->DebugMessage(context->bpContext, __FILE__, __LINE__, level, message, ##__VA_ARGS__)
159 #define _JobMessage(type, message, ...) bfuncs->JobMessage(context->bpContext, __FILE__, __LINE__, type, 0, message, ##__VA_ARGS__)
160 #define _JobMessageNull(type, message, ...) bfuncs->JobMessage(NULL, __FILE__, __LINE__, type, 0, message, ##__VA_ARGS__)
162 #define PLUGIN_PATH_PREFIX_BASE "@EXCHANGE"
163 #define PLUGIN_PATH_PREFIX_SERVICE "Microsoft Information Store"
164 #define PLUGIN_PATH_PREFIX_SERVICE_W L"Microsoft Information Store"
166 #endif /* _EXCHANGE_FD_H */