*
*/
-#ifndef __PLUGIN_H
-#define __PLUGIN_H
+#ifndef __PLUGIN_FD_H
+#define __PLUGIN_FD_H
#include <sys/types.h>
#ifndef __CONFIG_H
#include "config.h"
#endif
#include "bc_types.h"
+#include "lib/plugin.h"
#ifdef __cplusplus
extern "C" {
#endif
-/****************************************************************************
- * *
- * Common definitions *
- * *
- ****************************************************************************/
-
-/* Universal return code from all functions */
-typedef int32_t bpError;
-
-/* Context packet as first argument of all functions */
-typedef struct s_bpContext {
- void *bContext; /* Bacula private context */
- void *pContext; /* Plugin private context */
-} bpContext;
-
-
/****************************************************************************
* *
* Bacula definitions *
/* Bacula interface version and function pointers */
typedef struct s_baculaFuncs {
uint32_t size;
- uint32_t version;
- bpError (*bGetValue)(bpContext *ctx, bVariable var, void *value);
- bpError (*bSetValue)(bpContext *ctx, bVariable var, void *value);
- bpError (*bMemAlloc)(bpContext *ctx, uint32_t size, char *addr);
- bpError (*bMemFree)(bpContext *ctx, char *addr);
- bpError (*bMemFlush)(bpContext *ctx);
- bpError (*bVersion)(bVariable var, void *value);
+ uint32_t interface;
+ bpError (*getBaculaValue)(bpContext *ctx, bVariable var, void *value);
+ bpError (*setBaculaValue)(bpContext *ctx, bVariable var, void *value);
+ bpError (*allocBaculaMem)(bpContext *ctx, uint32_t size, char *addr);
+ bpError (*freeBaculaMem)(bpContext *ctx, char *addr);
} bFuncs;
} pVariable;
+#define PLUGIN_MAGIC "*PluginData*"
+#define PLUGIN_INTERFACE 1
+
typedef struct s_pluginFuncs {
uint32_t size;
- uint32_t version;
- bpError (*pNew)(bpContext *ctx);
- bpError (*pDestroy)(bpContext *ctx);
- bpError (*pGetValue)(bpContext *ctx, pVariable var, void *value);
- bpError (*pSetValue)(bpContext *ctx, pVariable var, void *value);
- bpError (*pHandleEvent)(bpContext *ctx, bEvent *event);
+ uint32_t interface;
+ char *plugin_magic;
+ char *plugin_license;
+ char *plugin_author;
+ char *plugin_date;
+ char *plugin_version;
+ char *plugin_description;
+ bpError (*newPlugin)(bpContext *ctx);
+ bpError (*freePlugin)(bpContext *ctx);
+ bpError (*getPluginValue)(bpContext *ctx, pVariable var, void *value);
+ bpError (*setPluginValue)(bpContext *ctx, pVariable var, void *value);
+ bpError (*handlePluginEvent)(bpContext *ctx, bEvent *event);
} pFuncs;
-typedef bpError (*t_bpInitialize)(bFuncs *bfuncs, pFuncs *pfuncs);
-typedef bpError (*t_bpShutdown)(void);
-
+#define pref(plugin) ((pFuncs *)(plugin->pfuncs))
#ifdef __cplusplus
}
#endif
-#endif /* __PLUGIN_H */
+#endif /* __PLUGIN_FD_H */