.TH SNMP_ALARM 3 "26 Jan 2000" .UC 5 .SH NAME snmp_alarm_register, snmp_alarm_unregister, init_snmp_alarm, int init_alarm_post_config - alarm functions .SH SYNOPSIS .B #include .PP .B " unsigned int" .br .B " snmp_alarm_register(unsigned int seconds," .br .B " unsigned int flags," .br .B " SNMPAlarmCallback *thecallback," .br .B " void *clientarg)" .PP .B " void .br .B " snmp_alarm_unregister(unsigned int registrationNumber)" .PP .B " void .br .B " init_snmp_alarm(void)" .PP .B " void" .br .B " init_alarm_post_config(0,0,NULL,NULL);" .PP .SH DESCRIPTION .PP These functions implement support for a generic timer handling mechanism for multiple parts of an application to register function callbacks to happen at a particular time in the future. .SH USAGE .PP 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: .PP .nf void my_callback_func(unsigned int registrationNumber, void *clientarg); .fi .PP Then, call .B snmp_alarm_register() to register your callback to be called .B seconds from now. The .B flags field should either be .B SA_REPEAT or .B NULL. If flags is set with .B SA_REPEAT, then the registered callback function will be called every .B seconds. If the .B SA_REPEAT flag is not set, then the function will only be called once and removed from the alarm system registration. .PP The .B 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. .PP The .B snmp_alarm_register() function returns a unique .I "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 .B snmp_alarm_unregister() function. If the .B snmp_alarm_register() call fails it returns zero. .SH INITIALIZATION The .B init_snmp_alarm() function initializes the routines, but a call to .B 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 .B init_snmp() function which you should call instead. .SH "NOTES" Internally, 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. .SH "SEE ALSO" snmp_api(3) .\" Local Variables: .\" mode: nroff .\" End: