Writing Monitors for the Event Monitoring Service (December 1999)

Chapter 3 103
Creating a Resource Monitor
Processing a Monitor Request Event
* /samples/string
* /samples/sbit32
* /samples/ubit32
* /samples/float64
* /samples/enum
* Checks that polling interval requested is greater than minimum.
*
* Parms:
* obj The object that was created by rm_get_next_event().
* This object is destroyed outside of this function.
*
* Returns:
* 0 Upon success
* !=0 Otherwise
*/
int send_monitor_reply(rm_object_addr obj)
{
rm_error_type error_code;
char *resource_name;
int rc;
ubit32 polling_int;
int error_reply = 0;
rm_get(obj, RmResourceName, &resource_name, &error_code);
/***************************************************************************/
/* Assume success. */
/***************************************************************************/
rc = rm_set(obj, RmMonitorReply, RM_ACCEPT, &error_code);
if (rc == -1) {
rm_perror("", error_code);
return -1;
}
/*************************************************************************/
/* Check that the resource requested is one we support. */
/*************************************************************************/
if (strcmp(resource_name, "/samples/string") == 0)
{