int level, const char *msg);
} bFuncs;
-/* Bacula Subroutines */
+/* Bacula Core Routines -- not used within a plugin */
+#ifdef DIRECTOR_DAEMON
void load_dir_plugins(const char *plugin_dir);
void new_plugins(JCR *jcr);
void free_plugins(JCR *jcr);
void generate_plugin_event(JCR *jcr, bEventType event, void *value=NULL);
-
+#endif
/****************************************************************************
--- /dev/null
+#
+# Simple Makefile for building test FD plugins for Bacula
+#
+# Version $Id: Makefile.in 7841 2008-10-19 10:34:03Z kerns $
+#
+@MCOMMON@
+
+
+# No optimization for now for easy debugging
+
+DIRDIR=../../dird
+SRCDIR=../..
+LIBDIR=../../lib
+
+.SUFFIXES: .c .o .lo
+
+.c.o:
+ $(CXX) $(DEFS) $(DEBUG) $(CPPFLAGS) -I${SRCDIR} -I${DIRDIR} -DTEST_PROGRAM -c $<
+
+.c.lo:
+ $(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) $(CPPFLAGS) -I${SRCDIR} -I${DIRDIR} -DTEST_PROGRAM -c $<
+
+all: example-plugin-dir$(DEFAULT_SHARED_OBJECT_TYPE)
+
+test: main example-plugin-dir.so
+
+dir_plugins.o: ${DIRDIR}/dir_plugins.h ${DIRDIR}/dir_plugins.c
+ $(CXX) -I${SRCDIR} -I${DIRDIR} -DTEST_PROGRAM -c ${DIRDIR}/dir_plugins.c
+
+main: dir_plugins.o
+ $(CXX) $(LDFLAGS) -L${LIBDIR} dir_plugins.o -o main -lbac -lpthread -lssl -l crypto -ldl
+
+example-plugin-dir.o: example-plugin-dir.c ${DIRDIR}/dir_plugins.h
+ $(CXX) -fPIC -I../.. -I${DIRDIR} -c example-plugin-fd.c
+
+example-plugin-dir.so: example-plugin-dir.o
+ $(CXX) $(LDFLAGS) -shared example-plugin-dir.o -o example-plugin-dir.so
+
+example-plugin-dir.lo: example-plugin-dir.c ${DIRDIR}/dir_plugins.h
+ $(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) $(CFLAGS) -I../.. -I${DIRDIR} -c example-plugin-dir.c
+
+example-plugin-dir.la: Makefile example-plugin-dir$(DEFAULT_OBJECT_TYPE)
+ $(LIBTOOL_COMPILE) $(CXX) $(DEFS) $(DEBUG) $(CFLAGS) -I../.. -I${DIRDIR} -c example-plugin-dir.c
+
+install: all
+ $(MKDIR) $(DESTDIR)$(plugindir)
+ $(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) example-plugin-dir$(DEFAULT_SHARED_OBJECT_TYPE) $(DESTDIR)$(plugindir)
+ $(RMF) $(DESTDIR)$(plugindir)/example-plugin-dir.la
+
+libtool-clean:
+ find . -name '*.lo' -print | xargs $(LIBTOOL_CLEAN) $(RMF)
+ $(RMF) *.la
+ $(RMF) -r .libs _libs
+
+clean: @LIBTOOL_CLEAN_TARGET@
+ rm -f main *.so *.o 1 2 3
+
+distclean: clean
+ rm -f Makefile
+
+uninstall:
+ $(RMF) $(DESTDIR)$(plugindir)/example-plugin-dir.so
+
+depend:
the code in any way.
*/
-#include <stdio.h>
+#include "bacula.h"
#include "fd_plugins.h"
#ifdef __cplusplus
printf("plugin: BackupEnd\n");
break;
case bEventLevel:
- printf("plugin: JobLevel=%c %d\n", (int)value, (int)value);
+ printf("plugin: JobLevel=%c %d\n", *(int*)value, *(int*)value);
break;
case bEventSince:
- printf("plugin: since=%d\n", (int)value);
+ printf("plugin: since=%d\n", *(int*)value);
break;
case bEventStartRestoreJob:
printf("plugin: StartRestoreJob\n");