Syntax for C++ attr_changed

void

res_attr_changed(const char *res_name, const char

*changed_res_name,

const char *changed_attr_name,

void **new_val);

The parameter new_val contains the attribute's new value. The encoding of new_val is similar to the encoding of the About the ArgList and ArgListValues attributes.

You may select any name for the function.

Set the VCSAgValidateAndSetEntryPoint() parameter to the name of the entry point's function.

In the following example, the function res_attr_changed is defined as the attr_changed entry point.

Note   This entry point is called only if you register for change notification using the primitive VCSAgRegister, or the agent parameter RegList (see RegList).

For example:

#include "VCSAgApi.h"

void

res_attr_changed(const char *res_name,

const char *changed_res_name,

const char *changed_attr_name,

void **new_val) {

// When the value of attribute Foo changes, take some action.

if ((strcmp(res_name, changed_res_name) == 0) &&

(strcmp(changed_attr_name, "Foo") == 0)) {

// Extract the new value of Foo. Here, it is assumed

// to be a string.

const char *foo_val = (char *)new_val[0];

// Implement the action.

...

}

// Resource Ora1 managed by this agent needs to

// take some action when the Size attribute of

// the resource Disk1 is changed.

if ((strcmp(res_name, "Ora1") == 0) &&

(strcmp(changed_attr_name, "Size") == 0) &&

(strcmp(changed_res_name, "Disk1") == 0)) {

// Extract the new value of Size. Here, it is

// assumed to be an integer.

int sizeval = atoi((char *)new_val[0]);

// Implement the action.

...

}

}

void VCSAgStartup()

{

VCSAG_LOG_INIT("VCSAgStartup");

VCSAgSetLogCategory(10051);

VCSAgInitEntryPointStruct(V50);

VCSAgValidateAndSetEntryPoint(VCSAgEPMonitor, res_monitor);

VCSAgValidateAndSetEntryPoint(VCSAgEPOnline, res_online);

VCSAgValidateAndSetEntryPoint(VCSAgEPOffline, res_offline);

VCSAgValidateAndSetEntryPoint(VCSAgEPClean, res_clean);

}