Beispiel #1
0
static inline bRC trigger_plugin_event(JCR *jcr, bsdEventType eventType, bsdEvent *event, bpContext *ctx, void *value)
{
   if (!is_event_enabled(ctx, eventType)) {
      Dmsg1(dbglvl, "Event %d disabled for this plugin.\n", eventType);
      return bRC_OK;
   }

   if (is_plugin_disabled(ctx)) {
      Dmsg0(dbglvl, "Plugin disabled.\n");
      return bRC_OK;
   }

   return sdplug_func(ctx->plugin)->handlePluginEvent(ctx, event, value);
}
Beispiel #2
0
static inline bRC trigger_plugin_event(JCR *jcr, bDirEventType eventType, bDirEvent *event,
                                       Plugin *plugin, bpContext *plugin_ctx_list,
                                       int index, void *value)
{
    bpContext *ctx;

    ctx = &plugin_ctx_list[index];
    if (!is_event_enabled(ctx, eventType)) {
        Dmsg1(dbglvl, "Event %d disabled for this plugin.\n", eventType);
        return bRC_OK;
    }

    if (is_plugin_disabled(ctx)) {
        Dmsg0(dbglvl, "Plugin disabled.\n");
        return bRC_OK;
    }

    return dirplug_func(plugin)->handlePluginEvent(ctx, event, value);
}
Beispiel #3
0
static inline bool trigger_plugin_event(JCR *jcr, bDirEventType eventType,
                                        bDirEvent *event, bpContext *ctx,
                                        void *value, alist *plugin_ctx_list,
                                        int *index, bRC *rc)
{
   bool stop = false;

   if (!is_event_enabled(ctx, eventType)) {
      Dmsg1(dbglvl, "Event %d disabled for this plugin.\n", eventType);
      goto bail_out;
   }

   if (is_plugin_disabled(ctx)) {
      Dmsg0(dbglvl, "Plugin disabled.\n");
      goto bail_out;
   }

   /*
    * See if we should care about the return code.
    */
   if (rc) {
      *rc = dirplug_func(ctx->plugin)->handlePluginEvent(ctx, event, value);
      switch (*rc) {
      case bRC_OK:
         break;
      case bRC_Stop:
      case bRC_Error:
         stop = true;
         break;
      case bRC_More:
         break;
      case bRC_Term:
         /*
          * Request to unload this plugin.
          * As we remove the plugin from the list of plugins we decrement
          * the running index value so the next plugin gets triggered as
          * that moved back a position in the alist.
          */
         if (index) {
            unload_plugin(plugin_ctx_list, ctx->plugin, *index);
            *index = ((*index) - 1);
         }
         break;
      case bRC_Seen:
         break;
      case bRC_Core:
         break;
      case bRC_Skip:
         stop = true;
         break;
      case bRC_Cancel:
         break;
      default:
         break;
      }
   } else {
      dirplug_func(ctx->plugin)->handlePluginEvent(ctx, event, value);
   }

bail_out:
   return stop;
}