TR181-XPON  1.4.0
TR-181 PON manager.
pon_ctrl.h File Reference
#include <stdbool.h>
#include <amxc/amxc_variant.h>

Go to the source code of this file.

Functions

void pon_ctrl_init (void)
 
void pon_ctrl_set_enable (const char *const path, bool enable)
 
int pon_ctrl_get_list_of_instances (const char *const path, amxc_var_t *ret)
 
int pon_ctrl_get_object_content (const char *const path, uint32_t index, amxc_var_t *ret)
 
int pon_ctrl_get_param_values (const char *const path, const char *const names, amxc_var_t *ret)
 
void pon_ctrl_handle_file_descriptor (int fd)
 
void pon_ctrl_set_password (const char *const ani_path, const char *const password, bool hex)
 

Detailed Description

Functionality related to calling functions in the 'pon_ctrl' namespace registered by the vendor module.

Definition in file pon_ctrl.h.

Function Documentation

◆ pon_ctrl_get_list_of_instances()

int pon_ctrl_get_list_of_instances ( const char *const  path,
amxc_var_t *  ret 
)

Ask vendor module which instances exist for a template object.

Parameters
[in]pathpath to template object, e.g. "XPON.ONU" or "XPON.ONU.1.SoftwareImage"
[in,out]retfunction returns result via this parameter. See below for more info.

The param ret should be an htable with following keys upon success:

  • 'indexes': a string with comma-separated integers representing the instance indexes. It's an empty string if no instances exist.
Returns
0 on success, -1 upon error

Definition at line 187 of file pon_ctrl.c.

187  {
188 
189  amxc_var_t args;
190  amxc_var_init(&args);
191  amxc_var_set(cstring_t, &args, path);
192 
193  const int rc =
195 
196  amxc_var_clean(&args);
197  return rc;
198 }
static const char *const GET_LIST_OF_INSTANCES
Definition: pon_ctrl.c:79
static int call_pon_ctrl_function_common(const char *const func_name, amxc_var_t *args, amxc_var_t *ret)
Definition: pon_ctrl.c:85
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pon_ctrl_get_object_content()

int pon_ctrl_get_object_content ( const char *const  path,
uint32_t  index,
amxc_var_t *  ret 
)

Ask vendor module for the content (parameter values) of an object.

Parameters
[in]pathobject path. This can be a singleton or template object.
[in]indexinstance index when querying the content of an instance. Must be 0 when querying a singleton.
[in,out]retfunction returns result via this parameter. See below for more info.

The param ret should be an htable with following keys upon success:

  • 'parameters': values for the parameters of the object
  • 'keys': only present in ret when querying an instance. It should contain values for the keys of the template object.
Returns
0 on success, -1 upon error

Definition at line 216 of file pon_ctrl.c.

216  {
217 
218  amxc_var_t args;
219  amxc_var_init(&args);
220 
221  amxc_var_set_type(&args, AMXC_VAR_ID_HTABLE);
222  amxc_var_add_key(cstring_t, &args, "path", path);
223  if(index) {
224  amxc_var_add_key(uint32_t, &args, "index", index);
225  }
226 
227  const int rc = call_pon_ctrl_function_common(GET_OBJECT_CONTENT, &args, ret);
228 
229  amxc_var_clean(&args);
230  return rc;
231 }
static const char *const GET_OBJECT_CONTENT
Definition: pon_ctrl.c:80
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pon_ctrl_get_param_values()

int pon_ctrl_get_param_values ( const char *const  path,
const char *const  names,
amxc_var_t *  ret 
)

Ask vendor module for the values of one or more parameters of an object.

Parameters
[in]pathobject path of a singleton or an instance
[in]namesparameter names formatted as a comma-separated list. The vendor module might support passing max 1 parameter name. Example: "RxPower".
[in,out]retfunction returns result via this parameter. See below for more info.

The param ret should be an htable with following keys upon success:

  • 'parameters': values for the requested parameter(s) of the object
Returns
0 on success, -1 upon error

Definition at line 248 of file pon_ctrl.c.

250  {
251 
252  amxc_var_t args;
253  amxc_var_init(&args);
254 
255  amxc_var_set_type(&args, AMXC_VAR_ID_HTABLE);
256  amxc_var_add_key(cstring_t, &args, "path", path);
257  amxc_var_add_key(cstring_t, &args, "names", names);
258 
259  SAH_TRACEZ_DEBUG(ME, "path='%s' names='%s'", path, names);
260  const int rc = call_pon_ctrl_function_common(GET_PARAM_VALUES, &args, ret);
261 
262  amxc_var_clean(&args);
263  return rc;
264 }
static const char *const GET_PARAM_VALUES
Definition: pon_ctrl.c:81
#define SAH_TRACEZ_DEBUG(zone, format,...)
Definition: xpon_trace.h:115
#define ME
Definition: xpon_trace.h:78
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pon_ctrl_handle_file_descriptor()

void pon_ctrl_handle_file_descriptor ( int  fd)

Ask vendor module to handle (a message arriving on) a file descriptor.

Parameters
[in]fdthe file descriptor to handle

Examples for the file descriptor:

  • file descriptor of the socket the vendor module uses for IPC with the vendor specific PON/OMCI stack.
  • file descriptor of a socket to monitor netlink messages from the kernel.
  • ...

Definition at line 277 of file pon_ctrl.c.

277  {
278 
279  amxc_var_t var;
280  amxc_var_init(&var);
281  amxc_var_set(fd_t, &var, fd);
283  amxc_var_clean(&var);
284 }
static const char *const HANDLE_FILE_DESCRIPTOR
Definition: pon_ctrl.c:82
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pon_ctrl_init()

void pon_ctrl_init ( void  )

Initialize the pon_ctrl part of this plugin.

The function forwards value of MAX_NR_OF_ONUS to the vendor module.

The plugin must call this function once at startup, after loading the vendor module.

Definition at line 142 of file pon_ctrl.c.

142  {
144 }
static void set_max_nr_of_onus(void)
Definition: pon_ctrl.c:122
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pon_ctrl_set_enable()

void pon_ctrl_set_enable ( const char *const  path,
bool  enable 
)

Let vendor module know that a read-write Enable field was changed.

Parameters
[in]pathpath of object whose Enable field was changed, e.g., "XPON.ONU.1", or "XPON.ONU.1.ANI.1"
[in]enabletrue if Enable field was set to true, else false

Definition at line 153 of file pon_ctrl.c.

153  {
154 
155  amxc_var_t args;
156  amxc_var_init(&args);
157 
158  SAH_TRACEZ_DEBUG(ME, "path='%s' enable=%d", path, enable);
159 
160  amxc_var_set_type(&args, AMXC_VAR_ID_HTABLE);
161 
162  amxc_var_add_key(cstring_t, &args, "path", path);
163  amxc_var_add_key(bool, &args, "enable", enable);
164 
165  if(call_pon_ctrl_function_common(SET_ENABLE, &args, NULL)) {
166  SAH_TRACEZ_ERROR(ME, "path='%s' enable=%d: %s() failed",
167  path, enable, SET_ENABLE);
168  }
169 
170  amxc_var_clean(&args);
171 }
static const char *const SET_ENABLE
Definition: pon_ctrl.c:78
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pon_ctrl_set_password()

void pon_ctrl_set_password ( const char *const  ani_path,
const char *const  password,
bool  hex 
)

Ask vendor module to apply the password.

Parameters
[in]ani_pathpath to ANI instance, e.g. "XPON.ONU.1.ANI.1"
[in]passwordnew value for the parameter Password of the ANI referred to by ani_path
[in]hexfalse if password is in ASCII format; true if password is in hexadecimal format

Definition at line 295 of file pon_ctrl.c.

297  {
298  amxc_var_t args;
299  amxc_var_init(&args);
300 
301  amxc_var_set_type(&args, AMXC_VAR_ID_HTABLE);
302  amxc_var_add_key(cstring_t, &args, "ani_path", ani_path);
303  amxc_var_add_key(cstring_t, &args, "password", password);
304  amxc_var_add_key(bool, &args, "is_hexadecimal_password", hex);
305 
306  SAH_TRACEZ_DEBUG(ME, "ani_path='%s' password='%s' hex=%d", ani_path, password, hex);
308  amxc_var_clean(&args);
309 }
static const char *const SET_PASSWORD
Definition: pon_ctrl.c:83
Here is the call graph for this function:
Here is the caller graph for this function: