yumapro
24.10-2
YumaPro SDK
|
Server Timer Callback with 1 second tick. More...
Data Structures | |
struct | agt_timer_cb_t |
Internal Timer control block, not for use outside agt_timer.c. More... | |
Typedefs | |
typedef int(* | agt_timer_fn_t) (uint32 timer_id, void *cookie) |
timer callback function More... | |
Functions | |
void | agt_timer_init (void) |
Initialize the agt_timer module. More... | |
void | agt_timer_cleanup (void) |
Cleanup the agt_timer module. More... | |
void | agt_timer_handler (void) |
Handle an incoming server timer polling interval. More... | |
status_t | agt_timer_create (uint32 seconds, boolean is_periodic, agt_timer_fn_t timer_fn, void *cookie, uint32 *ret_timer_id) |
Malloc and start a new timer control block. More... | |
status_t | agt_timer_restart (uint32 timer_id, uint32 seconds) |
Restart a timer with a new timeout value. More... | |
void | agt_timer_delete (uint32 timer_id) |
Remove and delete a timer control block. More... | |
void | agt_timer_get_timenow (time_t *tnow) |
Get the current time using the system or monotonic clock. More... | |
void | agt_timer_get_centi_timenow (uint64 *tnow) |
Get the current time using the system or monotonic clock. More... | |
Server Timer Callback with 1 second tick.
Only available in SIL code, not SIL-SA code.
typedef int(* agt_timer_fn_t) (uint32 timer_id, void *cookie) |
timer callback function
Provided the the SIL code registering the timer. It is expected to process the timer expired event.
timer_id | timer identifier |
cookie | context pointer, such as a session control block, passed to agt_timer_set function (may be NULL) |
void agt_timer_cleanup | ( | void | ) |
Cleanup the agt_timer module.
Called by the server during shutdown.
status_t agt_timer_create | ( | uint32 | seconds, |
boolean | is_periodic, | ||
agt_timer_fn_t | timer_fn, | ||
void * | cookie, | ||
uint32 * | ret_timer_id | ||
) |
Malloc and start a new timer control block.
Main User API - FOr SIL only at this time
seconds | number of seconds to wait between polls | |
is_periodic | TRUE if periodic timer FALSE if a 1-event timer | |
timer_fn | address of callback function to invoke when the timer poll event occurs | |
cookie | address of user cookie to pass to the timer_fn ret_timer_id address of return timer ID | |
[out] | ret_timer_id | address of return timer ID *ret_timer_id timer ID for the allocated timer, if the return value is NO_ERR |
void agt_timer_delete | ( | uint32 | timer_id | ) |
Remove and delete a timer control block.
Periodic timers need to be deleted to be stopped 1-shot timers will be deleted automatically after they expire and the callback is invoked
timer_id | timer ID to destroy |
void agt_timer_get_centi_timenow | ( | uint64 * | tnow | ) |
Get the current time using the system or monotonic clock.
Get time in number of centi-seconds.
The result is truncated, not rounded, when converting micro-seconds to centi-seconds
To use the monotonic clock NEED FLAGS DEFINED:
* TIMER_MONO_CLOCK=1 * _POSIX_TIMERS * _POSIX_MONOTONIC_CLOCK
Used by agt_push to manage YANG Push period and dampening-period
[out] | tnow | address of uint64 to get time now *tnow set to time now in centi-seconds |
void agt_timer_get_timenow | ( | time_t * | tnow | ) |
Get the current time using the system or monotonic clock.
To use the monotonic clock NEED FLAGS DEFINED:
* TIMER_MONO_CLOCK=1 * _POSIX_TIMERS * _POSIX_MONOTONIC_CLOCK
[out] | tnow | address of time_t to get time now *tnow set to time now |
void agt_timer_handler | ( | void | ) |
Handle an incoming server timer polling interval.
main routine called by agt_signal_handler
void agt_timer_init | ( | void | ) |
Initialize the agt_timer module.
status_t agt_timer_restart | ( | uint32 | timer_id, |
uint32 | seconds | ||
) |
Restart a timer with a new timeout value.
If this is a periodic timer, then the interval will be changed to the new value. Otherwise a 1-shot timer will just be reset to the new value
timer_id | timer ID to reset |
seconds | new timeout value |