SNMP Configuration and Management Manual
Trap Multiplexer Subagent/Manager
SNMP Configuration and Management Manual—424777-006
12-69
Application Source Code
/* Open the new process to pass this startup message */
ccval = FILE_OPEN_(proc_name, /* file name */ <-- 43
proc_len, /* length */
&distr); /* file number */
if (ccval)
{
printf ("FILE_OPEN_ returned %d\n", ccval);
exit (1);
}
/* Add "TYPE CONSUMER" to startup msg to send to EMSDIST */
strcat (ci_startup.param, "TYPE CONSUMER"); <-- 44
/* Now write the startup struct */
ccval = WRITEREADX (distr, /* file number */
(char*)&ci_startup, /* buffer */
(short)(sizeof(startup_msg_type) /* write-count */
- sizeof(ci_startup.param)
+ strlen ("TYPE CONSUMER") + 1),
0); /* read-count */
FILE_GETINFO_ (distr, (short*)&error);
if ( ! ( error == 0 || error == 70 ))
{
printf ("WRITEREADX returned error: %d\n", error);
exit (1);
}
/* We can now close the distributor */
FILE_CLOSE_ (distr); <-- 45
/* Prepare to reopen the distributor using spi-interface */
proc_name[proc_len] = '\0';
strcat (proc_name, ".#ZSPI");
ccval = FILE_OPEN_(proc_name, /* file name */
(short)(proc_len+strlen(".#ZSPI")), /* length */
(short*)&distr); /* file number */
if (ccval)
{
printf ("FILE_OPEN_ returned : %d\n", ccval);
exit(1);
}
/* Tell collector to use log files as event-message source */
spi_cmd_set_source (spi_buf, coll_name_Cxx, distr); <-- 46
/* Load filter and filter parameters into the distributor */
spi_cmd_load_filter (spi_buf, filt_name_Cxx, distr); <-- 47
/* start collecting the EMS events */
getevent_loop (spi_buf, distr); <-- 48
/* close the distributor */
FILE_CLOSE_ (distr);
} /* main */
Example 12-3. Sample Application Source Code (page 14 of 14)