mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2025-12-10 07:44:39 +01:00
F#14418: Generic API to datamodel reference handling
This commit is contained in:
parent
e3cdce1c37
commit
c35c1da0b2
23 changed files with 305 additions and 128 deletions
|
|
@ -222,8 +222,10 @@ int bbf_set_alias(struct dmctx *ctx, struct uci_section *s, char *option_name, c
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bbf_get_reference_param(char *path, char *key_name, char *key_value, char **value)
|
int bbf_get_reference_param(char *path, char *key_name, char *key_value, char **value) // To be removed later!!!!!!!!!!!!
|
||||||
{
|
{
|
||||||
|
BBF_ERR("Use bbfdm_get_references API in place of %s API, this API will be removed later!!!", __func__);
|
||||||
|
|
||||||
if (DM_STRLEN(path) == 0 || DM_STRLEN(key_name) == 0 || DM_STRLEN(key_value) == 0 || !value)
|
if (DM_STRLEN(path) == 0 || DM_STRLEN(key_name) == 0 || DM_STRLEN(key_value) == 0 || !value)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|
@ -231,8 +233,10 @@ int bbf_get_reference_param(char *path, char *key_name, char *key_value, char **
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int bbf_get_reference_args(char *value, struct dm_reference *reference_args)
|
int bbf_get_reference_args(char *value, struct dm_reference *reference_args) // To be removed later!!!!!!!!!!!!
|
||||||
{
|
{
|
||||||
|
BBF_ERR("Use bbfdm_get_reference_linker API in place of %s API, this API will be removed later!!!", __func__);
|
||||||
|
|
||||||
if (DM_STRLEN(value) == 0)
|
if (DM_STRLEN(value) == 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|
@ -249,6 +253,95 @@ int bbf_get_reference_args(char *value, struct dm_reference *reference_args)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int bbfdm_get_references(struct dmctx *ctx, int match_action, const char *base_path, char *key_name, char *key_value, char *out, size_t out_len)
|
||||||
|
{
|
||||||
|
char param_path[1024] = {0};
|
||||||
|
char *value = NULL;
|
||||||
|
|
||||||
|
if (DM_STRLEN(base_path) == 0) {
|
||||||
|
BBF_ERR("Reference base path should not be empty!!!");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DM_STRLEN(key_name) == 0) {
|
||||||
|
BBF_ERR("Reference key name should not be empty!!!");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DM_STRLEN(key_value) == 0) {
|
||||||
|
BBF_ERR("Reference key value should not be empty!!!");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!out || !out_len) {
|
||||||
|
BBF_ERR("Output buffer is NULL or has zero length. A valid buffer with sufficient size is required");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
snprintf(param_path, sizeof(param_path), "%s*.%s", base_path, key_name);
|
||||||
|
|
||||||
|
adm_entry_get_reference_param(ctx, param_path, key_value, &value);
|
||||||
|
|
||||||
|
size_t len = strlen(out);
|
||||||
|
|
||||||
|
if (DM_STRLEN(value) != 0) {
|
||||||
|
|
||||||
|
if (out_len - len < strlen(value)) {
|
||||||
|
BBF_ERR("Buffer overflow detected. The output buffer is not large enough to hold the additional data!!!");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
snprintf(&out[len], out_len - len, "%s%s", len ? (match_action == MATCH_FIRST ? "," : ";") : "", value);
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_micro_service == true) { // It's a micro-service instance
|
||||||
|
|
||||||
|
if (out_len - len < strlen(base_path) + strlen(key_name) + strlen(key_value) + 9) { // 9 = 'path[key_name==\"key_value\"].'
|
||||||
|
BBF_ERR("Buffer overflow detected. The output buffer is not large enough to hold the additional data!!!");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
snprintf(&out[len], out_len - len, "%s%s[%s==\"%s\"].", len ? (match_action == MATCH_FIRST ? "," : ";") : "", base_path, key_name, key_value);
|
||||||
|
}
|
||||||
|
|
||||||
|
end:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int _bbfdm_get_references(struct dmctx *ctx, const char *base_path, char *key_name, char *key_value, char **value)
|
||||||
|
{
|
||||||
|
char buf[1024] = {0};
|
||||||
|
|
||||||
|
int res = bbfdm_get_references(ctx, MATCH_FIRST, base_path, key_name, key_value, buf, sizeof(buf));
|
||||||
|
|
||||||
|
*value = (!res) ? dmstrdup(buf): "";
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int bbfdm_get_reference_linker(struct dmctx *ctx, char *reference_path, struct dm_reference *reference_args)
|
||||||
|
{
|
||||||
|
if (DM_STRLEN(reference_path) == 0) {
|
||||||
|
bbfdm_set_fault_message(ctx, "%s: reference path should not be empty", __func__);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
reference_args->path = reference_path;
|
||||||
|
|
||||||
|
char *separator = strstr(reference_path, "=>");
|
||||||
|
if (!separator) {
|
||||||
|
bbfdm_set_fault_message(ctx, "%s: reference path must contain '=>' symbol to separate the path and value", __func__);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
*separator = 0;
|
||||||
|
|
||||||
|
reference_args->value = separator + 2;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
__attribute__ ((deprecated)) int bbf_validate_string(char *value, int min_length, int max_length, char *enumeration[], char *pattern[])
|
__attribute__ ((deprecated)) int bbf_validate_string(char *value, int min_length, int max_length, char *enumeration[], char *pattern[])
|
||||||
{
|
{
|
||||||
struct dmctx ctx = {0};
|
struct dmctx ctx = {0};
|
||||||
|
|
|
||||||
|
|
@ -271,6 +271,11 @@ enum {
|
||||||
BBF_EVENT,
|
BBF_EVENT,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
MATCH_FIRST,
|
||||||
|
MATCH_ALL
|
||||||
|
};
|
||||||
|
|
||||||
enum usp_fault_code_enum {
|
enum usp_fault_code_enum {
|
||||||
USP_FAULT_GENERAL_FAILURE = 7000, // general failure
|
USP_FAULT_GENERAL_FAILURE = 7000, // general failure
|
||||||
USP_FAULT_MESSAGE_NOT_UNDERSTOOD = 7001, // message was not understood
|
USP_FAULT_MESSAGE_NOT_UNDERSTOOD = 7001, // message was not understood
|
||||||
|
|
|
||||||
|
|
@ -873,51 +873,59 @@ static int is64digit(char c)
|
||||||
|
|
||||||
char *get_value_by_reference(struct dmctx *ctx, char *value)
|
char *get_value_by_reference(struct dmctx *ctx, char *value)
|
||||||
{
|
{
|
||||||
char *pch = NULL, *spch = NULL, *val = NULL;
|
if (is_micro_service == true) // It's a micro-service instance
|
||||||
|
return value;
|
||||||
|
|
||||||
|
char *pch = NULL, *spch = NULL;
|
||||||
char buf[MAX_DM_PATH * 4] = {0};
|
char buf[MAX_DM_PATH * 4] = {0};
|
||||||
char buf_val[MAX_DM_PATH * 4] = {0};
|
char buf_val[MAX_DM_PATH * 4] = {0};
|
||||||
bool is_list = false;
|
bool is_list = false;
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
|
||||||
if (DM_STRLEN(value) == 0 || !DM_LSTRSTR(value, "=="))
|
if (DM_STRLEN(value) == 0)
|
||||||
return value;
|
return value;
|
||||||
|
|
||||||
DM_STRNCPY(buf, value, sizeof(buf));
|
DM_STRNCPY(buf, value, sizeof(buf));
|
||||||
|
|
||||||
if (DM_STRCHR(buf, '&'))
|
if (DM_STRCHR(buf, ';'))
|
||||||
is_list = true;
|
is_list = true;
|
||||||
|
|
||||||
buf_val[0] = 0;
|
buf_val[0] = 0;
|
||||||
|
|
||||||
for (pch = strtok_r(buf, is_list ? "&" : ",", &spch); pch; pch = strtok_r(NULL, is_list ? "&" : ",", &spch)) {
|
for (pch = strtok_r(buf, is_list ? ";" : ",", &spch); pch; pch = strtok_r(NULL, is_list ? ";" : ",", &spch)) {
|
||||||
|
char *val = NULL;
|
||||||
|
|
||||||
|
if (DM_LSTRSTR(pch, "==")) {
|
||||||
char path[MAX_DM_PATH] = {0};
|
char path[MAX_DM_PATH] = {0};
|
||||||
char key_name[256], key_value[256];
|
char key_name[256], key_value[256];
|
||||||
regmatch_t pmatch[2];
|
regmatch_t pmatch[2];
|
||||||
|
|
||||||
bool res = match(pch, "\\[(.*?)\\]", 2, pmatch);
|
bool res = match(pch, "\\[(.*?)\\]", 2, pmatch);
|
||||||
if (!res)
|
if (!res)
|
||||||
goto end;
|
continue;
|
||||||
|
|
||||||
snprintf(path, pmatch[0].rm_so + 1, "%s", pch);
|
snprintf(path, pmatch[0].rm_so + 1, "%s", pch);
|
||||||
int len = DM_STRLEN(path);
|
int len = DM_STRLEN(path);
|
||||||
if (!len)
|
if (!len)
|
||||||
goto end;
|
continue;
|
||||||
|
|
||||||
char *match_str = pch + pmatch[1].rm_so;
|
char *match_str = pch + pmatch[1].rm_so;
|
||||||
if (DM_STRLEN(match_str) == 0)
|
if (DM_STRLEN(match_str) == 0)
|
||||||
goto end;
|
continue;
|
||||||
|
|
||||||
int n = sscanf(match_str, "%255[^=]==\"%255[^\"]\"", key_name, key_value);
|
int n = sscanf(match_str, "%255[^=]==\"%255[^\"]\"", key_name, key_value);
|
||||||
if (n != 2) {
|
if (n != 2) {
|
||||||
n = sscanf(match_str, "%255[^=]==%255[^]]", key_name, key_value);
|
n = sscanf(match_str, "%255[^=]==%255[^]]", key_name, key_value);
|
||||||
if (n != 2) {
|
if (n != 2)
|
||||||
goto end;
|
continue;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(path + len, sizeof(path) - len, "*.%s", key_name);
|
snprintf(path + len, sizeof(path) - len, "*.%s", key_name);
|
||||||
|
|
||||||
adm_entry_get_reference_param(ctx, path, key_value, &val);
|
adm_entry_get_reference_param(ctx, path, key_value, &val);
|
||||||
|
} else {
|
||||||
|
val = pch;
|
||||||
|
}
|
||||||
|
|
||||||
if (DM_STRLEN(val)) {
|
if (DM_STRLEN(val)) {
|
||||||
pos += snprintf(&buf_val[pos], sizeof(buf_val) - pos, "%s,", val);
|
pos += snprintf(&buf_val[pos], sizeof(buf_val) - pos, "%s,", val);
|
||||||
|
|
@ -932,11 +940,10 @@ char *get_value_by_reference(struct dmctx *ctx, char *value)
|
||||||
return dmstrdup(buf_val);
|
return dmstrdup(buf_val);
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
return "";
|
||||||
return is_micro_service ? value : "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool has_same_reference(char *curr_value, char *new_value)
|
static bool has_same_reference(struct dmctx *ctx, char *curr_value, char *new_value)
|
||||||
{
|
{
|
||||||
struct dm_reference reference = {0};
|
struct dm_reference reference = {0};
|
||||||
char buf[MAX_DM_PATH * 4] = {0};
|
char buf[MAX_DM_PATH * 4] = {0};
|
||||||
|
|
@ -944,7 +951,7 @@ static bool has_same_reference(char *curr_value, char *new_value)
|
||||||
char *pch = NULL, *spch = NULL;
|
char *pch = NULL, *spch = NULL;
|
||||||
|
|
||||||
snprintf(param_value, sizeof(param_value), "%s", new_value);
|
snprintf(param_value, sizeof(param_value), "%s", new_value);
|
||||||
bbf_get_reference_args(param_value, &reference);
|
bbfdm_get_reference_linker(ctx, param_value, &reference);
|
||||||
|
|
||||||
DM_STRNCPY(buf, curr_value, sizeof(buf));
|
DM_STRNCPY(buf, curr_value, sizeof(buf));
|
||||||
|
|
||||||
|
|
@ -2366,7 +2373,7 @@ static int mparam_set_value(DMPARAM_ARGS)
|
||||||
if (DM_LSTRSTR(dmctx->in_value, "=>") == NULL)
|
if (DM_LSTRSTR(dmctx->in_value, "=>") == NULL)
|
||||||
get_reference_paramater_value(dmctx, dmctx->in_value, param_value, sizeof(param_value));
|
get_reference_paramater_value(dmctx, dmctx->in_value, param_value, sizeof(param_value));
|
||||||
|
|
||||||
if (has_same_reference(value, param_value)) {
|
if (has_same_reference(dmctx, value, param_value)) {
|
||||||
BBF_DEBUG("Requested value (%s) is same as current value (%s)", dmctx->in_value, value);
|
BBF_DEBUG("Requested value (%s) is same as current value (%s)", dmctx->in_value, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -239,10 +239,10 @@ void get_dmmap_section_of_config_section_cont(char* dmmap_package, char* section
|
||||||
void get_config_section_of_dmmap_section(char* package, char* section_type, char *section_name, struct uci_section **config_section);
|
void get_config_section_of_dmmap_section(char* package, char* section_type, char *section_name, struct uci_section **config_section);
|
||||||
int adm_entry_get_reference_param(struct dmctx *ctx, char *param, char *linker, char **value);
|
int adm_entry_get_reference_param(struct dmctx *ctx, char *param, char *linker, char **value);
|
||||||
int adm_entry_get_reference_value(struct dmctx *ctx, char *param, char **value);
|
int adm_entry_get_reference_value(struct dmctx *ctx, char *param, char **value);
|
||||||
int adm_entry_get_linker_param(struct dmctx *ctx, char *param, char *linker, char **value);
|
int adm_entry_get_linker_param(struct dmctx *ctx, char *param, char *linker, char **value); // To be removed later!!!!!!!!!!!!
|
||||||
int adm_entry_get_linker_value(struct dmctx *ctx, char *param, char **value);
|
int adm_entry_get_linker_value(struct dmctx *ctx, char *param, char **value); // To be removed later!!!!!!!!!!!!
|
||||||
int dm_entry_validate_allowed_objects(struct dmctx *ctx, char *value, char *objects[]);
|
int dm_entry_validate_allowed_objects(struct dmctx *ctx, char *value, char *objects[]); // To be removed later!!!!!!!!!!!!
|
||||||
int dm_entry_validate_external_linker_allowed_objects(struct dmctx *ctx, char *value, char *objects[]);
|
int dm_entry_validate_external_linker_allowed_objects(struct dmctx *ctx, char *value, char *objects[]); // To be removed later!!!!!!!!!!!!
|
||||||
int dm_validate_allowed_objects(struct dmctx *ctx, struct dm_reference *reference, char *objects[]);
|
int dm_validate_allowed_objects(struct dmctx *ctx, struct dm_reference *reference, char *objects[]);
|
||||||
char *check_create_dmmap_package(const char *dmmap_package);
|
char *check_create_dmmap_package(const char *dmmap_package);
|
||||||
unsigned int count_occurrences(const char *str, char c);
|
unsigned int count_occurrences(const char *str, char c);
|
||||||
|
|
@ -301,8 +301,11 @@ int bbfdm_validate_string_list(struct dmctx *ctx, char *value, int min_item, int
|
||||||
int bbfdm_validate_hexBinary_list(struct dmctx *ctx, char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
|
int bbfdm_validate_hexBinary_list(struct dmctx *ctx, char *value, int min_item, int max_item, int max_size, struct range_args r_args[], int r_args_size);
|
||||||
int bbf_get_alias(struct dmctx *ctx, struct uci_section *s, char *option_name, char *instance, char **value);
|
int bbf_get_alias(struct dmctx *ctx, struct uci_section *s, char *option_name, char *instance, char **value);
|
||||||
int bbf_set_alias(struct dmctx *ctx, struct uci_section *s, char *option_name, char *instance, char *value);
|
int bbf_set_alias(struct dmctx *ctx, struct uci_section *s, char *option_name, char *instance, char *value);
|
||||||
int bbf_get_reference_param(char *path, char *key_name, char *key_value, char **value);
|
int bbf_get_reference_param(char *path, char *key_name, char *key_value, char **value); // To be removed later!!!!!!!!!!!!
|
||||||
int bbf_get_reference_args(char *value, struct dm_reference *reference_args);
|
int bbf_get_reference_args(char *value, struct dm_reference *reference_args); // To be removed later!!!!!!!!!!!!
|
||||||
|
int bbfdm_get_references(struct dmctx *ctx, int match_action, const char *base_path, char *key_name, char *key_value, char *out, size_t out_len);
|
||||||
|
int _bbfdm_get_references(struct dmctx *ctx, const char *base_path, char *key_name, char *key_value, char **value);
|
||||||
|
int bbfdm_get_reference_linker(struct dmctx *ctx, char *reference_path, struct dm_reference *reference_args);
|
||||||
char *base64_decode(const char *src);
|
char *base64_decode(const char *src);
|
||||||
void string_to_mac(const char *str, size_t str_len, char *out, size_t out_len);
|
void string_to_mac(const char *str, size_t str_len, char *out, size_t out_len);
|
||||||
bool folder_exists(const char *path);
|
bool folder_exists(const char *path);
|
||||||
|
|
|
||||||
|
|
@ -257,6 +257,8 @@ void bbf_global_clean(DMOBJ *dm_entryobj)
|
||||||
|
|
||||||
int dm_entry_validate_allowed_objects(struct dmctx *ctx, char *value, char *objects[]) // To be removed later!!!!!!!!!!!!
|
int dm_entry_validate_allowed_objects(struct dmctx *ctx, char *value, char *objects[]) // To be removed later!!!!!!!!!!!!
|
||||||
{
|
{
|
||||||
|
BBF_ERR("%s API will be removed later, don't use it!!!!!!", __func__);
|
||||||
|
|
||||||
if (!value || !objects)
|
if (!value || !objects)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|
@ -280,6 +282,8 @@ int dm_entry_validate_allowed_objects(struct dmctx *ctx, char *value, char *obje
|
||||||
|
|
||||||
int dm_entry_validate_external_linker_allowed_objects(struct dmctx *ctx, char *value, char *objects[]) // To be removed later!!!!!!!!!!!!
|
int dm_entry_validate_external_linker_allowed_objects(struct dmctx *ctx, char *value, char *objects[]) // To be removed later!!!!!!!!!!!!
|
||||||
{
|
{
|
||||||
|
BBF_ERR("%s API will be removed later, don't use it!!!!!!", __func__);
|
||||||
|
|
||||||
if (!value || !objects)
|
if (!value || !objects)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
|
@ -370,6 +374,8 @@ int adm_entry_get_reference_value(struct dmctx *ctx, char *param, char **value)
|
||||||
|
|
||||||
int adm_entry_get_linker_param(struct dmctx *ctx, char *param, char *linker, char **value) // To be removed later!!!!!!!!!!!!
|
int adm_entry_get_linker_param(struct dmctx *ctx, char *param, char *linker, char **value) // To be removed later!!!!!!!!!!!!
|
||||||
{
|
{
|
||||||
|
BBF_ERR("%s API will be removed later, don't use it!!!!!!", __func__);
|
||||||
|
|
||||||
struct dmctx dmctx = {0};
|
struct dmctx dmctx = {0};
|
||||||
*value = "";
|
*value = "";
|
||||||
|
|
||||||
|
|
@ -390,6 +396,8 @@ int adm_entry_get_linker_param(struct dmctx *ctx, char *param, char *linker, cha
|
||||||
|
|
||||||
int adm_entry_get_linker_value(struct dmctx *ctx, char *param, char **value) // To be removed later!!!!!!!!!!!!
|
int adm_entry_get_linker_value(struct dmctx *ctx, char *param, char **value) // To be removed later!!!!!!!!!!!!
|
||||||
{
|
{
|
||||||
|
BBF_ERR("%s API will be removed later, don't use it!!!!!!", __func__);
|
||||||
|
|
||||||
struct dmctx dmctx = {0};
|
struct dmctx dmctx = {0};
|
||||||
char linker[256] = {0};
|
char linker[256] = {0};
|
||||||
*value = NULL;
|
*value = NULL;
|
||||||
|
|
@ -410,7 +418,7 @@ int adm_entry_get_linker_value(struct dmctx *ctx, char *param, char **value) //
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool adm_entry_object_exists(struct dmctx *ctx, char *param)
|
bool adm_entry_object_exists(struct dmctx *ctx, char *param) // To be removed later!!!!!!!!!!!! (After moving all Objects outside bbfdm core)
|
||||||
{
|
{
|
||||||
struct dmctx dmctx = {0};
|
struct dmctx dmctx = {0};
|
||||||
char linker[256] = {0};
|
char linker[256] = {0};
|
||||||
|
|
|
||||||
|
|
@ -28,14 +28,14 @@ int bbf_entry_method(struct dmctx *ctx, int cmd);
|
||||||
void bbf_global_init(DMOBJ *dm_entryobj, const char *plugin_path);
|
void bbf_global_init(DMOBJ *dm_entryobj, const char *plugin_path);
|
||||||
void bbf_global_clean(DMOBJ *dm_entryobj);
|
void bbf_global_clean(DMOBJ *dm_entryobj);
|
||||||
|
|
||||||
int dm_entry_validate_allowed_objects(struct dmctx *ctx, char *value, char *objects[]);
|
int dm_entry_validate_allowed_objects(struct dmctx *ctx, char *value, char *objects[]); // To be removed later!!!!!!!!!!!!
|
||||||
int dm_entry_validate_external_linker_allowed_objects(struct dmctx *ctx, char *value, char *objects[]);
|
int dm_entry_validate_external_linker_allowed_objects(struct dmctx *ctx, char *value, char *objects[]); // To be removed later!!!!!!!!!!!!
|
||||||
int dm_validate_allowed_objects(struct dmctx *ctx, struct dm_reference *reference, char *objects[]);
|
int dm_validate_allowed_objects(struct dmctx *ctx, struct dm_reference *reference, char *objects[]);
|
||||||
|
|
||||||
bool adm_entry_object_exists(struct dmctx *ctx, char *param);
|
bool adm_entry_object_exists(struct dmctx *ctx, char *param); // To be removed later!!!!!!!!!!!! (After moving all Objects outside bbfdm core)
|
||||||
|
|
||||||
int adm_entry_get_linker_param(struct dmctx *ctx, char *param, char *linker, char **value);
|
int adm_entry_get_linker_param(struct dmctx *ctx, char *param, char *linker, char **value); // To be removed later!!!!!!!!!!!!
|
||||||
int adm_entry_get_linker_value(struct dmctx *ctx, char *param, char **value);
|
int adm_entry_get_linker_value(struct dmctx *ctx, char *param, char **value); // To be removed later!!!!!!!!!!!!
|
||||||
|
|
||||||
void bbf_entry_restart_services(struct blob_buf *bb, bool restart_services);
|
void bbf_entry_restart_services(struct blob_buf *bb, bool restart_services);
|
||||||
void bbf_entry_revert_changes(struct blob_buf *bb);
|
void bbf_entry_revert_changes(struct blob_buf *bb);
|
||||||
|
|
|
||||||
|
|
@ -598,7 +598,7 @@ int bbf_set_alias(struct dmctx *ctx, struct uci_section *s, char *option_name, c
|
||||||
** \return 0 if operation is successful, -1 otherwise
|
** \return 0 if operation is successful, -1 otherwise
|
||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
int bbf_get_reference_param(char *path, char *key_name, char *key_value, char **value);
|
int bbf_get_reference_param(char *path, char *key_name, char *key_value, char **value); // To be removed later!!!!!!!!!!!!
|
||||||
|
|
||||||
/*********************************************************************//**
|
/*********************************************************************//**
|
||||||
**
|
**
|
||||||
|
|
@ -612,7 +612,58 @@ int bbf_get_reference_param(char *path, char *key_name, char *key_value, char **
|
||||||
** \return 0 if operation is successful, -1 otherwise
|
** \return 0 if operation is successful, -1 otherwise
|
||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
int bbf_get_reference_args(char *value, struct dm_reference *reference_args);
|
int bbf_get_reference_args(char *value, struct dm_reference *reference_args); // To be removed later!!!!!!!!!!!!
|
||||||
|
|
||||||
|
/*********************************************************************//**
|
||||||
|
**
|
||||||
|
** bbfdm_get_references
|
||||||
|
**
|
||||||
|
** This API is used to get the reference parameter value
|
||||||
|
**
|
||||||
|
** \param ctx - bbf context
|
||||||
|
** \param match_action - match all or first reference resolved based on MATCH_FIRST(,), MATCH_ALL(;)
|
||||||
|
** \param base_path - parent path object
|
||||||
|
** \param key_name - parameter name used to identify the object
|
||||||
|
** \param key_value - value of parameter name used to identify the object
|
||||||
|
** \param out - buffer where the value will be stored
|
||||||
|
** \param out - buffer size where the value will be stored
|
||||||
|
**
|
||||||
|
** \return 0 if operation is successful, -1 otherwise
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
int bbfdm_get_references(struct dmctx *ctx, int match_action, const char *base_path, char *key_name, char *key_value, char *out, size_t out_len);
|
||||||
|
|
||||||
|
/*********************************************************************//**
|
||||||
|
**
|
||||||
|
** _bbfdm_get_references
|
||||||
|
**
|
||||||
|
** This API is similar to bbfdm_get_references but it is used to get only one reference
|
||||||
|
**
|
||||||
|
** \param ctx - bbf context
|
||||||
|
** \param base_path - parent path object
|
||||||
|
** \param key_name - parameter name used to identify the object
|
||||||
|
** \param key_value - value of parameter name used to identify the object
|
||||||
|
** \param value - pointer to where the value will be stored
|
||||||
|
**
|
||||||
|
** \return 0 if operation is successful, -1 otherwise
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
int _bbfdm_get_references(struct dmctx *ctx, const char *base_path, char *key_name, char *key_value, char **value);
|
||||||
|
|
||||||
|
/*********************************************************************//**
|
||||||
|
**
|
||||||
|
** bbf_get_linker_from_reference
|
||||||
|
**
|
||||||
|
** This API is used to get the reference arguments in order to set external linker
|
||||||
|
**
|
||||||
|
** \param ctx - bbf context
|
||||||
|
** \param reference_path - reference path
|
||||||
|
** \param reference - linker of the given reference path
|
||||||
|
**
|
||||||
|
** \return 0 if operation is successful, -1 otherwise
|
||||||
|
**
|
||||||
|
**************************************************************************/
|
||||||
|
int bbfdm_get_reference_linker(struct dmctx *ctx, char *reference_path, struct dm_reference *reference_args);
|
||||||
|
|
||||||
/*********************************************************************//**
|
/*********************************************************************//**
|
||||||
**
|
**
|
||||||
|
|
@ -855,7 +906,10 @@ int bbfdm_validate_hexBinary_list(struct dmctx *ctx, char *value, int min_item,
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
void bbfdm_set_fault_message(struct dmctx *ctx, const char *format, ...);
|
void bbfdm_set_fault_message(struct dmctx *ctx, const char *format, ...);
|
||||||
|
|
||||||
|
int bbf_get_reference_param(char *path, char *key_name, char *key_value, char **value);
|
||||||
|
int bbf_get_reference_args(char *value, struct dm_reference *reference_args);
|
||||||
|
|
||||||
|
//TODO
|
||||||
/**********************
|
/**********************
|
||||||
*
|
*
|
||||||
* BBF DEPRECATED APIs
|
* BBF DEPRECATED APIs
|
||||||
|
|
|
||||||
|
|
@ -1656,7 +1656,7 @@ static int setvalue_param(char *refparam, struct dmctx *ctx, void *data, char *i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bbf_get_reference_args(value, &reference);
|
bbfdm_get_reference_linker(ctx, value, &reference);
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case VALUECHECK:
|
case VALUECHECK:
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ static int set_ip_ping_diagnostics_state(char *refparam, struct dmctx *ctx, void
|
||||||
static int get_ip_ping_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
static int get_ip_ping_interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
{
|
{
|
||||||
char *linker = diagnostics_get_option("ipping", "interface");
|
char *linker = diagnostics_get_option("ipping", "interface");
|
||||||
adm_entry_get_reference_param(ctx, "Device.IP.Interface.*.Name", linker, value);
|
_bbfdm_get_references(ctx, "Device.IP.Interface.", "Name", linker, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -87,7 +87,7 @@ static int set_ip_ping_interface(char *refparam, struct dmctx *ctx, void *data,
|
||||||
char *allowed_objects[] = {"Device.IP.Interface.", NULL};
|
char *allowed_objects[] = {"Device.IP.Interface.", NULL};
|
||||||
struct dm_reference reference = {0};
|
struct dm_reference reference = {0};
|
||||||
|
|
||||||
bbf_get_reference_args(value, &reference);
|
bbfdm_get_reference_linker(ctx, value, &reference);
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case VALUECHECK:
|
case VALUECHECK:
|
||||||
|
|
@ -332,7 +332,7 @@ static int set_IPDiagnosticsTraceRoute_DiagnosticsState(char *refparam, struct d
|
||||||
static int get_IPDiagnosticsTraceRoute_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
static int get_IPDiagnosticsTraceRoute_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
{
|
{
|
||||||
char *linker = diagnostics_get_option("traceroute", "interface");
|
char *linker = diagnostics_get_option("traceroute", "interface");
|
||||||
adm_entry_get_reference_param(ctx, "Device.IP.Interface.*.Name", linker, value);
|
_bbfdm_get_references(ctx, "Device.IP.Interface.", "Name", linker, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -341,7 +341,7 @@ static int set_IPDiagnosticsTraceRoute_Interface(char *refparam, struct dmctx *c
|
||||||
char *allowed_objects[] = {"Device.IP.Interface.", NULL};
|
char *allowed_objects[] = {"Device.IP.Interface.", NULL};
|
||||||
struct dm_reference reference = {0};
|
struct dm_reference reference = {0};
|
||||||
|
|
||||||
bbf_get_reference_args(value, &reference);
|
bbfdm_get_reference_linker(ctx, value, &reference);
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case VALUECHECK:
|
case VALUECHECK:
|
||||||
|
|
@ -587,7 +587,7 @@ static int set_IPDiagnosticsDownloadDiagnostics_DiagnosticsState(char *refparam,
|
||||||
static int get_IPDiagnosticsDownloadDiagnostics_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
static int get_IPDiagnosticsDownloadDiagnostics_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
{
|
{
|
||||||
char *linker = diagnostics_get_option("download", "interface");
|
char *linker = diagnostics_get_option("download", "interface");
|
||||||
adm_entry_get_reference_param(ctx, "Device.IP.Interface.*.Name", linker, value);
|
_bbfdm_get_references(ctx, "Device.IP.Interface.", "Name", linker, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -596,7 +596,7 @@ static int set_IPDiagnosticsDownloadDiagnostics_Interface(char *refparam, struct
|
||||||
char *allowed_objects[] = {"Device.IP.Interface.", NULL};
|
char *allowed_objects[] = {"Device.IP.Interface.", NULL};
|
||||||
struct dm_reference reference = {0};
|
struct dm_reference reference = {0};
|
||||||
|
|
||||||
bbf_get_reference_args(value, &reference);
|
bbfdm_get_reference_linker(ctx, value, &reference);
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case VALUECHECK:
|
case VALUECHECK:
|
||||||
|
|
@ -917,7 +917,7 @@ static int set_IPDiagnosticsUploadDiagnostics_DiagnosticsState(char *refparam, s
|
||||||
static int get_IPDiagnosticsUploadDiagnostics_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
static int get_IPDiagnosticsUploadDiagnostics_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
{
|
{
|
||||||
char *linker = diagnostics_get_option("upload", "interface");
|
char *linker = diagnostics_get_option("upload", "interface");
|
||||||
adm_entry_get_reference_param(ctx, "Device.IP.Interface.*.Name", linker, value);
|
_bbfdm_get_references(ctx, "Device.IP.Interface.", "Name", linker, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -926,7 +926,7 @@ static int set_IPDiagnosticsUploadDiagnostics_Interface(char *refparam, struct d
|
||||||
char *allowed_objects[] = {"Device.IP.Interface.", NULL};
|
char *allowed_objects[] = {"Device.IP.Interface.", NULL};
|
||||||
struct dm_reference reference = {0};
|
struct dm_reference reference = {0};
|
||||||
|
|
||||||
bbf_get_reference_args(value, &reference);
|
bbfdm_get_reference_linker(ctx, value, &reference);
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case VALUECHECK:
|
case VALUECHECK:
|
||||||
|
|
@ -1273,7 +1273,7 @@ static int set_IPDiagnosticsUDPEchoDiagnostics_DiagnosticsState(char *refparam,
|
||||||
static int get_IPDiagnosticsUDPEchoDiagnostics_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
static int get_IPDiagnosticsUDPEchoDiagnostics_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
{
|
{
|
||||||
char *linker = diagnostics_get_option("udpechodiag", "interface");
|
char *linker = diagnostics_get_option("udpechodiag", "interface");
|
||||||
adm_entry_get_reference_param(ctx, "Device.IP.Interface.*.Name", linker, value);
|
_bbfdm_get_references(ctx, "Device.IP.Interface.", "Name", linker, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1282,7 +1282,7 @@ static int set_IPDiagnosticsUDPEchoDiagnostics_Interface(char *refparam, struct
|
||||||
char *allowed_objects[] = {"Device.IP.Interface.", NULL};
|
char *allowed_objects[] = {"Device.IP.Interface.", NULL};
|
||||||
struct dm_reference reference = {0};
|
struct dm_reference reference = {0};
|
||||||
|
|
||||||
bbf_get_reference_args(value, &reference);
|
bbfdm_get_reference_linker(ctx, value, &reference);
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case VALUECHECK:
|
case VALUECHECK:
|
||||||
|
|
@ -1553,7 +1553,7 @@ static int set_IPDiagnosticsServerSelectionDiagnostics_DiagnosticsState(char *re
|
||||||
static int get_IPDiagnosticsServerSelectionDiagnostics_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
static int get_IPDiagnosticsServerSelectionDiagnostics_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
{
|
{
|
||||||
char *linker = diagnostics_get_option("serverselection", "interface");
|
char *linker = diagnostics_get_option("serverselection", "interface");
|
||||||
adm_entry_get_reference_param(ctx, "Device.IP.Interface.*.Name", linker, value);
|
_bbfdm_get_references(ctx, "Device.IP.Interface.", "Name", linker, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1562,7 +1562,7 @@ static int set_IPDiagnosticsServerSelectionDiagnostics_Interface(char *refparam,
|
||||||
char *allowed_objects[] = {"Device.IP.Interface.", NULL};
|
char *allowed_objects[] = {"Device.IP.Interface.", NULL};
|
||||||
struct dm_reference reference = {0};
|
struct dm_reference reference = {0};
|
||||||
|
|
||||||
bbf_get_reference_args(value, &reference);
|
bbfdm_get_reference_linker(ctx, value, &reference);
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case VALUECHECK:
|
case VALUECHECK:
|
||||||
|
|
|
||||||
|
|
@ -975,7 +975,7 @@ static int get_device_active_fwimage(char *refparam, struct dmctx *ctx, void *da
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(linker, sizeof(linker), "cpe-%s", id);
|
snprintf(linker, sizeof(linker), "cpe-%s", id);
|
||||||
adm_entry_get_reference_param(ctx, "Device.DeviceInfo.FirmwareImage.*.Alias", linker, value);
|
_bbfdm_get_references(ctx, "Device.DeviceInfo.FirmwareImage.", "Alias", linker, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1000,7 +1000,7 @@ static int get_device_boot_fwimage(char *refparam, struct dmctx *ctx, void *data
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(linker, sizeof(linker), "cpe-%s", id);
|
snprintf(linker, sizeof(linker), "cpe-%s", id);
|
||||||
adm_entry_get_reference_param(ctx, "Device.DeviceInfo.FirmwareImage.*.Alias", linker, value);
|
_bbfdm_get_references(ctx, "Device.DeviceInfo.FirmwareImage.", "Alias", linker, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1009,7 +1009,7 @@ static int set_device_boot_fwimage(char *refparam, struct dmctx *ctx, void *data
|
||||||
char *allowed_objects[] = {"Device.DeviceInfo.FirmwareImage.", NULL};
|
char *allowed_objects[] = {"Device.DeviceInfo.FirmwareImage.", NULL};
|
||||||
struct dm_reference reference = {0};
|
struct dm_reference reference = {0};
|
||||||
|
|
||||||
bbf_get_reference_args(value, &reference);
|
bbfdm_get_reference_linker(ctx, value, &reference);
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case VALUECHECK:
|
case VALUECHECK:
|
||||||
|
|
|
||||||
|
|
@ -627,7 +627,7 @@ static int get_GRETunnelInterface_LowerLayers(char *refparam, struct dmctx *ctx,
|
||||||
|
|
||||||
dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "tunlink", &tunlink);
|
dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "tunlink", &tunlink);
|
||||||
|
|
||||||
adm_entry_get_reference_param(ctx, "Device.IP.Interface.*.Name", tunlink, value);
|
_bbfdm_get_references(ctx, "Device.IP.Interface.", "Name", tunlink, value);
|
||||||
|
|
||||||
// Store LowerLayers value
|
// Store LowerLayers value
|
||||||
dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "LowerLayers", *value);
|
dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "LowerLayers", *value);
|
||||||
|
|
@ -644,7 +644,7 @@ static int set_GRETunnelInterface_LowerLayers(char *refparam, struct dmctx *ctx,
|
||||||
char *allowed_objects[] = {"Device.IP.Interface.", NULL};
|
char *allowed_objects[] = {"Device.IP.Interface.", NULL};
|
||||||
struct dm_reference reference = {0};
|
struct dm_reference reference = {0};
|
||||||
|
|
||||||
bbf_get_reference_args(value, &reference);
|
bbfdm_get_reference_linker(ctx, value, &reference);
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case VALUECHECK:
|
case VALUECHECK:
|
||||||
|
|
|
||||||
|
|
@ -540,16 +540,18 @@ static int get_IEEE1905ALInterface_Status(char *refparam, struct dmctx *ctx, voi
|
||||||
/*#Device.IEEE1905.AL.Interface.{i}.LowerLayers!UBUS:ieee1905/info//interface[@i-1].ifname*/
|
/*#Device.IEEE1905.AL.Interface.{i}.LowerLayers!UBUS:ieee1905/info//interface[@i-1].ifname*/
|
||||||
static int get_IEEE1905ALInterface_LowerLayers(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
static int get_IEEE1905ALInterface_LowerLayers(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
{
|
{
|
||||||
|
char buf[256] = {0};
|
||||||
char *linker = dmjson_get_value((json_object *)data, 1, "ifname");
|
char *linker = dmjson_get_value((json_object *)data, 1, "ifname");
|
||||||
|
|
||||||
adm_entry_get_reference_param(ctx, "Device.Ethernet.Interface.*.Name", linker, value);
|
bbfdm_get_references(ctx, MATCH_FIRST, "Device.Ethernet.Interface.", "Name", linker, buf, sizeof(buf));
|
||||||
|
|
||||||
if (!DM_STRLEN(*value)) {
|
if (!DM_STRLEN(buf)) {
|
||||||
struct uci_section *s = get_dup_section_in_config_opt("wireless", "wifi-iface", "ifname", linker);
|
struct uci_section *s = get_dup_section_in_config_opt("wireless", "wifi-iface", "ifname", linker);
|
||||||
dmuci_get_value_by_section_string(s, "device", &linker);
|
dmuci_get_value_by_section_string(s, "device", &linker);
|
||||||
adm_entry_get_reference_param(ctx, "Device.WiFi.Radio.*.Name", linker, value);
|
bbfdm_get_references(ctx, MATCH_FIRST, "Device.WiFi.Radio.", "Name", linker, buf, sizeof(buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*value = dmstrdup(buf);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1509,7 +1511,7 @@ static int get_IEEE1905ALNetworkTopologyIEEE1905DeviceInterface_FrequencyIndex2(
|
||||||
/*#Device.IEEE1905.AL.NetworkTopology.IEEE1905Device.{i}.NonIEEE1905Neighbor.{i}.LocalInterface!UBUS:ieee1905/info//topology.device[@i-1].non1905_neighbors[@i-1].interface_macaddress*/
|
/*#Device.IEEE1905.AL.NetworkTopology.IEEE1905Device.{i}.NonIEEE1905Neighbor.{i}.LocalInterface!UBUS:ieee1905/info//topology.device[@i-1].non1905_neighbors[@i-1].interface_macaddress*/
|
||||||
static int get_IEEE1905ALNetworkTopologyIEEE1905DeviceNonIEEE1905Neighbor_LocalInterface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
static int get_IEEE1905ALNetworkTopologyIEEE1905DeviceNonIEEE1905Neighbor_LocalInterface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
{
|
{
|
||||||
adm_entry_get_reference_param(ctx, "Device.IEEE1905.AL.NetworkTopology.IEEE1905Device.*.Interface.*.InterfaceId", ((struct ieee1905_device_nonieee1905neighbor_args *)data)->mac_addr, value);
|
_bbfdm_get_references(ctx, "Device.IEEE1905.AL.NetworkTopology.IEEE1905Device.*.Interface.", "InterfaceId", ((struct ieee1905_device_nonieee1905neighbor_args *)data)->mac_addr, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1544,7 +1546,7 @@ static int get_IEEE1905ALNetworkTopologyIEEE1905DeviceL2Neighbor_BehindInterface
|
||||||
static int get_IEEE1905ALNetworkTopologyIEEE1905DeviceIEEE1905Neighbor_LocalInterface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
static int get_IEEE1905ALNetworkTopologyIEEE1905DeviceIEEE1905Neighbor_LocalInterface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
{
|
{
|
||||||
char *linker = ((struct ieee1905_device_ieee1905neighbor_args *)data)->mac_addr;
|
char *linker = ((struct ieee1905_device_ieee1905neighbor_args *)data)->mac_addr;
|
||||||
adm_entry_get_reference_param(ctx, "Device.IEEE1905.AL.NetworkTopology.IEEE1905Device.*.Interface.*.InterfaceId", linker, value);
|
_bbfdm_get_references(ctx, "Device.IEEE1905.AL.NetworkTopology.IEEE1905Device.*.Interface.", "InterfaceId", linker, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1638,22 +1640,13 @@ static int get_IEEE1905ALNetworkTopologyIEEE1905DeviceBridgingTuple_InterfaceLis
|
||||||
json_object *json_obj = NULL;
|
json_object *json_obj = NULL;
|
||||||
char *mac_addr = NULL;
|
char *mac_addr = NULL;
|
||||||
char buf[4096] = {0};
|
char buf[4096] = {0};
|
||||||
unsigned pos = 0;
|
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
|
||||||
buf[0] = 0;
|
|
||||||
dmjson_foreach_value_in_array((json_object *)data, json_obj, mac_addr, idx, 1, "tuple") {
|
dmjson_foreach_value_in_array((json_object *)data, json_obj, mac_addr, idx, 1, "tuple") {
|
||||||
char *linker = NULL;
|
bbfdm_get_references(ctx, MATCH_ALL, "Device.IEEE1905.AL.NetworkTopology.IEEE1905Device.*.Interface.", "InterfaceId", mac_addr, buf, sizeof(buf));
|
||||||
|
|
||||||
adm_entry_get_reference_param(ctx, "Device.IEEE1905.AL.NetworkTopology.IEEE1905Device.*.Interface.*.InterfaceId", mac_addr, &linker);
|
|
||||||
if (DM_STRLEN(linker) && (sizeof(buf) - pos) > 0)
|
|
||||||
pos += snprintf(&buf[pos], sizeof(buf) - pos, "%s,", linker);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pos)
|
*value = dmstrdup(buf);
|
||||||
buf[pos - 1] = 0;
|
|
||||||
|
|
||||||
*value = (buf[0] != '\0') ? dmstrdup(buf) : "";
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1235,6 +1235,8 @@ static int get_IPInterface_LowerLayers(char *refparam, struct dmctx *ctx, void *
|
||||||
dmuci_get_value_by_section_string(dmmap_section, "LowerLayers", value);
|
dmuci_get_value_by_section_string(dmmap_section, "LowerLayers", value);
|
||||||
|
|
||||||
if ((*value)[0] == '\0') {
|
if ((*value)[0] == '\0') {
|
||||||
|
char buf[256] = {0};
|
||||||
|
|
||||||
char *device = get_device(section_name((struct uci_section *)data));
|
char *device = get_device(section_name((struct uci_section *)data));
|
||||||
if (DM_STRLEN(device) == 0) {
|
if (DM_STRLEN(device) == 0) {
|
||||||
dmuci_get_value_by_section_string((struct uci_section *)data, "device", &device);
|
dmuci_get_value_by_section_string((struct uci_section *)data, "device", &device);
|
||||||
|
|
@ -1242,30 +1244,32 @@ static int get_IPInterface_LowerLayers(char *refparam, struct dmctx *ctx, void *
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
adm_entry_get_reference_param(ctx, "Device.PPP.Interface.*.Name", device, value);
|
bbfdm_get_references(ctx, MATCH_FIRST, "Device.PPP.Interface.", "Name", device, buf, sizeof(buf));
|
||||||
if (DM_STRLEN(*value))
|
if (DM_STRLEN(buf))
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
adm_entry_get_reference_param(ctx, "Device.Ethernet."BBF_VENDOR_PREFIX"MACVLAN.*.Name", device, value);
|
bbfdm_get_references(ctx, MATCH_FIRST, "Device.Ethernet."BBF_VENDOR_PREFIX"MACVLAN.", "Name", device, buf, sizeof(buf));
|
||||||
if (DM_STRLEN(*value))
|
if (DM_STRLEN(buf))
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
adm_entry_get_reference_param(ctx, "Device.Ethernet.VLANTermination.*.Name", device, value);
|
bbfdm_get_references(ctx, MATCH_FIRST, "Device.Ethernet.VLANTermination.", "Name", device, buf, sizeof(buf));
|
||||||
if (DM_STRLEN(*value))
|
if (DM_STRLEN(buf))
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
adm_entry_get_reference_param(ctx, "Device.Ethernet.Link.*.Name", device, value);
|
bbfdm_get_references(ctx, MATCH_FIRST, "Device.Ethernet.Link.", "Name", device, buf, sizeof(buf));
|
||||||
if (DM_STRLEN(*value))
|
if (DM_STRLEN(buf))
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
if ((DM_STRLEN(device) > 5) && DM_LSTRNCMP(device, "gre", 3) == 0) {
|
if ((DM_STRLEN(device) > 5) && DM_LSTRNCMP(device, "gre", 3) == 0) {
|
||||||
// gre device name is of the form gre4-<iface> or gre6-<iface>
|
// gre device name is of the form gre4-<iface> or gre6-<iface>
|
||||||
adm_entry_get_reference_param(ctx, "Device.GRE.Tunnel.*.Interface.*.Name", device + 5, value);
|
bbfdm_get_references(ctx, MATCH_FIRST, "Device.GRE.Tunnel.*.Interface.", "Name", device + 5, buf, sizeof(buf));
|
||||||
}
|
}
|
||||||
|
|
||||||
end:
|
end:
|
||||||
// Store LowerLayers value
|
// Store LowerLayers value
|
||||||
dmuci_set_value_by_section(dmmap_section, "LowerLayers", *value);
|
dmuci_set_value_by_section(dmmap_section, "LowerLayers", buf);
|
||||||
|
|
||||||
|
*value = dmstrdup(buf);
|
||||||
} else {
|
} else {
|
||||||
if (!adm_entry_object_exists(ctx, *value))
|
if (!adm_entry_object_exists(ctx, *value))
|
||||||
*value = "";
|
*value = "";
|
||||||
|
|
@ -1288,7 +1292,7 @@ static int set_IPInterface_LowerLayers(char *refparam, struct dmctx *ctx, void *
|
||||||
char *curr_device = NULL;
|
char *curr_device = NULL;
|
||||||
struct dm_reference reference = {0};
|
struct dm_reference reference = {0};
|
||||||
|
|
||||||
bbf_get_reference_args(value, &reference);
|
bbfdm_get_reference_linker(ctx, value, &reference);
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case VALUECHECK:
|
case VALUECHECK:
|
||||||
|
|
@ -1370,7 +1374,7 @@ static int get_IPInterface_Router(char *refparam, struct dmctx *ctx, void *data,
|
||||||
dmuci_get_value_by_section_string((struct uci_section *)data, "ip4table", &ip4table);
|
dmuci_get_value_by_section_string((struct uci_section *)data, "ip4table", &ip4table);
|
||||||
|
|
||||||
snprintf(linker, sizeof(linker), "route_table-%s", DM_STRLEN(ip4table) ? ip4table : "254");
|
snprintf(linker, sizeof(linker), "route_table-%s", DM_STRLEN(ip4table) ? ip4table : "254");
|
||||||
adm_entry_get_reference_param(ctx, "Device.Routing.Router.*.Alias", linker, value);
|
_bbfdm_get_references(ctx, "Device.Routing.Router.", "Alias", linker, value);
|
||||||
|
|
||||||
// Store LowerLayers value
|
// Store LowerLayers value
|
||||||
dmuci_set_value_by_section(dmmap_section, "Router", *value);
|
dmuci_set_value_by_section(dmmap_section, "Router", *value);
|
||||||
|
|
@ -1386,7 +1390,7 @@ static int set_IPInterface_Router(char *refparam, struct dmctx *ctx, void *data,
|
||||||
struct uci_section *s = NULL;
|
struct uci_section *s = NULL;
|
||||||
char *device = NULL;
|
char *device = NULL;
|
||||||
|
|
||||||
bbf_get_reference_args(value, &reference);
|
bbfdm_get_reference_linker(ctx, value, &reference);
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case VALUECHECK:
|
case VALUECHECK:
|
||||||
|
|
@ -2037,7 +2041,7 @@ static int get_IPInterfaceIPv6Prefix_ParentPrefix(char *refparam, struct dmctx *
|
||||||
char *linker = NULL;
|
char *linker = NULL;
|
||||||
|
|
||||||
dmuci_get_value_by_section_string(((struct intf_ip_args *)data)->dmmap_sec, "address", &linker);
|
dmuci_get_value_by_section_string(((struct intf_ip_args *)data)->dmmap_sec, "address", &linker);
|
||||||
adm_entry_get_reference_param(ctx, "Device.IP.Interface.*.IPv6Prefix.*.ChildPrefixBits", linker, value);
|
_bbfdm_get_references(ctx, "Device.IP.Interface.*.IPv6Prefix.", "ChildPrefixBits", linker, value);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -212,7 +212,7 @@ static int get_MQTTBroker_Interface(char *refparam, struct dmctx *ctx, void *dat
|
||||||
char *intf = NULL;
|
char *intf = NULL;
|
||||||
|
|
||||||
dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "interface", &intf);
|
dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "interface", &intf);
|
||||||
adm_entry_get_reference_param(ctx, "Device.IP.Interface.*.Name", intf, value);
|
_bbfdm_get_references(ctx, "Device.IP.Interface.", "Name", intf, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -221,7 +221,7 @@ static int set_MQTTBroker_Interface(char *refparam, struct dmctx *ctx, void *dat
|
||||||
char *allowed_objects[] = {"Device.IP.Interface.", NULL};
|
char *allowed_objects[] = {"Device.IP.Interface.", NULL};
|
||||||
struct dm_reference reference = {0};
|
struct dm_reference reference = {0};
|
||||||
|
|
||||||
bbf_get_reference_args(value, &reference);
|
bbfdm_get_reference_linker(ctx, value, &reference);
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case VALUECHECK:
|
case VALUECHECK:
|
||||||
|
|
|
||||||
|
|
@ -194,7 +194,7 @@ static int set_PacketCapture_DiagnosticsState(char *refparam, struct dmctx *ctx,
|
||||||
static int get_PacketCapture_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
static int get_PacketCapture_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
{
|
{
|
||||||
char *linker = diagnostics_get_option("packetcapture", "Interface");
|
char *linker = diagnostics_get_option("packetcapture", "Interface");
|
||||||
adm_entry_get_reference_param(ctx, "Device.IP.Interface.*.Name", linker, value);
|
_bbfdm_get_references(ctx, "Device.IP.Interface.", "Name", linker, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -203,7 +203,7 @@ static int set_PacketCapture_Interface(char *refparam, struct dmctx *ctx, void *
|
||||||
char *allowed_objects[] = {"Device.IP.Interface.", NULL};
|
char *allowed_objects[] = {"Device.IP.Interface.", NULL};
|
||||||
struct dm_reference reference = {0};
|
struct dm_reference reference = {0};
|
||||||
|
|
||||||
bbf_get_reference_args(value, &reference);
|
bbfdm_get_reference_linker(ctx, value, &reference);
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case VALUECHECK:
|
case VALUECHECK:
|
||||||
|
|
|
||||||
|
|
@ -952,6 +952,7 @@ static int get_ppp_lower_layer(char *refparam, struct dmctx *ctx, void *data, ch
|
||||||
|
|
||||||
if ((*value)[0] == '\0') {
|
if ((*value)[0] == '\0') {
|
||||||
char *device = NULL;
|
char *device = NULL;
|
||||||
|
char buf[256] = {0};
|
||||||
|
|
||||||
if (ppp->iface_s) {
|
if (ppp->iface_s) {
|
||||||
device = get_device(section_name(ppp->iface_s));
|
device = get_device(section_name(ppp->iface_s));
|
||||||
|
|
@ -964,19 +965,21 @@ static int get_ppp_lower_layer(char *refparam, struct dmctx *ctx, void *data, ch
|
||||||
if (DM_STRLEN(device) == 0)
|
if (DM_STRLEN(device) == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
adm_entry_get_reference_param(ctx, "Device.Ethernet."BBF_VENDOR_PREFIX"MACVLAN.*.Name", device, value);
|
bbfdm_get_references(ctx, MATCH_FIRST, "Device.Ethernet."BBF_VENDOR_PREFIX"MACVLAN.", "Name", device, buf, sizeof(buf));
|
||||||
if (DM_STRLEN(*value))
|
if (DM_STRLEN(buf))
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
adm_entry_get_reference_param(ctx, "Device.Ethernet.VLANTermination.*.Name", device, value);
|
bbfdm_get_references(ctx, MATCH_FIRST, "Device.Ethernet.VLANTermination.", "Name", device, buf, sizeof(buf));
|
||||||
if (DM_STRLEN(*value))
|
if (DM_STRLEN(buf))
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
adm_entry_get_reference_param(ctx, "Device.Ethernet.Link.*.Name", device, value);
|
bbfdm_get_references(ctx, MATCH_FIRST, "Device.Ethernet.Link.", "Name", device, buf, sizeof(buf));
|
||||||
|
|
||||||
end:
|
end:
|
||||||
// Store LowerLayers value
|
// Store LowerLayers value
|
||||||
dmuci_set_value_by_section(ppp->dmmap_s, "LowerLayers", *value);
|
dmuci_set_value_by_section(ppp->dmmap_s, "LowerLayers", buf);
|
||||||
|
|
||||||
|
*value = dmstrdup(buf);
|
||||||
} else {
|
} else {
|
||||||
if (!adm_entry_object_exists(ctx, *value))
|
if (!adm_entry_object_exists(ctx, *value))
|
||||||
*value = "";
|
*value = "";
|
||||||
|
|
@ -997,7 +1000,7 @@ static int set_ppp_lower_layer(char *refparam, struct dmctx *ctx, void *data, ch
|
||||||
struct dm_reference reference = {0};
|
struct dm_reference reference = {0};
|
||||||
char proto[8] = {0};
|
char proto[8] = {0};
|
||||||
|
|
||||||
bbf_get_reference_args(value, &reference);
|
bbfdm_get_reference_linker(ctx, value, &reference);
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case VALUECHECK:
|
case VALUECHECK:
|
||||||
|
|
|
||||||
|
|
@ -287,7 +287,7 @@ static int get_RouterAdvertisementInterfaceSetting_Interface(char *refparam, str
|
||||||
char *linker = NULL;
|
char *linker = NULL;
|
||||||
|
|
||||||
dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "interface", &linker);
|
dmuci_get_value_by_section_string(((struct dm_data *)data)->config_section, "interface", &linker);
|
||||||
adm_entry_get_reference_param(ctx, "Device.IP.Interface.*.Name", linker, value);
|
_bbfdm_get_references(ctx, "Device.IP.Interface.", "Name", linker, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -296,7 +296,7 @@ static int set_RouterAdvertisementInterfaceSetting_Interface(char *refparam, str
|
||||||
char *allowed_objects[] = {"Device.IP.Interface.", NULL};
|
char *allowed_objects[] = {"Device.IP.Interface.", NULL};
|
||||||
struct dm_reference reference = {0};
|
struct dm_reference reference = {0};
|
||||||
|
|
||||||
bbf_get_reference_args(value, &reference);
|
bbfdm_get_reference_linker(ctx, value, &reference);
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case VALUECHECK:
|
case VALUECHECK:
|
||||||
|
|
|
||||||
|
|
@ -736,7 +736,7 @@ static int get_RoutingRouterForwarding_Interface(char *refparam, struct dmctx *c
|
||||||
char *linker = NULL;
|
char *linker = NULL;
|
||||||
|
|
||||||
dmuci_get_value_by_section_string(((struct routingfwdargs *)data)->routefwdsection, "interface", &linker);
|
dmuci_get_value_by_section_string(((struct routingfwdargs *)data)->routefwdsection, "interface", &linker);
|
||||||
adm_entry_get_reference_param(ctx, "Device.IP.Interface.*.Name", linker, value);
|
_bbfdm_get_references(ctx, "Device.IP.Interface.", "Name", linker, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -745,7 +745,7 @@ static int set_RoutingRouterForwarding_Interface(char *refparam, struct dmctx *c
|
||||||
char *allowed_objects[] = {"Device.IP.Interface.", NULL};
|
char *allowed_objects[] = {"Device.IP.Interface.", NULL};
|
||||||
struct dm_reference reference = {0};
|
struct dm_reference reference = {0};
|
||||||
|
|
||||||
bbf_get_reference_args(value, &reference);
|
bbfdm_get_reference_linker(ctx, value, &reference);
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case VALUECHECK:
|
case VALUECHECK:
|
||||||
|
|
@ -1054,7 +1054,7 @@ static int get_RoutingRouteInformationInterfaceSetting_Interface(char *refparam,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
adm_entry_get_reference_param(ctx, "Device.IP.Interface.*.Name", iface, value);
|
_bbfdm_get_references(ctx, "Device.IP.Interface.", "Name", iface, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,10 +28,10 @@ static char *get_selftest_log_instance(struct dmctx *ctx)
|
||||||
if (DM_STRLEN(file_name) == 0)
|
if (DM_STRLEN(file_name) == 0)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
adm_entry_get_reference_param(ctx, "Device.DeviceInfo.VendorLogFile.*.Name", file_name, &path);
|
_bbfdm_get_references(ctx, "Device.DeviceInfo.VendorLogFile.", "Name", file_name, &path);
|
||||||
|
|
||||||
err:
|
err:
|
||||||
return dmstrdup(path ? path : "");
|
return path ? path : dmstrdup("");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*************************************************************
|
/*************************************************************
|
||||||
|
|
|
||||||
|
|
@ -475,11 +475,14 @@ static int get_UPnPDiscoveryService_Location(char *refparam, struct dmctx *ctx,
|
||||||
|
|
||||||
static int get_UPnPDiscoveryService_ParentDevice(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
static int get_UPnPDiscoveryService_ParentDevice(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
{
|
{
|
||||||
adm_entry_get_reference_param(ctx, "Device.UPnP.Discovery.Device.*.UUID", ((struct upnpdiscovery *)data)->uuid, value);
|
char buf[256] = {0};
|
||||||
|
|
||||||
if (!DM_STRLEN(*value))
|
bbfdm_get_references(ctx, MATCH_FIRST, "Device.UPnP.Discovery.Device.", "UUID", ((struct upnpdiscovery *)data)->uuid, buf, sizeof(buf));
|
||||||
adm_entry_get_reference_param(ctx, "Device.UPnP.Discovery.RootDevice.*.UUID", ((struct upnpdiscovery *)data)->uuid, value);
|
|
||||||
|
|
||||||
|
if (!DM_STRLEN(buf))
|
||||||
|
bbfdm_get_references(ctx, MATCH_FIRST, "Device.UPnP.Discovery.RootDevice.", "UUID", ((struct upnpdiscovery *)data)->uuid, buf, sizeof(buf));
|
||||||
|
|
||||||
|
*value = dmstrdup(buf);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -520,7 +523,7 @@ static int get_UPnPDescriptionDeviceInstance_UDN(char *refparam, struct dmctx *c
|
||||||
|
|
||||||
static int get_UPnPDescriptionDeviceInstance_ParentDevice(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
static int get_UPnPDescriptionDeviceInstance_ParentDevice(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
{
|
{
|
||||||
adm_entry_get_reference_param(ctx, "Device.UPnP.Description.DeviceInstance.*.UDN", ((struct upnp_device_inst *)data)->parentudn, value);
|
_bbfdm_get_references(ctx, "Device.UPnP.Description.DeviceInstance.", "UDN", ((struct upnp_device_inst *)data)->parentudn, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -529,6 +532,7 @@ static int get_UPnPDescriptionDeviceInstance_DiscoveryDevice(char *refparam, str
|
||||||
struct upnp_device_inst *upnpdevinst = (struct upnp_device_inst *)data;
|
struct upnp_device_inst *upnpdevinst = (struct upnp_device_inst *)data;
|
||||||
|
|
||||||
if (upnpdevinst->udn && upnpdevinst->udn[0]) {
|
if (upnpdevinst->udn && upnpdevinst->udn[0]) {
|
||||||
|
char buf[256] = {0};
|
||||||
size_t length = 0;
|
size_t length = 0;
|
||||||
|
|
||||||
char **udnarray = strsplit(upnpdevinst->udn, ":", &length);
|
char **udnarray = strsplit(upnpdevinst->udn, ":", &length);
|
||||||
|
|
@ -536,10 +540,12 @@ static int get_UPnPDescriptionDeviceInstance_DiscoveryDevice(char *refparam, str
|
||||||
if (length != 2)
|
if (length != 2)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
adm_entry_get_reference_param(ctx, "Device.UPnP.Discovery.Device.*.UUID", udnarray[1], value);
|
bbfdm_get_references(ctx, MATCH_FIRST, "Device.UPnP.Discovery.Device.", "UUID", udnarray[1], buf, sizeof(buf));
|
||||||
|
|
||||||
if (!DM_STRLEN(*value))
|
if (!DM_STRLEN(*value))
|
||||||
adm_entry_get_reference_param(ctx, "Device.UPnP.Discovery.RootDevice.*.UUID", udnarray[1], value);
|
bbfdm_get_references(ctx, MATCH_FIRST, "Device.UPnP.Discovery.RootDevice.", "UUID", udnarray[1], buf, sizeof(buf));
|
||||||
|
|
||||||
|
*value = dmstrdup(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -624,7 +630,7 @@ static int get_UPnPDescriptionDeviceInstance_PresentationURL(char *refparam, str
|
||||||
|
|
||||||
static int get_UPnPDescriptionServiceInstance_ParentDevice(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
static int get_UPnPDescriptionServiceInstance_ParentDevice(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
{
|
{
|
||||||
adm_entry_get_reference_param(ctx, "Device.UPnP.Description.DeviceInstance.*.UDN", ((struct upnp_service_inst *)data)->parentudn, value);
|
_bbfdm_get_references(ctx, "Device.UPnP.Description.DeviceInstance.", "UDN", ((struct upnp_service_inst *)data)->parentudn, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -641,7 +647,7 @@ static int get_UPnPDescriptionServiceInstance_ServiceDiscovery(char *refparam, s
|
||||||
|
|
||||||
snprintf(usn, sizeof(usn), "%s::%s", ((struct upnp_service_inst *)data)->parentudn, ((struct upnp_service_inst *)data)->servicetype);
|
snprintf(usn, sizeof(usn), "%s::%s", ((struct upnp_service_inst *)data)->parentudn, ((struct upnp_service_inst *)data)->servicetype);
|
||||||
|
|
||||||
adm_entry_get_reference_param(ctx, "Device.UPnP.Discovery.Service.*.USN", usn, value);
|
_bbfdm_get_references(ctx, "Device.UPnP.Discovery.Service.", "USN", usn, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2428,7 +2428,7 @@ static int get_WiFiEndPoint_SSIDReference(char *refparam, struct dmctx *ctx, voi
|
||||||
{
|
{
|
||||||
struct uci_section *iface_s = get_dup_section_in_config_opt("wireless", "wifi-iface", "ifname", (char *)((struct dm_data *)data)->additional_data);
|
struct uci_section *iface_s = get_dup_section_in_config_opt("wireless", "wifi-iface", "ifname", (char *)((struct dm_data *)data)->additional_data);
|
||||||
|
|
||||||
adm_entry_get_reference_param(ctx, "Device.WiFi.SSID.*.Name", section_name(iface_s), value);
|
_bbfdm_get_references(ctx, "Device.WiFi.SSID.", "Name", section_name(iface_s), value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2879,7 +2879,8 @@ static int get_ssid_lower_layer(char *refparam, struct dmctx *ctx, void *data, c
|
||||||
char *device = NULL;
|
char *device = NULL;
|
||||||
|
|
||||||
dmuci_get_value_by_section_string(((struct dm_data *)data)->dmmap_section, "device", &device);
|
dmuci_get_value_by_section_string(((struct dm_data *)data)->dmmap_section, "device", &device);
|
||||||
adm_entry_get_reference_param(ctx, "Device.WiFi.Radio.*.Name", device, value);
|
|
||||||
|
_bbfdm_get_references(ctx, "Device.WiFi.Radio.", "Name", device, value);
|
||||||
|
|
||||||
// Store LowerLayers value
|
// Store LowerLayers value
|
||||||
dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "LowerLayers", *value);
|
dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "LowerLayers", *value);
|
||||||
|
|
@ -2896,7 +2897,7 @@ static int set_ssid_lower_layer(char *refparam, struct dmctx *ctx, void *data, c
|
||||||
char *allowed_objects[] = {"Device.WiFi.Radio.", NULL};
|
char *allowed_objects[] = {"Device.WiFi.Radio.", NULL};
|
||||||
struct dm_reference reference = {0};
|
struct dm_reference reference = {0};
|
||||||
|
|
||||||
bbf_get_reference_args(value, &reference);
|
bbfdm_get_reference_linker(ctx, value, &reference);
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case VALUECHECK:
|
case VALUECHECK:
|
||||||
|
|
@ -2926,7 +2927,7 @@ static int get_ap_ssid_ref(char *refparam, struct dmctx *ctx, void *data, char *
|
||||||
dmuci_get_value_by_section_string(((struct dm_data *)data)->dmmap_section, "LowerLayers", value);
|
dmuci_get_value_by_section_string(((struct dm_data *)data)->dmmap_section, "LowerLayers", value);
|
||||||
|
|
||||||
if ((*value)[0] == '\0') {
|
if ((*value)[0] == '\0') {
|
||||||
adm_entry_get_reference_param(ctx, "Device.WiFi.SSID.*.Name", section_name(((struct dm_data *)data)->config_section), value);
|
_bbfdm_get_references(ctx, "Device.WiFi.SSID.", "Name", section_name(((struct dm_data *)data)->config_section), value);
|
||||||
|
|
||||||
// Store LowerLayers value
|
// Store LowerLayers value
|
||||||
dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "LowerLayers", *value);
|
dmuci_set_value_by_section(((struct dm_data *)data)->dmmap_section, "LowerLayers", *value);
|
||||||
|
|
@ -2944,7 +2945,7 @@ static int set_ap_ssid_ref(char *refparam, struct dmctx *ctx, void *data, char *
|
||||||
struct uci_section *ss = NULL;
|
struct uci_section *ss = NULL;
|
||||||
struct dm_reference reference = {0};
|
struct dm_reference reference = {0};
|
||||||
|
|
||||||
bbf_get_reference_args(value, &reference);
|
bbfdm_get_reference_linker(ctx, value, &reference);
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case VALUECHECK:
|
case VALUECHECK:
|
||||||
|
|
|
||||||
|
|
@ -2797,7 +2797,7 @@ static int get_WiFiDataElementsNetworkDeviceMultiAPDevice_LastContactTime(char *
|
||||||
static int get_WiFiDataElementsNetworkDeviceMultiAPDevice_AssocIEEE1905DeviceRef(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
static int get_WiFiDataElementsNetworkDeviceMultiAPDevice_AssocIEEE1905DeviceRef(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
{
|
{
|
||||||
char *device_id = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "ID");
|
char *device_id = dmjson_get_value(((struct dm_data *)data)->json_object, 1, "ID");
|
||||||
adm_entry_get_reference_param(ctx, "Device.IEEE1905.AL.NetworkTopology.IEEE1905Device.*.IEEE1905Id", device_id, value);
|
_bbfdm_get_references(ctx, "Device.IEEE1905.AL.NetworkTopology.IEEE1905Device.", "IEEE1905Id", device_id, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ int get_IPDiagnosticsIPLayerCapacity_SupportedMetrics(char *refparam, struct dmc
|
||||||
static int get_IPDiagnosticsIPLayerCapacity_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
static int get_IPDiagnosticsIPLayerCapacity_Interface(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
|
||||||
{
|
{
|
||||||
char *linker = diagnostics_get_option("iplayercapacity", "interface");
|
char *linker = diagnostics_get_option("iplayercapacity", "interface");
|
||||||
adm_entry_get_reference_param(ctx, "Device.IP.Interface.*.Name", linker, value);
|
_bbfdm_get_references(ctx, "Device.IP.Interface.", "Name", linker, value);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -129,7 +129,7 @@ static int set_IPDiagnosticsIPLayerCapacity_Interface(char *refparam, struct dmc
|
||||||
char *allowed_objects[] = {"Device.IP.Interface.", NULL};
|
char *allowed_objects[] = {"Device.IP.Interface.", NULL};
|
||||||
struct dm_reference reference = {0};
|
struct dm_reference reference = {0};
|
||||||
|
|
||||||
bbf_get_reference_args(value, &reference);
|
bbfdm_get_reference_linker(ctx, value, &reference);
|
||||||
|
|
||||||
switch (action) {
|
switch (action) {
|
||||||
case VALUECHECK:
|
case VALUECHECK:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue