*((char **)value) = jcr->Job;
Dmsg1(dbglvl, "Bacula: return bVarJobName=%s\n", jcr->Job);
break;
+ case bVarJob:
+ *((char **)value) = jcr->job->hdr.name;
+ Dmsg1(dbglvl, "Bacula: return bVarJob=%s\n", jcr->job->hdr.name);
+ break;
+ case bVarLevel:
+ *((int *)value) = jcr->get_JobLevel();
+ Dmsg1(dbglvl, "Bacula: return bVarLevel=%c\n", jcr->get_JobLevel());
+ break;
+ case bVarType:
+ *((int *)value) = jcr->get_JobType();
+ Dmsg1(dbglvl, "Bacula: return bVarType=%c\n", jcr->get_JobType());
+ break;
+ case bVarClient:
+ *((char **)value) = jcr->client->hdr.name;
+ Dmsg1(dbglvl, "Bacula: return bVarClient=%s\n", jcr->client->hdr.name);
+ break;
+ case bVarNumVols:
+ POOL_DBR pr;
+ memset(&pr, 0, sizeof(pr));
+ bstrncpy(pr.Name, jcr->pool->hdr.name, sizeof(pr.Name));
+ if (!db_get_pool_record(jcr, jcr->db, &pr)) {
+ ret=bRC_Error;
+ }
+ *((int *)value) = pr.NumVols;
+ Dmsg1(dbglvl, "Bacula: return bVarNumVols=%d\n", pr.NumVols);
+ break;
+ case bVarPool:
+ *((char **)value) = jcr->pool->hdr.name;
+ Dmsg1(dbglvl, "Bacula: return bVarPool=%s\n", jcr->pool->hdr.name);
+ break;
+ case bVarStorage:
+ if (jcr->wstore) {
+ *((char **)value) = jcr->wstore->hdr.name;
+ } else if (jcr->rstore) {
+ *((char **)value) = jcr->rstore->hdr.name;
+ } else {
+ *((char **)value) = NULL;
+ ret=bRC_Error;
+ }
+ Dmsg1(dbglvl, "Bacula: return bVarStorage=%s\n", NPRT(*((char **)value)));
+ break;
+ case bVarWriteStorage:
+ if (jcr->wstore) {
+ *((char **)value) = jcr->wstore->hdr.name;
+ } else {
+ *((char **)value) = NULL;
+ ret=bRC_Error;
+ }
+ Dmsg1(dbglvl, "Bacula: return bVarWriteStorage=%s\n", NPRT(*((char **)value)));
+ break;
+ case bVarReadStorage:
+ if (jcr->rstore) {
+ *((char **)value) = jcr->rstore->hdr.name;
+ } else {
+ *((char **)value) = NULL;
+ ret=bRC_Error;
+ }
+ Dmsg1(dbglvl, "Bacula: return bVarReadStorage=%s\n", NPRT(*((char **)value)));
+ break;
+ case bVarCatalog:
+ *((char **)value) = jcr->catalog->hdr.name;
+ Dmsg1(dbglvl, "Bacula: return bVarCatalog=%s\n", jcr->catalog->hdr.name);
+ break;
+ case bVarMediaType:
+ if (jcr->wstore) {
+ *((char **)value) = jcr->wstore->media_type;
+ } else if (jcr->rstore) {
+ *((char **)value) = jcr->rstore->media_type;
+ } else {
+ *((char **)value) = NULL;
+ ret=bRC_Error;
+ }
+ Dmsg1(dbglvl, "Bacula: return bVarMediaType=%s\n", NPRT(*((char **)value)));
+ break;
+ case bVarJobStatus:
+ *((int *)value) = jcr->JobStatus;
+ Dmsg1(dbglvl, "Bacula: return bVarJobStatus=%c\n", jcr->JobStatus);
+ break;
+ case bVarPriority:
+ *((int *)value) = jcr->JobPriority;
+ Dmsg1(dbglvl, "Bacula: return bVarPriority=%d\n", jcr->JobPriority);
+ break;
+ case bVarVolumeName:
+ *((char **)value) = jcr->VolumeName;
+ Dmsg1(dbglvl, "Bacula: return bVarVolumeName=%s\n", jcr->VolumeName);
+ break;
+ case bVarCatalogRes:
+ ret = bRC_Error;
+ break;
+ case bVarJobErrors:
+ *((int *)value) = jcr->JobErrors;
+ Dmsg1(dbglvl, "Bacula: return bVarErrors=%d\n", jcr->JobErrors);
+ break;
+ case bVarJobFiles:
+ *((int *)value) = jcr->JobFiles;
+ Dmsg1(dbglvl, "Bacula: return bVarFiles=%d\n", jcr->JobFiles);
+ break;
+ case bVarSDJobFiles:
+ *((int *)value) = jcr->SDJobFiles;
+ Dmsg1(dbglvl, "Bacula: return bVarSDFiles=%d\n", jcr->SDJobFiles);
+ break;
+ case bVarSDErrors:
+ *((int *)value) = jcr->SDErrors;
+ Dmsg1(dbglvl, "Bacula: return bVarSDErrors=%d\n", jcr->SDErrors);
+ break;
+ case bVarFDJobStatus:
+ *((int *)value) = jcr->FDJobStatus;
+ Dmsg1(dbglvl, "Bacula: return bVarFDJobStatus=%c\n", jcr->FDJobStatus);
+ break;
+ case bVarSDJobStatus:
+ *((int *)value) = jcr->SDJobStatus;
+ Dmsg1(dbglvl, "Bacula: return bVarSDJobStatus=%c\n", jcr->SDJobStatus);
+ break;
default:
ret = bRC_Error;
break;
* *
****************************************************************************/
-/* Bacula Variable Ids */
+/* Bacula Variable Ids */ /* return value */
typedef enum {
- bVarJob = 1,
- bVarLevel = 2,
- bVarType = 3,
- bVarJobId = 4,
- bVarClient = 5,
- bVarNumVols = 6,
- bVarPool = 7,
- bVarStorage = 8,
- bVarCatalog = 9,
- bVarMediaType = 10,
- bVarJobName = 11,
- bVarJobStatus = 12,
- bVarPriority = 13,
- bVarVolumeName = 14,
- bVarCatalogRes = 15,
- bVarJobErrors = 16,
- bVarJobFiles = 17,
- bVarSDJobFiles = 18,
- bVarSDErrors = 19,
- bVarFDJobStatus = 20,
- bVarSDJobStatus = 21
+ bVarJob = 1, // string
+ bVarLevel = 2, // int
+ bVarType = 3, // int
+ bVarJobId = 4, // int
+ bVarClient = 5, // string
+ bVarNumVols = 6, // int
+ bVarPool = 7, // string
+ bVarStorage = 8, // string
+ bVarWriteStorage = 9, // string
+ bVarReadStorage = 10, // string
+ bVarCatalog = 11, // string
+ bVarMediaType = 12, // string
+ bVarJobName = 13, // string
+ bVarJobStatus = 14, // int
+ bVarPriority = 15, // int
+ bVarVolumeName = 16, // string
+ bVarCatalogRes = 17, // NYI
+ bVarJobErrors = 18, // int
+ bVarJobFiles = 19, // int
+ bVarSDJobFiles = 20, // int
+ bVarSDErrors = 21, // int
+ bVarFDJobStatus = 22, // int
+ bVarSDJobStatus = 23 // int
} brVariable;
typedef enum {
$(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-dir.c
+ $(CXX) $(DEFS) $(DEBUG) $(CPPFLAGS) -fPIC -I../.. -I${DIRDIR} -c example-plugin-dir.c
example-plugin-dir.so: example-plugin-dir.o
$(CXX) $(LDFLAGS) -shared example-plugin-dir.o -o example-plugin-dir.so
$(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
+ $(LIBTOOL_LINK) $(CXX) $(LDFLAGS) -shared example-plugin-dir.lo -o $@ -rpath $(plugindir) -module -export-dynamic -avoid-version
install: all
$(MKDIR) $(DESTDIR)$(plugindir)
static bRC handlePluginEvent(bpContext *ctx, bEvent *event, void *value)
{
char *name;
+ int val;
switch (event->eventType) {
case bEventJobStart:
printf("plugin: HandleEvent JobStart\n");
break;
case bEventJobEnd:
printf("plugin: HandleEvent JobEnd\n");
+ bfuncs->getBaculaValue(ctx, bVarJob, (void *)&name);
+ printf("plugin: bVarJob=%s\n", name);
+ bfuncs->getBaculaValue(ctx, bVarJobId, (void *)&val);
+ printf("plugin: bVarJobId=%d\n", val);
+ bfuncs->getBaculaValue(ctx, bVarType, (void *)&val);
+ printf("plugin: bVarType=%c\n", val);
+ bfuncs->getBaculaValue(ctx, bVarLevel, (void *)&val);
+ printf("plugin: bVarLevel=%c\n", val);
+ bfuncs->getBaculaValue(ctx, bVarClient, (void *)&name);
+ printf("plugin: bVarClient=%s\n", name);
+ bfuncs->getBaculaValue(ctx, bVarCatalog, (void *)&name);
+ printf("plugin: bVarCatalog=%s\n", name);
+ bfuncs->getBaculaValue(ctx, bVarPool, (void *)&name);
+ printf("plugin: bVarPool=%s\n", name);
+ bfuncs->getBaculaValue(ctx, bVarStorage, (void *)&name);
+ printf("plugin: bVarStorage=%s\n", name);
+ bfuncs->getBaculaValue(ctx, bVarJobErrors, (void *)&val);
+ printf("plugin: bVarJobErrors=%d\n", val);
+ bfuncs->getBaculaValue(ctx, bVarJobFiles, (void *)&val);
+ printf("plugin: bVarJobFiles=%d\n", val);
+ bfuncs->getBaculaValue(ctx, bVarNumVols, (void *)&val);
+ printf("plugin: bVarNumVols=%d\n", val);
+
break;
}
bfuncs->getBaculaValue(ctx, bVarJobName, (void *)&name);
mixed priorities
General:
+13Nov08
+ebl Add more variable accessible through the director plugin
+ interface.
12Nov08
ebl Do work on plugins
- fix compilation of the director plugins