SNMP_ALARMSection: C Library Functions (3)
Updated: 26 Jan 2000
Return to Main Contents
NAMEsnmp_alarm_register, snmp_alarm_unregister, init_snmp_alarm, init_alarm_post_config - alarm functions
The usage is fairly simple and straight-forward: Simply create a function you want called back at some point in the future. The function definition should be similar to:
void my_callback_func(unsigned int registrationNumber, void *clientarg);
Then, call snmp_alarm_register() to register your callback to be called seconds from now. The flags field should either be SA_REPEAT or NULL. If flags is set with SA_REPEAT, then the registered callback function will be called every seconds. If the SA_REPEAT flag is not set, then the function will only be called once and removed from the alarm system registration.
The clientarg parameter in the registration function is used only be th client function and is stored and passed back directly to them on every call to the system.
The snmp_alarm_register() function returns a unique unsigned int (which is also passed to the callback function on each call), which can then be used to remove the callback from the queue at a later point in the future using the snmp_alarm_unregister() function. If the snmp_alarm_register() call fails it returns zero.
INITIALIZATIONThe init_snmp_alarm() function initializes the routines, but a call to init_alarm_post_config() should be called even later and sets up the first timer to initialize the callback function. These two functions should not be used directly by applications, but are instead used by the init_snmp() function which you should call instead.
NOTESInternally, the snmp_alarm system uses the SIGALRM signal and therefore no other part of the application should be using the regular system based alarm() function.
This document was created by man2html, using the manual pages.
Time: 07:10:44 GMT, June 18, 2013