yumapro  24.10-2
YumaPro SDK
Loading...
Searching...
No Matches

Server Timer Callback with 1 second tick. More...

Collaboration diagram for Timer Services:

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...
 

Detailed Description

Server Timer Callback with 1 second tick.

Only available in SIL code, not SIL-SA code.

Typedef Documentation

◆ agt_timer_fn_t

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.

Parameters
timer_idtimer identifier
cookiecontext pointer, such as a session control block, passed to agt_timer_set function (may be NULL)
Returns
0 normal exit
-1 error exit, delete timer upon return

Function Documentation

◆ agt_timer_cleanup()

void agt_timer_cleanup ( void  )

Cleanup the agt_timer module.

Called by the server during shutdown.

Here is the call graph for this function:

◆ agt_timer_create()

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

Parameters
secondsnumber of seconds to wait between polls
is_periodicTRUE if periodic timer
FALSE if a 1-event timer
timer_fnaddress of callback function to invoke when the timer poll event occurs
cookieaddress of user cookie to pass to the timer_fn ret_timer_id address of return timer ID
[out]ret_timer_idaddress of return timer ID
*ret_timer_id timer ID for the allocated timer, if the return value is NO_ERR
Returns
NO_ERR if all okay, the minimum spare requests will be malloced
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_timer_delete()

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

Parameters
timer_idtimer ID to destroy
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_timer_get_centi_timenow()

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

Parameters
[out]tnowaddress of uint64 to get time now
*tnow set to time now in centi-seconds
Here is the call graph for this function:

◆ agt_timer_get_timenow()

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
Parameters
[out]tnowaddress of time_t to get time now
*tnow set to time now
Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_timer_handler()

void agt_timer_handler ( void  )

Handle an incoming server timer polling interval.

main routine called by agt_signal_handler

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_timer_init()

void agt_timer_init ( void  )

Initialize the agt_timer module.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ agt_timer_restart()

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

Parameters
timer_idtimer ID to reset
secondsnew timeout value
Returns
status, NO_ERR if all okay,
Here is the call graph for this function: