I imagine this is used to handle signals the plugin server receives by
instructing your plugin to handle different signals in different ways.
 The signal is probably your standard POSIX signals (see signal.h).
For example, you may be able to handle a SIGHUP in your plugin and
instruct your plugin to do things like reread it's configuration.

http://en.wikipedia.org/wiki/Signal_(computing)#List_of_signals

Since it's internal there's no telling how well or to what extent it
has been implemented.  It could be a stub, it may only be implemented
for certain signals, etc.

It's a pointer to a function.  You need to do something like this:


#include <signal.h>

void          *fptr;

/** Pointer to plugin server signal handler function */
AR_PLUGIN_REGISTER_FOR_SIGNAL_FUNCTION signalFunc = 0;

signalFunc = (AR_PLUGIN_REGISTER_FOR_SIGNAL_FUNCTION )fptr;


It's similar in concept to the way you retrieve the pointer to the
function for log handling within the plugin, which I always did like
this:

/** Pointer to plugin server native logging function */
AR_PLUGIN_LOG_FUNCTION logFunc = 0;

/** Pointer to plugin server get user function */
AR_PLUGIN_GETUSER_FUNCTION getUserFunc = 0;

...

ARPLUGIN_EXPORT int
ARPluginSetProperties
(
  ARPropList    *propList,
  ARStatusList  *status
)
{
  int            i;
  int            ret;
  void          *fptr;

  /* if the pointer points to nothing, exit */
  if (propList == NULL)
    return AR_RETURN_OK;

  /* walk the list of property items */
  for (i = 0;i < propList->numItems;i++)
  {
    switch (propList->props[i].prop)
    {
      case AR_PLUGIN_PROP_LOG_FUNCTION:
        /* Identify the pointer to the logging function
           for this version of plug-in */
        if (propList->props[i].value.dataType == AR_DATA_TYPE_BYTES
            && propList->props[i].value.u.byteListVal != NULL)
          {
            memcpy (&fptr,
                   (void*) propList->props[i].value.u.byteListVal->bytes,
                   sizeof (void *));
            logFunc = (AR_PLUGIN_LOG_FUNCTION)fptr;
          }
        ret = log_config ("found AR_PLUGIN_PROP_LOG_FUNCTION");
        if (ret == -1)
          return AR_RETURN_ERROR;
        break;
      case AR_PLUGIN_PROP_INSTALL_DIR:
        ret = log_config ("found AR_PLUGIN_PROP_INSTALL_DIR");
        if (ret == -1)
          return AR_RETURN_ERROR;
        break;
      case AR_PLUGIN_PROP_CONFIG_FILE:
        ret = log_config ("found AR_PLUGIN_PROP_CONFIG_FILE");
        if (ret == -1)
          return AR_RETURN_ERROR;
        break;
      case AR_PLUGIN_PROP_GETUSER_FUNCTION:
        /* Identify the pointer to the get_user function
           for this version of plug-in */
        if (propList->props[i].value.dataType == AR_DATA_TYPE_BYTES
            && propList->props[i].value.u.byteListVal != NULL)
          {
            memcpy (&fptr,
                   (void*) propList->props[i].value.u.byteListVal->bytes,
                   sizeof (void *));
            getUserFunc = (AR_PLUGIN_GETUSER_FUNCTION)fptr;
          }
        ret = log_config ("found AR_PLUGIN_PROP_GETUSER_FUNCTION");
        if (ret == -1)
          return AR_RETURN_ERROR;
        break;
      case AR_PLUGIN_PROP_GETAUTHSTRING_FUNCTION:
        ret = log_config ("found AR_PLUGIN_PROP_GETAUTHSTRING_FUNCTION");
        if (ret == -1)
          return AR_RETURN_ERROR;
        break;
      case AR_PLUGIN_PROP_GETUSERAUTHINFO_FUNCTION:
        ret = log_config ("found AR_PLUGIN_PROP_GETUSERAUTHINFO_FUNCTION");
        if (ret == -1)
          return AR_RETURN_ERROR;
        break;
      case AR_PLUGIN_PROP_REGISTERSIGNALHANDLER_FUNCTION:
        ret = log_config ("found
AR_PLUGIN_PROP_REGISTERSIGNALHANDLER_FUNCTION");
        if (ret == -1)
          return AR_RETURN_ERROR;
        break;
      case AR_PLUGIN_PROP_INITTLS_FUNCTION:
        ret = log_config ("found AR_PLUGIN_PROP_INITTLS_FUNCTION");
        if (ret == -1)
          return AR_RETURN_ERROR;
        break;
      default:
        ret = log_config ("found undefined property %i", i);
        if (ret == -1)
          return AR_RETURN_ERROR;
        break;
    }
  }
  return AR_RETURN_OK;
}



Note that the following is the stuff in arplugin.h for AR_PLUGIN_LOG_FUNCTION:

typedef int (*AR_PLUGIN_LOG_FUNCTION)(
        ARPluginIdentification* id,
        int debugLevel, /* IN; the level this mesg is for; See above */
                        /*     "Log level for plug-in logging"       */
        char *text      /* IN; text to output */);

Axton Grams

On Fri, Nov 25, 2011 at 7:35 AM, Danny Kellett
<danny.kell...@strategicworkflow.com> wrote:
> **
>
> Hi,
>
>
>
> Asked BMC Support and they say they couldn’t help as its internal. But the
> following code is in the arplugin.h, distributed with the server install.
>
>
>
> Has anyone tried it?
>
>
>
> Thanks and kind regards
>
>
>
> /* signature for the plugin's signal handler */ typedef void
> (AR_PLUGIN_SIGNAL_HANDLER)(int);
>
>
>
> /* this is the function thats passed to the plugins for registering their
> signal handlers */ typedef void (*AR_PLUGIN_REGISTER_FOR_SIGNAL_FUNCTION)(
>
>                int signalId,                          /* IN; the signal Id
> the handler is meant for */
>
>                AR_PLUGIN_SIGNAL_HANDLER *signalHandler /* IN; pointer to the
> handler function        */
>
>
>
> Danny
>
> _attend WWRUG12 www.wwrug.com ARSlist: "Where the Answers Are"_

_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
attend wwrug12 www.wwrug12.com ARSList: "Where the Answers Are"

Reply via email to