TR181-XPON  1.4.0
TR-181 PON manager.
module_mgmt.h File Reference
#include <stdbool.h>

Go to the source code of this file.

Functions

bool mod_module_mgmt_init (bool *module_error)
 
const char * mod_get_vendor_module_loaded (void)
 
void mod_module_mgmt_cleanup (void)
 

Detailed Description

Functionality to load vendor module and register namespaces.

The namespaces have functions which can be called by the vendor module.

Definition in file module_mgmt.h.

Function Documentation

◆ mod_get_vendor_module_loaded()

const char* mod_get_vendor_module_loaded ( void  )

Return the name of the vendor module the plugin loaded at startup.

Returns
the name of that vendor module upon success
NULL if the plugin failed to load the vendor module at startup

Definition at line 326 of file module_mgmt.c.

326  {
327 
328  return s_module_so ? amxc_string_get(&s_module_name, 0) : NULL;
329 }
static amxc_string_t s_module_name
Definition: module_mgmt.c:90
static amxm_shared_object_t * s_module_so
Definition: module_mgmt.c:91
Here is the caller graph for this function:

◆ mod_module_mgmt_cleanup()

void mod_module_mgmt_cleanup ( void  )

Clean up the module_mgmt part of this plugin.

The function does the reverse of mod_module_mgmt_init():

  • unload the vendor module
  • unregisters the namespaces 'pon_stat' and 'pon_cfg'

The plugin must call this function once when stopping.

Definition at line 340 of file module_mgmt.c.

340  {
341 
342  if(s_module_so) {
343  if(amxm_so_close(&s_module_so)) {
344  SAH_TRACEZ_ERROR(ME, "Failed to close module");
345  }
346  }
347 
348  if(s_pon_stat_module) {
349  amxm_module_deregister(&s_pon_stat_module);
350  }
351  if(s_pon_cfg_module) {
352  amxm_module_deregister(&s_pon_cfg_module);
353  }
354  amxc_string_clean(&s_module_name);
355 }
static amxm_module_t * s_pon_cfg_module
Definition: module_mgmt.c:89
static amxm_module_t * s_pon_stat_module
Definition: module_mgmt.c:88
#define ME
Definition: xpon_trace.h:78
Here is the caller graph for this function:

◆ mod_module_mgmt_init()

bool mod_module_mgmt_init ( bool *  module_error)

Initialize the module_mgmt part of this plugin.

The function:

  • registers the namespaces 'pon_stat' and 'pon_cfg'. The namespaces have functions which can be called by the vendor module.
  • loads the vendor module.

The plugin must call this function once at startup.

Parameters
[in,out]module_errorthe function sets it to true if it encounters an error regarding (the loading of) the vendor module
Returns
true on success, else false

Definition at line 299 of file module_mgmt.c.

299  {
300 
301  amxc_string_init(&s_module_name, 0);
302 
303  if(!register_pon_stat_module()) {
304  return false;
305  }
306 
307  if(!register_pon_cfg_module()) {
308  return false;
309  }
310 
311  if(!load_vendor_module()) {
312  if(module_error) {
313  *module_error = true;
314  }
315  return false;
316  }
317  return true;
318 }
static bool load_vendor_module(void)
Definition: module_mgmt.c:246
static bool register_pon_cfg_module(void)
Definition: module_mgmt.c:145
static bool register_pon_stat_module(void)
Definition: module_mgmt.c:117
Here is the call graph for this function:
Here is the caller graph for this function: