]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/plugins/dir/plugin-dir.h
A bit of crypto cleanup. More later.
[bacula/bacula] / bacula / src / plugins / dir / plugin-dir.h
index 9fd2d530cc077df7b95e9f7fb39ba5d6522318f3..cc78a42cb628c23a98ede3e091271b600b10b743 100644 (file)
@@ -32,8 +32,8 @@
  *
  */
  
-#ifndef __PLUGIN_H 
-#define __PLUGIN_H
+#ifndef __PLUGIN_FD_
+#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                                        *
@@ -92,13 +77,11 @@ typedef struct s_bEvent {
 /* 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;
 
 
@@ -114,22 +97,29 @@ typedef enum {
 } 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 */