Add CMD_INIT_NOTIFY: add nodtify parameters to list_parameter of dmctx

This commit is contained in:
Omar Kallel 2020-12-07 16:06:23 +01:00
parent 5d10fba083
commit 8b433b79cf
7 changed files with 96 additions and 96 deletions

View file

@ -83,11 +83,6 @@ void del_list_parameter(struct dm_parameter *dm_parameter)
api_del_list_parameter(dm_parameter);
}
int dm_update_file_enabled_notify(char *param, char *new_value)
{
return bbf_api_dm_update_file_enabled_notify(param, new_value);
}
void dmjson_parse_init(char *msg)
{
bbf_api_dmjson_parse_init(msg);

View file

@ -23,7 +23,6 @@ int set_bbfdatamodel_type(int bbf_type);
int get_bbfdatamodel_type(void);
int bbf_set_ip_version(int ipversion);
void del_list_parameter(struct dm_parameter *dm_parameter);
int dm_update_file_enabled_notify(char *param, char *new_value);
void dmjson_parse_init(char *msg);
void dmjson_parse_fini(void);
json_object *dmjson_select_obj(json_object * jobj, char *argv[]);

View file

@ -327,6 +327,10 @@ int dm_entry_param_method(struct dmctx *ctx, int cmd, char *inparam, char *arg1,
fault = FAULT_9003;
}
break;
case CMD_INIT_NOTIFY:
ctx->in_param = "";
fault = dm_entry_enabled_notify(ctx);
break;
case CMD_ADD_OBJECT:
fault = dm_entry_add_object(ctx);
if (!fault) {

View file

@ -297,12 +297,12 @@ static void fill_wireless_scan_results(struct dmctx *dmctx, char *radio)
dmasprintf(&signal_stregth, "Result.%d.SignalStrength", wifi_neighbor_count);
dmasprintf(&noise, "Result.%d.Noise", wifi_neighbor_count);
add_list_parameter(dmctx, ssid, neighboring.ssid, DMT_TYPE[DMT_STRING], NULL, 0);
add_list_parameter(dmctx, bssid, neighboring.bssid, DMT_TYPE[DMT_STRING], NULL, 0);
add_list_parameter(dmctx, channel, neighboring.channel, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, frequency, neighboring.frequency, DMT_TYPE[DMT_STRING], NULL, 0);
add_list_parameter(dmctx, signal_stregth, neighboring.signal_strength, DMT_TYPE[DMT_INT], NULL, 0);
add_list_parameter(dmctx, noise, neighboring.noise, DMT_TYPE[DMT_INT], NULL, 0);
add_list_parameter(dmctx, ssid, neighboring.ssid, DMT_TYPE[DMT_STRING], NULL, 0, NULL);
add_list_parameter(dmctx, bssid, neighboring.bssid, DMT_TYPE[DMT_STRING], NULL, 0, NULL);
add_list_parameter(dmctx, channel, neighboring.channel, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
add_list_parameter(dmctx, frequency, neighboring.frequency, DMT_TYPE[DMT_STRING], NULL, 0, NULL);
add_list_parameter(dmctx, signal_stregth, neighboring.signal_strength, DMT_TYPE[DMT_INT], NULL, 0, NULL);
add_list_parameter(dmctx, noise, neighboring.noise, DMT_TYPE[DMT_INT], NULL, 0, NULL);
}
}
@ -362,14 +362,14 @@ static opr_ret_t ip_diagnostics_ipping(struct dmctx *dmctx, char *path, json_obj
ipping.minimum_response_time_detailed = get_diagnostics_option("ipping", "MinimumResponseTimeDetailed");
ipping.maximum_response_time_detailed = get_diagnostics_option("ipping", "MaximumResponseTimeDetailed");
add_list_parameter(dmctx, dmstrdup("SuccessCount"), ipping.success_count, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, dmstrdup("FailureCount"), ipping.failure_count, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, dmstrdup("AverageResponseTime"), ipping.average_response_time, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, dmstrdup("MinimumResponseTime"), ipping.minimum_response_time, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, dmstrdup("MaximumResponseTime"), ipping.maximum_response_time, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, dmstrdup("AverageResponseTimeDetailed"), ipping.average_response_time_detailed, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, dmstrdup("MinimumResponseTimeDetailed"), ipping.minimum_response_time_detailed, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, dmstrdup("MaximumResponseTimeDetailed"), ipping.maximum_response_time_detailed, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, dmstrdup("SuccessCount"), ipping.success_count, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("FailureCount"), ipping.failure_count, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("AverageResponseTime"), ipping.average_response_time, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("MinimumResponseTime"), ipping.minimum_response_time, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("MaximumResponseTime"), ipping.maximum_response_time, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("AverageResponseTimeDetailed"), ipping.average_response_time_detailed, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("MinimumResponseTimeDetailed"), ipping.minimum_response_time_detailed, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("MaximumResponseTimeDetailed"), ipping.maximum_response_time_detailed, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
return SUCCESS;
}
@ -412,7 +412,7 @@ static opr_ret_t ip_diagnostics_traceroute(struct dmctx *dmctx, char *path, json
alloc_uci_ctx_bbfdm();
traceroute.response_time = get_diagnostics_option("traceroute", "ResponseTime");
add_list_parameter(dmctx, dmstrdup("ResponseTime"), traceroute.response_time, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, dmstrdup("ResponseTime"), traceroute.response_time, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
uci_path_foreach_sections(bbfdm, DMMAP_DIAGNOSTIGS, "RouteHops", s) {
dmasprintf(&host, "RouteHops.%d.Host", i);
@ -424,10 +424,10 @@ static opr_ret_t ip_diagnostics_traceroute(struct dmctx *dmctx, char *path, json
dmuci_get_value_by_section_string(s, "ip", &traceroute.host_address);
dmuci_get_value_by_section_string(s, "time", &traceroute.rttimes);
add_list_parameter(dmctx, host, traceroute.host_name, DMT_TYPE[DMT_STRING], NULL, 0);
add_list_parameter(dmctx, host_address, traceroute.host_address, DMT_TYPE[DMT_STRING], NULL, 0);
add_list_parameter(dmctx, errorcode, "0", DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, rttimes, traceroute.rttimes, DMT_TYPE[DMT_STRING], NULL, 0);
add_list_parameter(dmctx, host, traceroute.host_name, DMT_TYPE[DMT_STRING], NULL, 0, NULL);
add_list_parameter(dmctx, host_address, traceroute.host_address, DMT_TYPE[DMT_STRING], NULL, 0, NULL);
add_list_parameter(dmctx, errorcode, "0", DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
add_list_parameter(dmctx, rttimes, traceroute.rttimes, DMT_TYPE[DMT_STRING], NULL, 0, NULL);
i++;
}
@ -474,18 +474,18 @@ static opr_ret_t ip_diagnostics_download(struct dmctx *dmctx, char *path, json_o
download.tcp_open_request_time = get_diagnostics_option("download", "TCPOpenRequestTime");
download.tcp_open_response_time = get_diagnostics_option("download", "TCPOpenResponseTime");
add_list_parameter(dmctx, dmstrdup("ROMTime"), download.romtime, DMT_TYPE[DMT_TIME], NULL, 0);
add_list_parameter(dmctx, dmstrdup("BOMTime"), download.bomtime, DMT_TYPE[DMT_TIME], NULL, 0);
add_list_parameter(dmctx, dmstrdup("EOMTime"), download.eomtime, DMT_TYPE[DMT_TIME], NULL, 0);
add_list_parameter(dmctx, dmstrdup("TestBytesReceived"), download.test_bytes_received, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, dmstrdup("TotalBytesReceived"), download.total_bytes_received, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, dmstrdup("TotalBytesSent"), download.total_bytes_sent, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, dmstrdup("TestBytesReceivedUnderFullLoading"), download.test_bytes_received_under_full_loading, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, dmstrdup("TotalBytesReceivedUnderFullLoading"), download.total_bytes_received_under_full_loading, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, dmstrdup("TotalBytesSentUnderFullLoading"), download.total_bytes_sent_under_full_loading, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, dmstrdup("PeriodOfFullLoading"), download.period_of_full_loading, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, dmstrdup("TCPOpenRequestTime"), download.tcp_open_request_time, DMT_TYPE[DMT_TIME], NULL, 0);
add_list_parameter(dmctx, dmstrdup("TCPOpenResponseTime"), download.tcp_open_response_time, DMT_TYPE[DMT_TIME], NULL, 0);
add_list_parameter(dmctx, dmstrdup("ROMTime"), download.romtime, DMT_TYPE[DMT_TIME], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("BOMTime"), download.bomtime, DMT_TYPE[DMT_TIME], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("EOMTime"), download.eomtime, DMT_TYPE[DMT_TIME], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("TestBytesReceived"), download.test_bytes_received, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("TotalBytesReceived"), download.total_bytes_received, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("TotalBytesSent"), download.total_bytes_sent, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("TestBytesReceivedUnderFullLoading"), download.test_bytes_received_under_full_loading, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("TotalBytesReceivedUnderFullLoading"), download.total_bytes_received_under_full_loading, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("TotalBytesSentUnderFullLoading"), download.total_bytes_sent_under_full_loading, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("PeriodOfFullLoading"), download.period_of_full_loading, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("TCPOpenRequestTime"), download.tcp_open_request_time, DMT_TYPE[DMT_TIME], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("TCPOpenResponseTime"), download.tcp_open_response_time, DMT_TYPE[DMT_TIME], NULL, 0, NULL);
return SUCCESS;
}
@ -534,18 +534,18 @@ static opr_ret_t ip_diagnostics_upload(struct dmctx *dmctx, char *path, json_obj
upload.tcp_open_request_time = get_diagnostics_option("upload", "TCPOpenRequestTime");
upload.tcp_open_response_time = get_diagnostics_option("upload", "TCPOpenResponseTime");
add_list_parameter(dmctx, dmstrdup("ROMTime"), upload.romtime, DMT_TYPE[DMT_TIME], NULL, 0);
add_list_parameter(dmctx, dmstrdup("BOMTime"), upload.bomtime, DMT_TYPE[DMT_TIME], NULL, 0);
add_list_parameter(dmctx, dmstrdup("EOMTime"), upload.eomtime, DMT_TYPE[DMT_TIME], NULL, 0);
add_list_parameter(dmctx, dmstrdup("TestBytesSent"), upload.test_bytes_sent, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, dmstrdup("TotalBytesReceived"), upload.total_bytes_received, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, dmstrdup("TotalBytesSent"), upload.total_bytes_sent, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, dmstrdup("TestBytesSentUnderFullLoading"), upload.test_bytes_sent_under_full_loading, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, dmstrdup("TotalBytesReceivedUnderFullLoading"), upload.total_bytes_received_under_full_loading, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, dmstrdup("TotalBytesSentUnderFullLoading"), upload.total_bytes_sent_under_full_loading, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, dmstrdup("PeriodOfFullLoading"), upload.period_of_full_loading, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, dmstrdup("TCPOpenRequestTime"), upload.tcp_open_request_time, DMT_TYPE[DMT_TIME], NULL, 0);
add_list_parameter(dmctx, dmstrdup("TCPOpenResponseTime"), upload.tcp_open_response_time, DMT_TYPE[DMT_TIME], NULL, 0);
add_list_parameter(dmctx, dmstrdup("ROMTime"), upload.romtime, DMT_TYPE[DMT_TIME], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("BOMTime"), upload.bomtime, DMT_TYPE[DMT_TIME], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("EOMTime"), upload.eomtime, DMT_TYPE[DMT_TIME], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("TestBytesSent"), upload.test_bytes_sent, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("TotalBytesReceived"), upload.total_bytes_received, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("TotalBytesSent"), upload.total_bytes_sent, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("TestBytesSentUnderFullLoading"), upload.test_bytes_sent_under_full_loading, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("TotalBytesReceivedUnderFullLoading"), upload.total_bytes_received_under_full_loading, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("TotalBytesSentUnderFullLoading"), upload.total_bytes_sent_under_full_loading, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("PeriodOfFullLoading"), upload.period_of_full_loading, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("TCPOpenRequestTime"), upload.tcp_open_request_time, DMT_TYPE[DMT_TIME], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("TCPOpenResponseTime"), upload.tcp_open_response_time, DMT_TYPE[DMT_TIME], NULL, 0, NULL);
return SUCCESS;
}
@ -596,11 +596,11 @@ static opr_ret_t ip_diagnostics_udpecho(struct dmctx *dmctx, char *path, json_ob
udpecho.minimum_response_time = get_diagnostics_option("udpechodiag", "MinimumResponseTime");
udpecho.maximum_response_time = get_diagnostics_option("udpechodiag", "MaximumResponseTime");
add_list_parameter(dmctx, dmstrdup("SuccessCount"), udpecho.success_count, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, dmstrdup("FailureCount"), udpecho.failure_count, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, dmstrdup("AverageResponseTime"), udpecho.average_response_time, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, dmstrdup("MinimumResponseTime"), udpecho.minimum_response_time, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, dmstrdup("MaximumResponseTime"), udpecho.maximum_response_time, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, dmstrdup("SuccessCount"), udpecho.success_count, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("FailureCount"), udpecho.failure_count, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("AverageResponseTime"), udpecho.average_response_time, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("MinimumResponseTime"), udpecho.minimum_response_time, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("MaximumResponseTime"), udpecho.maximum_response_time, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
return SUCCESS;
}
@ -646,10 +646,10 @@ static opr_ret_t ip_diagnostics_serverselection(struct dmctx *dmctx, char *path,
serverselection.minimum_response_time = get_diagnostics_option("serverselection", "MinimumResponseTime");
serverselection.maximum_response_time = get_diagnostics_option("serverselection", "MaximumResponseTime");
add_list_parameter(dmctx, dmstrdup("FastestHost"), serverselection.fasthost, DMT_TYPE[DMT_STRING], NULL, 0);
add_list_parameter(dmctx, dmstrdup("AverageResponseTime"), serverselection.average_response_time, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, dmstrdup("MinimumResponseTime"), serverselection.minimum_response_time, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, dmstrdup("MaximumResponseTime"), serverselection.maximum_response_time, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, dmstrdup("FastestHost"), serverselection.fasthost, DMT_TYPE[DMT_STRING], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("AverageResponseTime"), serverselection.average_response_time, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("MinimumResponseTime"), serverselection.minimum_response_time, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("MaximumResponseTime"), serverselection.maximum_response_time, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
return SUCCESS;
}
@ -687,7 +687,7 @@ static opr_ret_t ip_diagnostics_nslookup(struct dmctx *dmctx, char *path, json_o
nslookup.success_count = get_diagnostics_option("nslookup", "SuccessCount");
char *param_success_count = dmstrdup("SuccessCount");
add_list_parameter(dmctx, param_success_count, nslookup.success_count, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, param_success_count, nslookup.success_count, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
uci_path_foreach_sections(bbfdm, DMMAP_DIAGNOSTIGS, "NSLookupResult", s) {
dmasprintf(&status, "Result.%d.Status", i);
@ -704,12 +704,12 @@ static opr_ret_t ip_diagnostics_nslookup(struct dmctx *dmctx, char *path, json_o
dmuci_get_value_by_section_string(s, "DNSServerIP", &nslookup.dns_server_ip);
dmuci_get_value_by_section_string(s, "ResponseTime", &nslookup.response_time);
add_list_parameter(dmctx, status, nslookup.status, DMT_TYPE[DMT_STRING], NULL, 0);
add_list_parameter(dmctx, answertype, nslookup.answer_type, DMT_TYPE[DMT_STRING], NULL, 0);
add_list_parameter(dmctx, hostname, nslookup.hostname_returned, DMT_TYPE[DMT_STRING], NULL, 0);
add_list_parameter(dmctx, ipaddress, nslookup.ip_addresses, DMT_TYPE[DMT_STRING], NULL, 0);
add_list_parameter(dmctx, dnsserverip, nslookup.dns_server_ip, DMT_TYPE[DMT_STRING], NULL, 0);
add_list_parameter(dmctx, responsetime, nslookup.response_time, DMT_TYPE[DMT_UNINT], NULL, 0);
add_list_parameter(dmctx, status, nslookup.status, DMT_TYPE[DMT_STRING], NULL, 0, NULL);
add_list_parameter(dmctx, answertype, nslookup.answer_type, DMT_TYPE[DMT_STRING], NULL, 0, NULL);
add_list_parameter(dmctx, hostname, nslookup.hostname_returned, DMT_TYPE[DMT_STRING], NULL, 0, NULL);
add_list_parameter(dmctx, ipaddress, nslookup.ip_addresses, DMT_TYPE[DMT_STRING], NULL, 0, NULL);
add_list_parameter(dmctx, dnsserverip, nslookup.dns_server_ip, DMT_TYPE[DMT_STRING], NULL, 0, NULL);
add_list_parameter(dmctx, responsetime, nslookup.response_time, DMT_TYPE[DMT_UNINT], NULL, 0, NULL);
i++;
}
@ -1189,14 +1189,14 @@ void operate_list_cmds(struct dmctx *dmctx)
param = dmstrdup(operate_helper[i].name);
type = (char *)operate_helper[i].type;
args = &operate_helper[i].args;
add_list_parameter(dmctx, param, (char *)args, type, NULL, 0);
add_list_parameter(dmctx, param, (char *)args, type, NULL, 0, NULL);
}
for (; (dynamic_operate && dynamic_operate->name); dynamic_operate++) {
param = dmstrdup(dynamic_operate->name);
type = (char *)dynamic_operate->type;
args = &dynamic_operate->args;
add_list_parameter(dmctx, param, (char *)args, type, NULL, 0);
add_list_parameter(dmctx, param, (char *)args, type, NULL, 0, NULL);
}
if (save_pointer)dynamic_operate = save_pointer;

View file

@ -127,9 +127,9 @@ opr_ret_t dynamicDeviceOperate(struct dmctx *dmctx, char *path, json_object *inp
char *param_download = (char *) dmjson_get_value(ubus_res, 1, "download");
char *param_upload = (char *) dmjson_get_value(ubus_res, 1, "upload");
add_list_parameter(dmctx, dmstrdup("Latency"), param_latency, "string", NULL, 0);
add_list_parameter(dmctx, dmstrdup("Download"), param_download, "string", NULL, 0);
add_list_parameter(dmctx, dmstrdup("Upload"), param_upload, "string", NULL, 0);
add_list_parameter(dmctx, dmstrdup("Latency"), param_latency, "string", NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("Download"), param_download, "string", NULL, 0, NULL);
add_list_parameter(dmctx, dmstrdup("Upload"), param_upload, "string", NULL, 0, NULL);
return SUCCESS;
}

View file

@ -809,7 +809,7 @@ int get_empty(char *refparam, struct dmctx *ctx, void *data, char *instance, cha
return 0;
}
void add_list_parameter(struct dmctx *ctx, char *param_name, char *param_data, char *param_type, char *param_version, unsigned int flags)
void add_list_parameter(struct dmctx *ctx, char *param_name, char *param_data, char *param_type, char *param_version, unsigned int flags, char *param_notification)
{
struct dm_parameter *dm_parameter;
struct list_head *ilist;
@ -829,6 +829,7 @@ void add_list_parameter(struct dmctx *ctx, char *param_name, char *param_data, c
dm_parameter->type = param_type;
dm_parameter->version = param_version;
dm_parameter->flags = flags;
dm_parameter->notification = param_notification;
}
void api_del_list_parameter(struct dm_parameter *dm_parameter)
@ -1311,7 +1312,7 @@ static int get_value_param(DMPARAM_ARGS)
value = (value && *value) ? check_value_by_type(value, type) : get_default_value_by_type(type);
add_list_parameter(dmctx, full_param, value, DMT_TYPE[type], NULL, 0);
add_list_parameter(dmctx, full_param, value, DMT_TYPE[type], NULL, 0, NULL);
return 0;
}
@ -1334,7 +1335,7 @@ static int mparam_get_value_in_param(DMPARAM_ARGS)
value = (value && *value) ? check_value_by_type(value, type) : get_default_value_by_type(type);
add_list_parameter(dmctx, full_param, value, DMT_TYPE[type], NULL, 0);
add_list_parameter(dmctx, full_param, value, DMT_TYPE[type], NULL, 0, NULL);
dmctx->stop = true;
return 0;
}
@ -1400,7 +1401,7 @@ static int mparam_get_name(DMPARAM_ARGS)
if (permission->get_permission != NULL)
perm = permission->get_permission(refparam, dmctx, data, instance);
add_list_parameter(dmctx, refparam, perm, DMT_TYPE[type], NULL, 0);
add_list_parameter(dmctx, refparam, perm, DMT_TYPE[type], NULL, 0, NULL);
return 0;
}
@ -1412,7 +1413,7 @@ static int mobj_get_name(DMOBJECT_ARGS)
if (permission->get_permission != NULL)
perm = permission->get_permission(refparam, dmctx, data, instance);
add_list_parameter(dmctx, refparam, perm, "xsd:object", NULL, 0);
add_list_parameter(dmctx, refparam, perm, "xsd:object", NULL, 0, NULL);
return 0;
}
@ -1433,7 +1434,7 @@ static int mparam_get_name_in_param(DMPARAM_ARGS)
if (permission->get_permission != NULL)
perm = permission->get_permission(refparam, dmctx, data, instance);
add_list_parameter(dmctx, refparam, perm, DMT_TYPE[type], NULL, 0);
add_list_parameter(dmctx, refparam, perm, DMT_TYPE[type], NULL, 0, NULL);
return 0;
}
@ -1452,7 +1453,7 @@ static int mparam_get_name_in_obj(DMPARAM_ARGS)
if (permission->get_permission != NULL)
perm = permission->get_permission(refparam, dmctx, data, instance);
add_list_parameter(dmctx, refparam, perm, DMT_TYPE[type], NULL, 0);
add_list_parameter(dmctx, refparam, perm, DMT_TYPE[type], NULL, 0, NULL);
return 0;
}
@ -1473,7 +1474,7 @@ static int mobj_get_name_in_obj(DMOBJECT_ARGS)
if (permission->get_permission != NULL)
perm = permission->get_permission(refparam, dmctx, data, instance);
add_list_parameter(dmctx, refparam, perm, "xsd:object", NULL, 0);
add_list_parameter(dmctx, refparam, perm, "xsd:object", NULL, 0, NULL);
return 0;
}
@ -1506,7 +1507,7 @@ static int mobj_get_schema_name(DMOBJECT_ARGS)
if (node->obj)
unique_keys = node->obj->unique_keys;
add_list_parameter(dmctx, refparam, perm, "xsd:object", (char *) unique_keys, 0);
add_list_parameter(dmctx, refparam, perm, "xsd:object", (char *) unique_keys, 0, NULL);
return 0;
}
@ -1516,7 +1517,7 @@ static int mparam_get_schema_name(DMPARAM_ARGS)
char *perm = permission->val;
dmastrcat(&refparam, node->current_object, lastname);
add_list_parameter(dmctx, refparam, perm, DMT_TYPE[type], NULL, 0);
add_list_parameter(dmctx, refparam, perm, DMT_TYPE[type], NULL, 0, NULL);
return 0;
}
@ -1560,7 +1561,7 @@ static int mobj_get_instances_in_obj(DMOBJECT_ARGS)
if (name) {
name[strlen(name) - 1] = 0;
add_list_parameter(dmctx, name, NULL, "xsd:object", NULL, 0);
add_list_parameter(dmctx, name, NULL, "xsd:object", NULL, 0, NULL);
}
}
@ -1629,7 +1630,7 @@ static int mparam_get_notification(DMPARAM_ARGS)
} else {
value = check_parameter_forced_notification(refparam);
}
add_list_parameter(dmctx, refparam, value, DMT_TYPE[type], NULL, 0);
add_list_parameter(dmctx, refparam, value, DMT_TYPE[type], NULL, 0, NULL);
return 0;
}
@ -1653,7 +1654,7 @@ static int mparam_get_notification_in_param(DMPARAM_ARGS)
} else {
value = check_parameter_forced_notification(refparam);
}
add_list_parameter(dmctx, refparam, value, DMT_TYPE[type], NULL, 0);
add_list_parameter(dmctx, refparam, value, DMT_TYPE[type], NULL, 0, NULL);
dmctx->stop = 1;
return 0;
}
@ -1994,11 +1995,11 @@ static int enabled_notify_check_param(DMPARAM_ARGS)
}
if (notif[0] == '1' || notif[0] == '2' || notif[0] == '4' || notif[0] == '6') {
stype = DMT_TYPE[type];
add_list_parameter(dmctx, refparam, value, DMT_TYPE[type], NULL, 0, notif);
dmjson_fprintf(fp, 4, DMJSON_ARGS{{"parameter", refparam}, {"notification", notif}, {"value", value}, {"type", stype}});
}
fclose(fp);
dmfree(refparam);
return 0;
}
@ -2420,7 +2421,7 @@ static int mobj_upnp_get_instances(DMOBJECT_ARGS)
dmctx->stop = 1;
return FAULT_UPNP_703;
}
add_list_parameter(dmctx, refparam, NULL, NULL, NULL, 0);
add_list_parameter(dmctx, refparam, NULL, NULL, NULL, 0, NULL);
return 0;
}
@ -2470,7 +2471,7 @@ static int mparam_upnp_get_supportedparams(DMPARAM_ARGS)
return FAULT_UPNP_703;
}
dmctx->findparam = 1;
add_list_parameter(dmctx, refparam, NULL, NULL, NULL, 0);
add_list_parameter(dmctx, refparam, NULL, NULL, NULL, 0, NULL);
return 0;
}
}
@ -2480,7 +2481,7 @@ static int mparam_upnp_get_supportedparams(DMPARAM_ARGS)
dmctx->stop = 1;
return FAULT_UPNP_703;
}
add_list_parameter(dmctx, refparam, NULL, NULL, NULL, 0);
add_list_parameter(dmctx, refparam, NULL, NULL, NULL, 0, NULL);
return 0;
}
return FAULT_UPNP_703;
@ -2501,7 +2502,7 @@ static int mobj_upnp_get_supportedparams(DMOBJECT_ARGS)
dmctx->stop = 1;
return FAULT_UPNP_703;
}
add_list_parameter(dmctx, refparam, NULL, NULL, NULL, 0);
add_list_parameter(dmctx, refparam, NULL, NULL, NULL, 0, NULL);
return 0;
}
return FAULT_UPNP_703;
@ -2566,7 +2567,7 @@ static int mparam_upnp_structured_get_value_in_param(DMPARAM_ARGS)
}
dmctx->findparam = 1;
(get_cmd)(full_param, dmctx, data, instance, &value);
add_list_parameter(dmctx, full_param, value, DMT_TYPE[type], NULL, 0);
add_list_parameter(dmctx, full_param, value, DMT_TYPE[type], NULL, 0, NULL);
return 0;
}
@ -2631,7 +2632,7 @@ static int upnp_get_value_param(DMPARAM_ARGS)
return FAULT_UPNP_703;
}
(get_cmd)(full_param, dmctx, data, instance, &value);
add_list_parameter(dmctx, full_param, value, NULL, NULL, 0);
add_list_parameter(dmctx, full_param, value, NULL, NULL, 0, NULL);
return 0;
}
@ -2656,7 +2657,7 @@ static int mparam_upnp_get_value_in_param(DMPARAM_ARGS)
return FAULT_UPNP_703;
}
(get_cmd)(full_param, dmctx, data, instance, &value);
add_list_parameter(dmctx, full_param, value, NULL, NULL, 0);
add_list_parameter(dmctx, full_param, value, NULL, NULL, 0, NULL);
dmctx->stop = 1;
return 0;
}
@ -2922,7 +2923,7 @@ static int mparam_upnp_get_attributes(DMPARAM_ARGS)
get_parameter_version(dmctx, refparam, &version, &s);
flags |= UPNP_DMT_TYPE[type];
add_list_parameter(dmctx, refparam, perm, NULL, version, flags);
add_list_parameter(dmctx, refparam, perm, NULL, version, flags, NULL);
return 0;
}
@ -2962,7 +2963,7 @@ static int mobj_upnp_get_attributes(DMOBJECT_ARGS)
else if (node->obj->browseinstobj)
flags |= (NODE_DATA_ATTRIBUTE_MULTIINSTANCE | NODE_DATA_ATTRIBUTE_TYPEPTR);
add_list_parameter(dmctx, refparam, perm, NULL, version, flags);
add_list_parameter(dmctx, refparam, perm, NULL, version, flags, NULL);
return 0;
}
@ -3107,7 +3108,7 @@ static int mparam_upnp_get_acldata(DMPARAM_ARGS)
dmctx->stop = 1;
add_list_parameter(dmctx, refparam, NULL, NULL, NULL, flags);
add_list_parameter(dmctx, refparam, NULL, NULL, NULL, flags, NULL);
return 0;
}
@ -3131,7 +3132,7 @@ static int mobj_upnp_get_acldata(DMOBJECT_ARGS)
dmctx->stop = 1;
flags |= DM_FACTORIZED;
add_list_parameter(dmctx, refparam, NULL, NULL, NULL, flags);
add_list_parameter(dmctx, refparam, NULL, NULL, NULL, flags, NULL);
return 0;
}

View file

@ -316,6 +316,7 @@ enum {
CMD_GET_NOTIFICATION,
CMD_SET_VALUE,
CMD_SET_NOTIFICATION,
CMD_INIT_NOTIFY,
CMD_ADD_OBJECT,
CMD_DEL_OBJECT,
CMD_USP_OPERATE,
@ -568,7 +569,7 @@ char *update_instance(char *max_inst, int argc, ...);
char *update_instance_alias(int action, char **last_inst, char **max_inst, void *argv[]);
char *update_instance_without_section(int action, char **last_inst, char **max_inst, void *argv[]);
int get_empty(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value);
void add_list_parameter(struct dmctx *ctx, char *param_name, char *param_data, char *param_type, char *param_version, unsigned int flags);
void add_list_parameter(struct dmctx *ctx, char *param_name, char *param_data, char *param_type, char *param_version, unsigned int flags, char *param_notification);
void api_del_list_parameter(struct dm_parameter *dm_parameter);
void free_all_list_parameter(struct dmctx *ctx);
void add_set_list_tmp(struct dmctx *ctx, char *param, char *value, unsigned int flags);