#define PLUGIN_DESCRIPTION "Test File Daemon Plugin"
/* Forward referenced functions */
-static bpError newPlugin(bpContext *ctx);
-static bpError freePlugin(bpContext *ctx);
-static bpError getPluginValue(bpContext *ctx, pVariable var, void *value);
-static bpError setPluginValue(bpContext *ctx, pVariable var, void *value);
-static bpError handlePluginEvent(bpContext *ctx, bEvent *event, void *value);
+static bRC newPlugin(bpContext *ctx);
+static bRC freePlugin(bpContext *ctx);
+static bRC getPluginValue(bpContext *ctx, pVariable var, void *value);
+static bRC setPluginValue(bpContext *ctx, pVariable var, void *value);
+static bRC handlePluginEvent(bpContext *ctx, bEvent *event, void *value);
+static bRC startPluginBackup(bpContext *ctx, struct save_pkt *sp);
+static bRC endPluginBackup(bpContext *ctx);
+static bRC pluginIO(bpContext *ctx, struct io_pkt *io);
+static bRC startRestoreFile(bpContext *ctx, const char *cmd);
+static bRC endRestoreFile(bpContext *ctx);
+static bRC createFile(bpContext *ctx, struct restore_pkt *rp);
+static bRC setFileAttributes(bpContext *ctx, struct restore_pkt *rp);
/* Pointers to Bacula functions */
freePlugin, /* free plugin instance */
getPluginValue,
setPluginValue,
- handlePluginEvent
+ handlePluginEvent,
+ startPluginBackup,
+ endPluginBackup,
+ startRestoreFile,
+ endRestoreFile,
+ pluginIO,
+ createFile,
+ setFileAttributes
};
-bpError loadPlugin(bInfo *lbinfo, bFuncs *lbfuncs, pInfo **pinfo, pFuncs **pfuncs)
+bRC loadPlugin(bInfo *lbinfo, bFuncs *lbfuncs, pInfo **pinfo, pFuncs **pfuncs)
{
bfuncs = lbfuncs; /* set Bacula funct pointers */
binfo = lbinfo;
*pinfo = &pluginInfo; /* return pointer to our info */
*pfuncs = &pluginFuncs; /* return pointer to our functions */
- return 0;
+ return bRC_OK;
}
-bpError unloadPlugin()
+bRC unloadPlugin()
{
printf("plugin: Unloaded\n");
- return 0;
+ return bRC_OK;
}
-static bpError newPlugin(bpContext *ctx)
+static bRC newPlugin(bpContext *ctx)
{
int JobId = 0;
bfuncs->getBaculaValue(ctx, bVarJobId, (void *)&JobId);
// printf("plugin: newPlugin JobId=%d\n", JobId);
bfuncs->registerBaculaEvents(ctx, 1, 2, 0);
- return 0;
+ return bRC_OK;
}
-static bpError freePlugin(bpContext *ctx)
+static bRC freePlugin(bpContext *ctx)
{
int JobId = 0;
bfuncs->getBaculaValue(ctx, bVarJobId, (void *)&JobId);
// printf("plugin: freePlugin JobId=%d\n", JobId);
- return 0;
+ return bRC_OK;
}
-static bpError getPluginValue(bpContext *ctx, pVariable var, void *value)
+static bRC getPluginValue(bpContext *ctx, pVariable var, void *value)
{
// printf("plugin: getPluginValue var=%d\n", var);
- return 0;
+ return bRC_OK;
}
-static bpError setPluginValue(bpContext *ctx, pVariable var, void *value)
+static bRC setPluginValue(bpContext *ctx, pVariable var, void *value)
{
// printf("plugin: setPluginValue var=%d\n", var);
- return 0;
+ return bRC_OK;
}
-static bpError handlePluginEvent(bpContext *ctx, bEvent *event, void *value)
+static bRC handlePluginEvent(bpContext *ctx, bEvent *event, void *value)
{
char *name;
+
switch (event->eventType) {
case bEventJobStart:
printf("plugin: JobStart=%s\n", (char *)value);
case bEventBackupEnd:
printf("plugin: BackupEnd\n");
break;
- case bEventPluginCommand:
- printf("plugin: command=%s\n", (char *)value);
- break;
case bEventLevel:
printf("plugin: JobLevel=%c %d\n", (int)value, (int)value);
break;
case bEventSince:
printf("plugin: since=%d\n", (int)value);
break;
+ case bEventRestoreStart:
+ printf("bpipe-fd: RestoreStart\n");
+ break;
+ case bEventRestoreEnd:
+ printf("bpipe-fd: RestoreEnd\n");
+ break;
+
+ /* Plugin command e.g. plugin = <plugin-name>:<name-space>:command */
+ case bEventPluginCommand:
+ printf("plugin: command=%s\n", (char *)value);
+ break;
+
default:
printf("plugin: unknown event=%d\n", event->eventType);
}
// printf("FD Name=%s\n", name);
// bfuncs->JobMessage(ctx, __FILE__, __LINE__, 1, 0, "JobMesssage message");
// bfuncs->DebugMessage(ctx, __FILE__, __LINE__, 1, "DebugMesssage message");
- return 0;
+ return bRC_OK;
+}
+
+static bRC startPluginBackup(bpContext *ctx, struct save_pkt *sp)
+{
+ return bRC_OK;
+}
+
+static bRC endPluginBackup(bpContext *ctx)
+{
+ return bRC_OK;
}
+/*
+ * Do actual I/O
+ */
+static bRC pluginIO(bpContext *ctx, struct io_pkt *io)
+{
+ io->status = 0;
+ io->io_errno = 0;
+ switch(io->func) {
+ case IO_OPEN:
+ printf("plugin: IO_OPEN\n");
+ break;
+ case IO_READ:
+ printf("plugin: IO_READ buf=%p len=%d\n", io->buf, io->count);
+ break;
+ case IO_WRITE:
+ printf("plugin: IO_WRITE buf=%p len=%d\n", io->buf, io->count);
+ break;
+ case IO_CLOSE:
+ printf("plugin: IO_CLOSE\n");
+ break;
+ }
+ return bRC_OK;
+}
+
+static bRC startRestoreFile(bpContext *ctx, const char *cmd)
+{
+ return bRC_OK;
+}
+
+static bRC endRestoreFile(bpContext *ctx)
+{
+ return bRC_OK;
+}
+
+static bRC createFile(bpContext *ctx, struct restore_pkt *rp)
+{
+ return bRC_OK;
+}
+
+static bRC setFileAttributes(bpContext *ctx, struct restore_pkt *rp)
+{
+ return bRC_OK;
+}
+
+
#ifdef __cplusplus
}
#endif