TR181-XPON  1.4.0
TR-181 PON manager.
restore_to_hal.h File Reference

Go to the source code of this file.

Functions

void rth_init (void)
 
void rth_cleanup (void)
 
void rth_schedule_enable (const char *const object)
 
void rth_disable (const char *const object)
 

Detailed Description

Functionality related to enabling objects towards the HAL at startup if they are enabled according to the persistent settings.

The only read-write Enable fields in the BBF XPON DM are:

  • XPON.ONU.{i}.Enable and
  • XPON.ONU.{i}.ANI.{i}.Enable

This plugin calls rth_schedule_enable() for each such parameter which is true according to the persistent settings. The restore_to_hal part then enables the object in the HAL.

Definition in file restore_to_hal.h.

Function Documentation

◆ rth_cleanup()

void rth_cleanup ( void  )

Definition at line 234 of file restore_to_hal.c.

234  {
235  if(!amxc_llist_is_empty(&s_rth_tasks)) {
236  /* Normally s_rth_tasks should be empty upon stopping */
237  SAH_TRACEZ_WARNING(ME, "size(s_rth_tasks)=%zd != 0",
238  amxc_llist_size(&s_rth_tasks));
239  amxc_llist_clean(&s_rth_tasks, rth_task_delete);
240  }
241  amxp_timer_delete(&s_timer_handle_rth_tasks);
242 }
static void rth_task_delete(amxc_llist_it_t *hit)
static amxc_llist_t s_rth_tasks
static amxp_timer_t * s_timer_handle_rth_tasks
#define ME
Definition: xpon_trace.h:78
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rth_disable()

void rth_disable ( const char *const  object)

Remove task to enable an object in the HAL if such task exists.

Parameters
[in]objectobject path, e.g. "XPON.ONU.1"

Definition at line 286 of file restore_to_hal.c.

286  {
287  if(amxc_llist_is_empty(&s_rth_tasks)) {
288  return;
289  }
290  rth_task_t* task;
291  const char* path;
292  amxc_llist_for_each(it, &s_rth_tasks) {
293  task = amxc_llist_it_get_data(it, rth_task_t, it);
294  path = amxc_string_get(&task->path, 0);
295  if(strcmp(object, path) == 0) {
296  amxc_llist_it_take(it);
297  rth_task_delete(it);
298  break; /* out of iteration over s_rth_tasks */
299  }
300  }
301 }
amxc_string_t path
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rth_init()

void rth_init ( void  )

Definition at line 226 of file restore_to_hal.c.

226  {
227  amxc_llist_init(&s_rth_tasks);
228 
229  if(amxp_timer_new(&s_timer_handle_rth_tasks, handle_rth_tasks, NULL)) {
230  SAH_TRACEZ_ERROR(ME, "Failed to create timer to handle tasks");
231  }
232 }
static void handle_rth_tasks(amxp_timer_t *timer, UNUSED void *priv)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ rth_schedule_enable()

void rth_schedule_enable ( const char *const  object)

Schedule task to enable an object in the HAL.

Parameters
[in]objectobject path, e.g. "XPON.ONU.1"

The function creates a task to enable the object in the HAL, appends it to the list of tasks managed by this restore_to_hal part, and starts the timer to handle all tasks in that list.

If there is already a task in the list to enable the object, the function immediately returns.

Definition at line 256 of file restore_to_hal.c.

256  {
257 
258  SAH_TRACEZ_DEBUG(ME, "object='%s'", object);
259 
260  when_null_trace(s_timer_handle_rth_tasks, exit, ERROR, "No timer");
261 
262  const rth_task_t* task;
263  const char* path;
264  amxc_llist_iterate(it, &s_rth_tasks) {
265  task = amxc_llist_it_get_data(it, rth_task_t, it);
266  path = amxc_string_get(&task->path, 0);
267  if(strncmp(path, object, strlen(object)) == 0) {
268  SAH_TRACEZ_DEBUG(ME, "%s is already scheduled to be enabled", object);
269  return;
270  }
271  }
272 
273  if(rth_task_create(object) != NULL) {
274  amxp_timer_start(s_timer_handle_rth_tasks, SHORT_TIMEOUT_MS);
275  }
276 
277 exit:
278  return;
279 }
static rth_task_t * rth_task_create(const char *const path)
#define SHORT_TIMEOUT_MS
#define SAH_TRACEZ_DEBUG(zone, format,...)
Definition: xpon_trace.h:115
Here is the call graph for this function:
Here is the caller graph for this function: