Writing Monitors for the Event Monitoring Service (December 1999)
Chapter 2 55
The EMS Application Programming Interface (API)
Function Descriptions
Examples
Examples of using rm_set() with the various data type are given below.
The model is similar to that provided by printf(3S) (where %d means the
argument is a value and %s says it is an address).
1. RmTargetPort is a ubit16 type. The data is passed by value.
/* Example 1 */
rm_set(obj, RmTargetPort, 5707, &error_code);
/* Example 2 */
ubit32 port = 5707;
rm_set(obj, RmTargetPort, port, &error_code);
2. RmMsgTag is a ubit32 type. The data is passed by value.
/* Example 1 */
rm_set(obj, RmMsgTag, 4000, &error_code);
/* Example 2 */
ubit32 msg_tag = 4000;
rm_set(obj, RmMsgTag, msg_tag, &error_code);
3. RmDescription is a char * type. The data is passed by reference.
/* Example 1 */
rm_set(obj, RmDescription, “This is a description”,
&error_code);
/* Example 2 */
char description[256];
strcpy(description, “This is a second description”);
rm_set(obj, RmDescription, description, &error_code);
/* Example 3 */
char *description = “This is a third description”;
rm_set(obj, RmDescription, description, &error_code);
4. RmThresholdValue is an rm_value_type * type. The data is passed
by reference. Note that the type must be set before the value is set.
/* Example 1 -- An integer threshold value */
rm_value_type threshold_value;
threshold_value.u32 = 95;
rm_set(obj, RmThresholdType, RM_UBIT32_TYPE, &error_code);
rm_set(obj, RmThresholdValue, threshold_value,
&error_code); /* WRONG */
rm_set(obj, RmThresholdValue, &threshold_value,