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

Go to the source code of this file.

Functions

bool ani_strip_tc_authentication (const char *const ani_auth_path, amxc_string_t *const ani_path)
 
void ani_append_tc_authentication (const char *const ani_path, amxc_string_t *const ani_auth_path)
 

Detailed Description

ANI related functions.

Definition in file ani.h.

Function Documentation

◆ ani_append_tc_authentication()

void ani_append_tc_authentication ( const char *const  ani_path,
amxc_string_t *const  ani_auth_path 
)

Append ".TC.Authentication" to object path.

Parameters
[in]ani_pathpath to ANI instance, e.g. "XPON.ONU.1.ANI.1"
[in,out]ani_auth_paththe caller must pass an initialized amxc_string_t object. The function takes the value of ani_path, appends ".TC.Authentication", and assigns the resulting value to ani_auth_path. The caller must call amxc_string_clean() on ani_auth_path (when finished using it).

This function does the inverse of ani_append_tc_authentication().

Definition at line 113 of file ani.c.

114  {
115 
116  amxc_string_setf(ani_auth_path, "%s%s", ani_path, DOT_TC_AUTHENTICATION);
117 }
#define DOT_TC_AUTHENTICATION
Definition: ani.c:69
Here is the caller graph for this function:

◆ ani_strip_tc_authentication()

bool ani_strip_tc_authentication ( const char *const  ani_auth_path,
amxc_string_t *const  ani_path 
)

Strip ".TC.Authentication" from object path

Parameters
[in]ani_auth_pathpath to the TC.Authentication object of an ANI, e.g. "XPON.ONU.1.ANI.1.TC.Authentication"
[in,out]ani_paththe caller must pass an initialized amxc_string_t object. The function takes the value of ani_auth_path, strips ".TC.Authentication" from it, and assigns the resulting value to ani_path. The caller must call amxc_string_clean() on ani_path (when finished using it).

This function does the inverse of ani_append_tc_authentication().

Returns
true on success, else false

Definition at line 86 of file ani.c.

87  {
88 
89  bool rv = false;
90  amxc_string_set(ani_path, ani_auth_path);
91  const int replacements =
92  amxc_string_replace(ani_path, DOT_TC_AUTHENTICATION, "", /*max=*/ 1);
93  when_false_trace(replacements == 1, exit, ERROR,
94  "Failed to strip %s from %s", DOT_TC_AUTHENTICATION,
95  ani_auth_path);
96  rv = true;
97 exit:
98  return rv;
99 }
Here is the caller graph for this function: