diff --git a/bin/Makefile.am b/bin/Makefile.am index 40932b2a..ed513b25 100644 --- a/bin/Makefile.am +++ b/bin/Makefile.am @@ -67,6 +67,11 @@ libbbfdm_la_SOURCES += \ ../dmtree/tr143/diagnostics.c endif +if BBF_TR157 +libbbfdm_la_SOURCES += \ + ../dmtree/tr157/bulkdata.c +endif + if BBF_TR064 libbbfdm_la_SOURCES += \ ../dmtree/tr064/upnp_device.c \ @@ -104,4 +109,5 @@ libbbfdm_la_CFLAGS+=-I../dmtree/ libbbfdm_la_CFLAGS+=-I../dmtree/tr181 libbbfdm_la_CFLAGS+=-I../dmtree/tr104 libbbfdm_la_CFLAGS+=-I../dmtree/tr143 +libbbfdm_la_CFLAGS+=-I../dmtree/tr157 libbbfdm_la_CFLAGS+=-I../dmtree/tr064 diff --git a/configure.ac b/configure.ac index bb82bb6d..22b1dd7a 100644 --- a/configure.ac +++ b/configure.ac @@ -12,6 +12,9 @@ AM_CONDITIONAL([BBF_TR104],[test "x$enable_tr104" = "xyes"]) AC_ARG_ENABLE(tr143, [AS_HELP_STRING([--enable-tr143], [enable tr143 diagnostics feature])], AC_DEFINE(BBF_TR143),) AM_CONDITIONAL([BBF_TR143],[test "x$enable_tr143" = "xyes"]) +AC_ARG_ENABLE(tr157, [AS_HELP_STRING([--enable-tr157], [enable tr157 bulkdata collector feature])], AC_DEFINE(BBF_TR157),) +AM_CONDITIONAL([BBF_TR157],[test "x$enable_tr157" = "xyes"]) + AC_ARG_ENABLE(tr064, [AS_HELP_STRING([--enable-tr064], [enable tr064 upnp feature])], AC_DEFINE(BBF_TR064),) AM_CONDITIONAL([BBF_TR064],[test "x$enable_tr064" = "xyes"]) diff --git a/dmtree/tr157/bulkdata.c b/dmtree/tr157/bulkdata.c new file mode 100644 index 00000000..1713e491 --- /dev/null +++ b/dmtree/tr157/bulkdata.c @@ -0,0 +1,1264 @@ +/* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 2 of the License, or +* (at your option) any later version. +* +* Copyright (C) 2019 iopsys Software Solutions AB +* Author: Amin Ben Ramdhane +*/ + +#include "dmbbf.h" +#include "dmcommon.h" +#include "dmuci.h" +#include "dmubus.h" +#include "dmjson.h" +#include "dmentry.h" +#include "bulkdata.h" + +/* *** Device.BulkData. *** */ +DMOBJ tBulkDataObj[] = { +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextobj, leaf, linker, bbfdm_type*/ +{"Profile", &DMWRITE, addObjBulkDataProfile, delObjBulkDataProfile, NULL, browseBulkDataProfileInst, NULL, NULL, tBulkDataProfileObj, tBulkDataProfileParams, NULL, BBFDM_BOTH}, +{0} +}; + +DMLEAF tBulkDataParams[] = { +/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/ +{"Enable", &DMWRITE, DMT_BOOL, get_BulkData_Enable, set_BulkData_Enable, NULL, NULL, BBFDM_BOTH}, +{"Status", &DMREAD, DMT_STRING, get_BulkData_Status, NULL, NULL, NULL, BBFDM_BOTH}, +{"MinReportingInterval", &DMREAD, DMT_UNINT, get_BulkData_MinReportingInterval, NULL, NULL, NULL, BBFDM_BOTH}, +{"Protocols", &DMREAD, DMT_STRING, get_BulkData_Protocols, NULL, NULL, NULL, BBFDM_BOTH}, +{"EncodingTypes", &DMREAD, DMT_STRING, get_BulkData_EncodingTypes, NULL, NULL, NULL, BBFDM_BOTH}, +{"ParameterWildCardSupported", &DMREAD, DMT_BOOL, get_BulkData_ParameterWildCardSupported, NULL, NULL, NULL, BBFDM_BOTH}, +{"MaxNumberOfProfiles", &DMREAD, DMT_INT, get_BulkData_MaxNumberOfProfiles, NULL, NULL, NULL, BBFDM_BOTH}, +{"MaxNumberOfParameterReferences", &DMREAD, DMT_INT, get_BulkData_MaxNumberOfParameterReferences, NULL, NULL, NULL, BBFDM_BOTH}, +{"ProfileNumberOfEntries", &DMREAD, DMT_UNINT, get_BulkData_ProfileNumberOfEntries, NULL, NULL, NULL, BBFDM_BOTH}, +{0} +}; + +/* *** Device.BulkData.Profile.{i}. *** */ +DMOBJ tBulkDataProfileObj[] = { +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextobj, leaf, linker, bbfdm_type*/ +{"Parameter", &DMWRITE, addObjBulkDataProfileParameter, delObjBulkDataProfileParameter, NULL, browseBulkDataProfileParameterInst, NULL, NULL, NULL, tBulkDataProfileParameterParams, NULL, BBFDM_BOTH}, +{"CSVEncoding", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tBulkDataProfileCSVEncodingParams, NULL, BBFDM_BOTH}, +{"JSONEncoding", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, NULL, tBulkDataProfileJSONEncodingParams, NULL, BBFDM_BOTH}, +{"HTTP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tBulkDataProfileHTTPObj, tBulkDataProfileHTTPParams, NULL, BBFDM_BOTH}, +{0} +}; + +DMLEAF tBulkDataProfileParams[] = { +/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/ +{"Enable", &DMWRITE, DMT_BOOL, get_BulkDataProfile_Enable, set_BulkDataProfile_Enable, NULL, NULL, BBFDM_BOTH}, +{"Alias", &DMWRITE, DMT_STRING, get_BulkDataProfile_Alias, set_BulkDataProfile_Alias, NULL, NULL, BBFDM_BOTH}, +{"Name", &DMWRITE, DMT_STRING, get_BulkDataProfile_Name, set_BulkDataProfile_Name, NULL, NULL, BBFDM_BOTH}, +{"NumberOfRetainedFailedReports", &DMWRITE, DMT_INT, get_BulkDataProfile_NumberOfRetainedFailedReports, set_BulkDataProfile_NumberOfRetainedFailedReports, NULL, NULL, BBFDM_BOTH}, +{"Protocol", &DMWRITE, DMT_STRING, get_BulkDataProfile_Protocol, set_BulkDataProfile_Protocol, NULL, NULL, BBFDM_BOTH}, +{"EncodingType", &DMWRITE, DMT_STRING, get_BulkDataProfile_EncodingType, set_BulkDataProfile_EncodingType, NULL, NULL, BBFDM_BOTH}, +{"ReportingInterval", &DMWRITE, DMT_UNINT, get_BulkDataProfile_ReportingInterval, set_BulkDataProfile_ReportingInterval, NULL, NULL, BBFDM_BOTH}, +{"TimeReference", &DMWRITE, DMT_TIME, get_BulkDataProfile_TimeReference, set_BulkDataProfile_TimeReference, NULL, NULL, BBFDM_BOTH}, +{"ParameterNumberOfEntries", &DMREAD, DMT_UNINT, get_BulkDataProfile_ParameterNumberOfEntries, NULL, NULL, NULL, BBFDM_BOTH}, +//{"StreamingHost", &DMWRITE, DMT_STRING, get_BulkDataProfile_StreamingHost, set_BulkDataProfile_StreamingHost, NULL, NULL, BBFDM_BOTH}, +//{"StreamingPort", &DMWRITE, DMT_UNINT, get_BulkDataProfile_StreamingPort, set_BulkDataProfile_StreamingPort, NULL, NULL, BBFDM_BOTH}, +//{"StreamingSessionID", &DMWRITE, DMT_UNINT, get_BulkDataProfile_StreamingSessionID, set_BulkDataProfile_StreamingSessionID, NULL, NULL, BBFDM_BOTH}, +//{"FileTransferURL", &DMWRITE, DMT_STRING, get_BulkDataProfile_FileTransferURL, set_BulkDataProfile_FileTransferURL, NULL, NULL, BBFDM_BOTH}, +//{"FileTransferUsername", &DMWRITE, DMT_STRING, get_BulkDataProfile_FileTransferUsername, set_BulkDataProfile_FileTransferUsername, NULL, NULL, BBFDM_BOTH}, +//{"FileTransferPassword", &DMWRITE, DMT_STRING, get_BulkDataProfile_FileTransferPassword, set_BulkDataProfile_FileTransferPassword, NULL, NULL, BBFDM_BOTH}, +//{"ControlFileFormat", &DMWRITE, DMT_STRING, get_BulkDataProfile_ControlFileFormat, set_BulkDataProfile_ControlFileFormat, NULL, NULL, BBFDM_BOTH}, +//{"Controller", &DMREAD, DMT_STRING, get_BulkDataProfile_Controller, NULL, NULL, NULL, BBFDM_USP}, +{0} +}; + +/* *** Device.BulkData.Profile.{i}.Parameter.{i}. *** */ +DMLEAF tBulkDataProfileParameterParams[] = { +/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/ +{"Name", &DMWRITE, DMT_STRING, get_BulkDataProfileParameter_Name, set_BulkDataProfileParameter_Name, NULL, NULL, BBFDM_BOTH}, +{"Reference", &DMWRITE, DMT_STRING, get_BulkDataProfileParameter_Reference, set_BulkDataProfileParameter_Reference, NULL, NULL, BBFDM_BOTH}, +{0} +}; + +/* *** Device.BulkData.Profile.{i}.CSVEncoding. *** */ +DMLEAF tBulkDataProfileCSVEncodingParams[] = { +/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/ +{"FieldSeparator", &DMWRITE, DMT_STRING, get_BulkDataProfileCSVEncoding_FieldSeparator, set_BulkDataProfileCSVEncoding_FieldSeparator, NULL, NULL, BBFDM_BOTH}, +{"RowSeparator", &DMWRITE, DMT_STRING, get_BulkDataProfileCSVEncoding_RowSeparator, set_BulkDataProfileCSVEncoding_RowSeparator, NULL, NULL, BBFDM_BOTH}, +{"EscapeCharacter", &DMWRITE, DMT_STRING, get_BulkDataProfileCSVEncoding_EscapeCharacter, set_BulkDataProfileCSVEncoding_EscapeCharacter, NULL, NULL, BBFDM_BOTH}, +{"ReportFormat", &DMWRITE, DMT_STRING, get_BulkDataProfileCSVEncoding_ReportFormat, set_BulkDataProfileCSVEncoding_ReportFormat, NULL, NULL, BBFDM_BOTH}, +{"RowTimestamp", &DMWRITE, DMT_STRING, get_BulkDataProfileCSVEncoding_RowTimestamp, set_BulkDataProfileCSVEncoding_RowTimestamp, NULL, NULL, BBFDM_BOTH}, +{0} +}; + +/* *** Device.BulkData.Profile.{i}.JSONEncoding. *** */ +DMLEAF tBulkDataProfileJSONEncodingParams[] = { +/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/ +{"ReportFormat", &DMWRITE, DMT_STRING, get_BulkDataProfileJSONEncoding_ReportFormat, set_BulkDataProfileJSONEncoding_ReportFormat, NULL, NULL, BBFDM_BOTH}, +{"ReportTimestamp", &DMWRITE, DMT_STRING, get_BulkDataProfileJSONEncoding_ReportTimestamp, set_BulkDataProfileJSONEncoding_ReportTimestamp, NULL, NULL, BBFDM_BOTH}, +{0} +}; + +/* *** Device.BulkData.Profile.{i}.HTTP. *** */ +DMOBJ tBulkDataProfileHTTPObj[] = { +/* OBJ, permission, addobj, delobj, checkobj, browseinstobj, forced_inform, notification, nextobj, leaf, linker, bbfdm_type*/ +{"RequestURIParameter", &DMWRITE, addObjBulkDataProfileHTTPRequestURIParameter, delObjBulkDataProfileHTTPRequestURIParameter, NULL, browseBulkDataProfileHTTPRequestURIParameterInst, NULL, NULL, NULL, tBulkDataProfileHTTPRequestURIParameterParams, NULL, BBFDM_BOTH}, +{0} +}; + +DMLEAF tBulkDataProfileHTTPParams[] = { +/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/ +{"URL", &DMWRITE, DMT_STRING, get_BulkDataProfileHTTP_URL, set_BulkDataProfileHTTP_URL, NULL, NULL, BBFDM_BOTH}, +{"Username", &DMWRITE, DMT_STRING, get_BulkDataProfileHTTP_Username, set_BulkDataProfileHTTP_Username, NULL, NULL, BBFDM_BOTH}, +{"Password", &DMWRITE, DMT_STRING, get_BulkDataProfileHTTP_Password, set_BulkDataProfileHTTP_Password, NULL, NULL, BBFDM_BOTH}, +{"CompressionsSupported", &DMREAD, DMT_STRING, get_BulkDataProfileHTTP_CompressionsSupported, NULL, NULL, NULL, BBFDM_BOTH}, +{"Compression", &DMWRITE, DMT_STRING, get_BulkDataProfileHTTP_Compression, set_BulkDataProfileHTTP_Compression, NULL, NULL, BBFDM_BOTH}, +{"MethodsSupported", &DMREAD, DMT_STRING, get_BulkDataProfileHTTP_MethodsSupported, NULL, NULL, NULL, BBFDM_BOTH}, +{"Method", &DMWRITE, DMT_STRING, get_BulkDataProfileHTTP_Method, set_BulkDataProfileHTTP_Method, NULL, NULL, BBFDM_BOTH}, +{"UseDateHeader", &DMWRITE, DMT_BOOL, get_BulkDataProfileHTTP_UseDateHeader, set_BulkDataProfileHTTP_UseDateHeader, NULL, NULL, BBFDM_BOTH}, +{"RetryEnable", &DMWRITE, DMT_BOOL, get_BulkDataProfileHTTP_RetryEnable, set_BulkDataProfileHTTP_RetryEnable, NULL, NULL, BBFDM_BOTH}, +{"RetryMinimumWaitInterval", &DMWRITE, DMT_UNINT, get_BulkDataProfileHTTP_RetryMinimumWaitInterval, set_BulkDataProfileHTTP_RetryMinimumWaitInterval, NULL, NULL, BBFDM_BOTH}, +{"RetryIntervalMultiplier", &DMWRITE, DMT_UNINT, get_BulkDataProfileHTTP_RetryIntervalMultiplier, set_BulkDataProfileHTTP_RetryIntervalMultiplier, NULL, NULL, BBFDM_BOTH}, +{"RequestURIParameterNumberOfEntries", &DMREAD, DMT_UNINT, get_BulkDataProfileHTTP_RequestURIParameterNumberOfEntries, NULL, NULL, NULL, BBFDM_BOTH}, +{"PersistAcrossReboot", &DMWRITE, DMT_BOOL, get_BulkDataProfileHTTP_PersistAcrossReboot, set_BulkDataProfileHTTP_PersistAcrossReboot, NULL, NULL, BBFDM_BOTH}, +{0} +}; + +/* *** Device.BulkData.Profile.{i}.HTTP.RequestURIParameter.{i}. *** */ +DMLEAF tBulkDataProfileHTTPRequestURIParameterParams[] = { +/* PARAM, permission, type, getvalue, setvalue, forced_inform, notification, bbfdm_type*/ +{"Name", &DMWRITE, DMT_STRING, get_BulkDataProfileHTTPRequestURIParameter_Name, set_BulkDataProfileHTTPRequestURIParameter_Name, NULL, NULL, BBFDM_BOTH}, +{"Reference", &DMWRITE, DMT_STRING, get_BulkDataProfileHTTPRequestURIParameter_Reference, set_BulkDataProfileHTTPRequestURIParameter_Reference, NULL, NULL, BBFDM_BOTH}, +{0} +}; + +/************************************************************* + * ENTRY METHOD +/*************************************************************/ +/*#Device.BulkData.Profile.{i}.!UCI:cwmp_bulkdata/profile/dmmap_cwmp_profile*/ +int browseBulkDataProfileInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) +{ + char *profile = NULL, *profile_last = NULL; + struct uci_section *s = NULL; + + uci_foreach_sections("cwmp_bulkdata", "profile", s) { + profile = handle_update_instance(1, dmctx, &profile_last, update_instance_alias, 3, s, "profile_instance", "profile_alias"); + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, profile) == DM_STOP) + break; + } + return 0; +} + +/*#Device.BulkData.Profile.{i}.Parameter.{i}.!UCI:cwmp_bulkdata/profile_parameter/dmmap_cwmp_profile_parameter*/ +int browseBulkDataProfileParameterInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) +{ + char *profile_parameter = NULL, *profile_parameter_last = NULL, *profile_id, *prev_profile_id; + struct uci_section *s = NULL, *prev_section = (struct uci_section *)prev_data; + + dmuci_get_value_by_section_string(prev_section, "profile_id", &prev_profile_id); + uci_foreach_sections("cwmp_bulkdata", "profile_parameter", s) { + dmuci_get_value_by_section_string(s, "profile_id", &profile_id); + if(strcmp(profile_id, prev_profile_id) != 0) + continue; + profile_parameter = handle_update_instance(1, dmctx, &profile_parameter_last, update_instance_alias, 3, s, "parameter_instance", "parameter_alias"); + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, profile_parameter) == DM_STOP) + break; + } + return 0; +} + +/*#Device.BulkData.Profile.{i}.HTTP.RequestURIParameter.{i}.!UCI:cwmp_bulkdata/profile_http_request_uri_parameter/dmmap_cwmp_profile_http_request_uri_parameter*/ +int browseBulkDataProfileHTTPRequestURIParameterInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance) +{ + char *profile_http_request_uri_parameter = NULL, *profile_http_request_uri_parameter_last = NULL, *profile_id, *prev_profile_id; + struct uci_section *s = NULL, *prev_section = (struct uci_section *)prev_data; + + dmuci_get_value_by_section_string(prev_section, "profile_id", &prev_profile_id); + uci_foreach_sections("cwmp_bulkdata", "profile_http_request_uri_parameter", s) { + dmuci_get_value_by_section_string(s, "profile_id", &profile_id); + if(strcmp(profile_id, prev_profile_id) != 0) + continue; + profile_http_request_uri_parameter = handle_update_instance(1, dmctx, &profile_http_request_uri_parameter_last, update_instance_alias, 3, s, "requesturiparameter_instance", "requesturiparameter_alias"); + if (DM_LINK_INST_OBJ(dmctx, parent_node, (void *)s, profile_http_request_uri_parameter) == DM_STOP) + break; + } + return 0; +} + +/************************************************************* + * ADD & DEL OBJ +/*************************************************************/ +int addObjBulkDataProfile(char *refparam, struct dmctx *ctx, void *data, char **instance) +{ + struct uci_section *profile; + char *value, *last_inst; + + last_inst = get_last_instance("cwmp_bulkdata", "profile", "profile_instance"); + dmuci_add_section_and_rename("cwmp_bulkdata", "profile", &profile, &value); + dmasprintf(instance, "%d", last_inst ? atoi(last_inst)+1 : 1); + dmuci_set_value_by_section(profile, "profile_instance", *instance); + dmuci_set_value_by_section(profile, "profile_id", *instance); + dmuci_set_value_by_section(profile, "enable", "0"); + dmuci_set_value_by_section(profile, "nbre_of_retained_failed_reports", "0"); + dmuci_set_value_by_section(profile, "protocol", "http"); + dmuci_set_value_by_section(profile, "reporting_interval", "86400"); + dmuci_set_value_by_section(profile, "time_reference", "0"); + dmuci_set_value_by_section(profile, "csv_encoding_field_separator", ","); + dmuci_set_value_by_section(profile, "csv_encoding_row_separator", " "); + dmuci_set_value_by_section(profile, "csv_encoding_escape_character", """); + dmuci_set_value_by_section(profile, "csv_encoding_report_format", "­column"); + dmuci_set_value_by_section(profile, "csv_encoding_row_time_stamp", "unix"); + dmuci_set_value_by_section(profile, "json_encoding_report_format", "objecthierarchy"); + dmuci_set_value_by_section(profile, "json_encoding_report_time_stamp", "unix"); + dmuci_set_value_by_section(profile, "http_compression", "none"); + dmuci_set_value_by_section(profile, "http_method", "post"); + dmuci_set_value_by_section(profile, "http_use_date_header", "1"); + dmuci_set_value_by_section(profile, "http_retry_enable", "0"); + dmuci_set_value_by_section(profile, "http_retry_minimum_wait_interval", "5"); + dmuci_set_value_by_section(profile, "http_persist_across_reboot", "0"); + return 0; +} + +int delObjBulkDataProfile(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) +{ + int found = 0; + struct uci_section *s, *ss = NULL, *profile_section = (struct uci_section *)data; + char *prev_profile_id; + + switch (del_action) { + case DEL_INST: + dmuci_get_value_by_section_string(profile_section, "profile_id", &prev_profile_id); + uci_foreach_option_eq("cwmp_bulkdata", "profile_parameter", "profile_id", prev_profile_id, s) { + dmuci_delete_by_section(s, NULL, NULL); + break; + } + uci_foreach_option_eq("cwmp_bulkdata", "profile_http_request_uri_parameter", "profile_id", prev_profile_id, s) { + dmuci_delete_by_section(s, NULL, NULL); + break; + } + dmuci_delete_by_section(profile_section, NULL, NULL); + return 0; + case DEL_ALL: + uci_foreach_sections("cwmp_bulkdata", "profile_parameter", s) { + if (found != 0) + dmuci_delete_by_section(ss, NULL, NULL); + ss = s; + found++; + } + if (ss != NULL) + dmuci_delete_by_section(ss, NULL, NULL); + + found = 0; + uci_foreach_sections("cwmp_bulkdata", "profile_http_request_uri_parameter", s) { + if (found != 0) + dmuci_delete_by_section(ss, NULL, NULL); + ss = s; + found++; + } + if (ss != NULL) + dmuci_delete_by_section(ss, NULL, NULL); + + found = 0; + uci_foreach_sections("cwmp_bulkdata", "profile", s) { + if (found != 0) + dmuci_delete_by_section(ss, NULL, NULL); + ss = s; + found++; + } + if (ss != NULL) + dmuci_delete_by_section(ss, NULL, NULL); + + return 0; + } + return 0; +} + +int addObjBulkDataProfileParameter(char *refparam, struct dmctx *ctx, void *data, char **instance) +{ + struct uci_section *profile_parameter, *profile_section = (struct uci_section *)data; + char *value, *last_inst, *prev_profile_id; + + dmuci_get_value_by_section_string(profile_section, "profile_id", &prev_profile_id); + last_inst = get_last_instance_lev2("cwmp_bulkdata", "profile_parameter", "parameter_instance", "profile_id", prev_profile_id); + dmuci_add_section_and_rename("cwmp_bulkdata", "profile_parameter", &profile_parameter, &value); + dmasprintf(instance, "%d", last_inst ? atoi(last_inst)+1 : 1); + dmuci_set_value_by_section(profile_parameter, "parameter_instance", *instance); + dmuci_set_value_by_section(profile_parameter, "profile_id", prev_profile_id); + return 0; +} + +int delObjBulkDataProfileParameter(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) +{ + int found = 0; + struct uci_section *s, *ss = NULL, *profile_section = (struct uci_section *)data;; + char *prev_profile_id; + + switch (del_action) { + case DEL_INST: + dmuci_delete_by_section(profile_section, NULL, NULL); + return 0; + case DEL_ALL: + dmuci_get_value_by_section_string(profile_section, "profile_id", &prev_profile_id); + uci_foreach_option_eq("cwmp_bulkdata", "profile_parameter", "profile_id", prev_profile_id, s) { + if (found != 0) + dmuci_delete_by_section(ss, NULL, NULL); + ss = s; + found++; + } + if (ss != NULL) + dmuci_delete_by_section(ss, NULL, NULL); + return 0; + } + return 0; +} + +int addObjBulkDataProfileHTTPRequestURIParameter(char *refparam, struct dmctx *ctx, void *data, char **instance) +{ + struct uci_section *profile_http_request_uri_parameter, *profile_section = (struct uci_section *)data; + char *value, *last_inst, *prev_profile_id; + + dmuci_get_value_by_section_string(profile_section, "profile_id", &prev_profile_id); + last_inst = get_last_instance_lev2("cwmp_bulkdata", "profile_http_request_uri_parameter", "requesturiparameter_instance", "profile_id", prev_profile_id); + dmuci_add_section_and_rename("cwmp_bulkdata", "profile_http_request_uri_parameter", &profile_http_request_uri_parameter, &value); + dmasprintf(instance, "%d", last_inst ? atoi(last_inst)+1 : 1); + dmuci_set_value_by_section(profile_http_request_uri_parameter, "requesturiparameter_instance", *instance); + dmuci_set_value_by_section(profile_http_request_uri_parameter, "profile_id", prev_profile_id); + return 0; +} + +int delObjBulkDataProfileHTTPRequestURIParameter(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action) +{ + int found = 0; + struct uci_section *s, *ss = NULL, *profile_section = (struct uci_section *)data;; + char *prev_profile_id; + + switch (del_action) { + case DEL_INST: + dmuci_delete_by_section(profile_section, NULL, NULL); + return 0; + case DEL_ALL: + dmuci_get_value_by_section_string(profile_section, "profile_id", &prev_profile_id); + uci_foreach_option_eq("cwmp_bulkdata", "profile_http_request_uri_parameter", "profile_id", prev_profile_id, s) { + if (found != 0) + dmuci_delete_by_section(ss, NULL, NULL); + ss = s; + found++; + } + if (ss != NULL) + dmuci_delete_by_section(ss, NULL, NULL); + return 0; + } + return 0; +} + +/************************************************************* + * GET & SET PARAM +/*************************************************************/ +/*#Device.BulkData.Enable!UCI:cwmp_bulkdata/bulkdata,bulkdata/enable*/ +int get_BulkData_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_option_value_string("cwmp_bulkdata", "bulkdata", "enable", value); + return 0; +} + +int set_BulkData_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + bool b; + switch (action) { + case VALUECHECK: + if (string_to_bool(value, &b)) + return FAULT_9007; + break; + case VALUESET: + string_to_bool(value, &b); + dmuci_set_value("cwmp_bulkdata", "bulkdata", "enable", b ? "1" : "0"); + break; + } + return 0; +} + +/*#Device.BulkData.Status!UCI:cwmp_bulkdata/bulkdata,bulkdata/enable*/ +int get_BulkData_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_option_value_string("cwmp_bulkdata", "bulkdata", "enable", value); + if (strcmp(*value, "1") == 0) + *value = "Enabled"; + else + *value = "Disabled"; + return 0; +} + +int get_BulkData_MinReportingInterval(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = "0"; + return 0; +} + +int get_BulkData_Protocols(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = "HTTP"; + return 0; +} + +int get_BulkData_EncodingTypes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = "JSON,CSV"; + return 0; +} + +int get_BulkData_ParameterWildCardSupported(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = "1"; + return 0; +} + +int get_BulkData_MaxNumberOfProfiles(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = "-1"; + return 0; +} + +int get_BulkData_MaxNumberOfParameterReferences(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = "-1"; + return 0; +} + +/*#Device.BulkData.ProfileNumberOfEntries!UCI:cwmp_bulkdata/profile/*/ +int get_BulkData_ProfileNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + struct uci_section *s = NULL; + int cnt = 0; + + uci_foreach_sections("cwmp_bulkdata", "profile", s) { + cnt++; + } + dmasprintf(value, "%d", cnt); + return 0; +} + +/*#Device.BulkData.Profile.{i}.Enable!UCI:cwmp_bulkdata/profile,@i-1/enable*/ +int get_BulkDataProfile_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "enable", value); + return 0; +} + +int set_BulkDataProfile_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + bool b; + switch (action) { + case VALUECHECK: + if (string_to_bool(value, &b)) + return FAULT_9007; + break; + case VALUESET: + string_to_bool(value, &b); + dmuci_set_value_by_section((struct uci_section *)data, "enable", b ? "1" : "0"); + break; + } + return 0; +} + +/*#Device.BulkData.Profile.{i}.Alias!UCI:cwmp_bulkdata/profile,@i-1/profile_alias*/ +int get_BulkDataProfile_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "profile_alias", value); + return 0; +} + +int set_BulkDataProfile_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "profile_alias", value); + break; + } + return 0; +} + +/*#Device.BulkData.Profile.{i}.Name!UCI:cwmp_bulkdata/profile,@i-1/name*/ +int get_BulkDataProfile_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "name", value); + return 0; +} + +int set_BulkDataProfile_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "name", value); + break; + } + return 0; +} + +/*#Device.BulkData.Profile.{i}.NumberOfRetainedFailedReports!UCI:cwmp_bulkdata/profile,@i-1/nbre_of_retained_failed_reports*/ +int get_BulkDataProfile_NumberOfRetainedFailedReports(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "nbre_of_retained_failed_reports", value); + return 0; +} + +int set_BulkDataProfile_NumberOfRetainedFailedReports(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "nbre_of_retained_failed_reports", value); + break; + } + return 0; +} + +/*#Device.BulkData.Profile.{i}.Protocol!UCI:cwmp_bulkdata/profile,@i-1/protocol*/ +int get_BulkDataProfile_Protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "protocol", value); + if(strcmp(*value, "http") == 0) + *value = "HTTP"; + return 0; +} + +int set_BulkDataProfile_Protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + break; + case VALUESET: + if(strcmp(value, "HTTP") == 0) + dmuci_set_value_by_section((struct uci_section *)data, "protocol", "http"); + break; + } + return 0; +} + +/*#Device.BulkData.Profile.{i}.EncodingType!UCI:cwmp_bulkdata/profile,@i-1/encoding_type*/ +int get_BulkDataProfile_EncodingType(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "encoding_type", value); + if(strcmp(*value, "json") == 0) + *value = "JSON"; + else if(strcmp(*value, "csv") == 0) + *value = "CSV"; + return 0; +} + +int set_BulkDataProfile_EncodingType(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + break; + case VALUESET: + if(strcmp(value, "JSON") == 0) + dmuci_set_value_by_section((struct uci_section *)data, "encoding_type", "json"); + else if(strcmp(value, "CSV") == 0) + dmuci_set_value_by_section((struct uci_section *)data, "encoding_type", "csv"); + break; + } + return 0; +} + +/*#Device.BulkData.Profile.{i}.ReportingInterval!UCI:cwmp_bulkdata/profile,@i-1/reporting_interval*/ +int get_BulkDataProfile_ReportingInterval(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "reporting_interval", value); + return 0; +} + +int set_BulkDataProfile_ReportingInterval(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "reporting_interval", value); + break; + } + return 0; +} + +/*#Device.BulkData.Profile.{i}.TimeReference!UCI:cwmp_bulkdata/profile,@i-1/time_reference*/ +int get_BulkDataProfile_TimeReference(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + time_t time_value; + + dmuci_get_value_by_section_string((struct uci_section *)data, "time_reference", value); + if ((*value)[0] != '0' && (*value)[0] != '\0') { + time_value = atoi(*value); + char s_now[sizeof "AAAA-MM-JJTHH:MM:SSZ"]; + strftime(s_now, sizeof s_now, "%Y-%m-%dT%H:%M:%SZ", localtime(&time_value)); + *value = dmstrdup(s_now); + } else { + *value = "0001-01-01T00:00:00Z"; + } + return 0; +} + +int set_BulkDataProfile_TimeReference(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + struct tm tm; + char buf[16]; + switch (action) { + case VALUECHECK: + break; + case VALUESET: + if (!(strptime(value, "%Y-%m-%dT%H:%M:%S", &tm))) + break; + sprintf(buf, "%ld", mktime(&tm)); + dmuci_set_value_by_section((struct uci_section *)data, "time_reference", buf); + break; + } + return 0; +} + +int get_BulkDataProfile_StreamingHost(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + //TODO + return 0; +} + +int set_BulkDataProfile_StreamingHost(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + break; + case VALUESET: + //TODO + break; + } + return 0; +} + +int get_BulkDataProfile_StreamingPort(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + //TODO + return 0; +} + +int set_BulkDataProfile_StreamingPort(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + break; + case VALUESET: + //TODO + break; + } + return 0; +} + +int get_BulkDataProfile_StreamingSessionID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + //TODO + return 0; +} + +int set_BulkDataProfile_StreamingSessionID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + break; + case VALUESET: + //TODO + break; + } + return 0; +} + +int get_BulkDataProfile_FileTransferURL(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + //TODO + return 0; +} + +int set_BulkDataProfile_FileTransferURL(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + break; + case VALUESET: + //TODO + break; + } + return 0; +} + +int get_BulkDataProfile_FileTransferUsername(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + //TODO + return 0; +} + +int set_BulkDataProfile_FileTransferUsername(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + break; + case VALUESET: + //TODO + break; + } + return 0; +} + +int get_BulkDataProfile_FileTransferPassword(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + //TODO + return 0; +} + +int set_BulkDataProfile_FileTransferPassword(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + break; + case VALUESET: + //TODO + break; + } + return 0; +} + +int get_BulkDataProfile_ControlFileFormat(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + //TODO + return 0; +} + +int set_BulkDataProfile_ControlFileFormat(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + break; + case VALUESET: + //TODO + break; + } + return 0; +} + +/*#Device.BulkData.Profile.{i}.ParameterNumberOfEntries!UCI:cwmp_bulkdata/profile_parameter,false/false*/ +int get_BulkDataProfile_ParameterNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + char *profile_id, *curr_profile_id; + struct uci_section *s = NULL; + int cnt = 0; + + dmuci_get_value_by_section_string((struct uci_section *)data, "profile_id", &curr_profile_id); + uci_foreach_sections("cwmp_bulkdata", "profile_parameter", s) { + dmuci_get_value_by_section_string(s, "profile_id", &profile_id); + if(strcmp(curr_profile_id, profile_id) != 0) + continue; + cnt++; + } + dmasprintf(value, "%d", cnt); + return 0; +} + +int get_BulkDataProfile_Controller(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + //TODO + return 0; +} + +/*#Device.BulkData.Profile.{i}.Parameter.{i}.Name!UCI:cwmp_bulkdata/profile_parameter,@i-1/name*/ +int get_BulkDataProfileParameter_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "name", value); + return 0; +} + +int set_BulkDataProfileParameter_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "name", value); + break; + } + return 0; +} + +/*#Device.BulkData.Profile.{i}.Parameter.{i}.Reference!UCI:cwmp_bulkdata/profile_parameter,@i-1/reference*/ +int get_BulkDataProfileParameter_Reference(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "reference", value); + return 0; +} + +int set_BulkDataProfileParameter_Reference(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "reference", value); + break; + } + return 0; +} + +/*#Device.BulkData.Profile.{i}.CSVEncoding.FieldSeparator!UCI:cwmp_bulkdata/profile,@i-1/csv_encoding_field_separator*/ +int get_BulkDataProfileCSVEncoding_FieldSeparator(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "csv_encoding_field_separator", value); + return 0; +} + +int set_BulkDataProfileCSVEncoding_FieldSeparator(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "csv_encoding_field_separator", value); + break; + } + return 0; +} + +/*#Device.BulkData.Profile.{i}.CSVEncoding.RowSeparator!UCI:cwmp_bulkdata/profile,@i-1/csv_encoding_row_separator*/ +int get_BulkDataProfileCSVEncoding_RowSeparator(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "csv_encoding_row_separator", value); + return 0; +} + +int set_BulkDataProfileCSVEncoding_RowSeparator(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + break; + case VALUESET: + if((strcmp(value, " ") == 0) || (strcmp(value, " ") == 0)) + dmuci_set_value_by_section((struct uci_section *)data, "csv_encoding_row_separator", value); + break; + } + return 0; +} + +/*#Device.BulkData.Profile.{i}.CSVEncoding.EscapeCharacter!UCI:cwmp_bulkdata/profile,@i-1/csv_encoding_escape_character*/ +int get_BulkDataProfileCSVEncoding_EscapeCharacter(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "csv_encoding_escape_character", value); + return 0; +} + +int set_BulkDataProfileCSVEncoding_EscapeCharacter(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + break; + case VALUESET: + if(strcmp(value, """) == 0) + dmuci_set_value_by_section((struct uci_section *)data, "csv_encoding_escape_character", value); + break; + } + return 0; +} + +/*#Device.BulkData.Profile.{i}.CSVEncoding.ReportFormat!UCI:cwmp_bulkdata/profile,@i-1/csv_encoding_report_format*/ +int get_BulkDataProfileCSVEncoding_ReportFormat(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "csv_encoding_report_format", value); + if(strcmp(*value, "row") == 0) + *value = "ParameterPerRow"; + else if(strcmp(*value, "column") == 0) + *value = "ParameterPerColumn"; + return 0; +} + +int set_BulkDataProfileCSVEncoding_ReportFormat(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + break; + case VALUESET: + if(strcmp(value, "ParameterPerRow") == 0) + dmuci_set_value_by_section((struct uci_section *)data, "csv_encoding_report_format", "row"); + else if(strcmp(value, "ParameterPerColumn") == 0) + dmuci_set_value_by_section((struct uci_section *)data, "csv_encoding_report_format", "column"); + break; + } + return 0; +} + +/*#Device.BulkData.Profile.{i}.CSVEncoding.RowTimestamp!UCI:cwmp_bulkdata/profile,@i-1/csv_encoding_row_time_stamp*/ +int get_BulkDataProfileCSVEncoding_RowTimestamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "csv_encoding_row_time_stamp", value); + if(strcmp(*value, "unix") == 0) + *value = "Unix-Epoch"; + else if(strcmp(*value, "iso8601") == 0) + *value = "ISO-8601"; + else if(strcmp(*value, "none") == 0) + *value = "None"; + return 0; +} + +int set_BulkDataProfileCSVEncoding_RowTimestamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + break; + case VALUESET: + if(strcmp(value, "Unix-Epoch") == 0) + dmuci_set_value_by_section((struct uci_section *)data, "csv_encoding_row_time_stamp", "unix"); + else if(strcmp(value, "ISO-8601") == 0) + dmuci_set_value_by_section((struct uci_section *)data, "csv_encoding_row_time_stamp", "iso8601"); + else if(strcmp(value, "None") == 0) + dmuci_set_value_by_section((struct uci_section *)data, "csv_encoding_row_time_stamp", "none"); + break; + } + return 0; +} + +/*#Device.BulkData.Profile.{i}.JSONEncoding.ReportFormat!UCI:cwmp_bulkdata/profile,@i-1/json_encoding_report_format*/ +int get_BulkDataProfileJSONEncoding_ReportFormat(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "json_encoding_report_format", value); + if(strcmp(*value, "objecthierarchy") == 0) + *value = "ObjectHierarchy"; + else if(strcmp(*value, "namevaluepair") == 0) + *value = "NameValuePair"; + return 0; +} + +int set_BulkDataProfileJSONEncoding_ReportFormat(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + break; + case VALUESET: + if(strcmp(value, "ObjectHierarchy") == 0) + dmuci_set_value_by_section((struct uci_section *)data, "json_encoding_report_format", "objecthierarchy"); + else if(strcmp(value, "NameValuePair") == 0) + dmuci_set_value_by_section((struct uci_section *)data, "json_encoding_report_format", "namevaluepair"); + break; + } + return 0; +} + +/*#Device.BulkData.Profile.{i}.JSONEncoding.ReportTimestamp!UCI:cwmp_bulkdata/profile,@i-1/json_encoding_report_time_stamp*/ +int get_BulkDataProfileJSONEncoding_ReportTimestamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "json_encoding_report_time_stamp", value); + if(strcmp(*value, "unix") == 0) + *value = "Unix-Epoch"; + else if(strcmp(*value, "iso8601") == 0) + *value = "ISO-8601"; + else if(strcmp(*value, "none") == 0) + *value = "None"; + return 0; +} + +int set_BulkDataProfileJSONEncoding_ReportTimestamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + break; + case VALUESET: + if(strcmp(value, "Unix-Epoch") == 0) + dmuci_set_value_by_section((struct uci_section *)data, "json_encoding_report_time_stamp", "unix"); + else if(strcmp(value, "ISO-8601") == 0) + dmuci_set_value_by_section((struct uci_section *)data, "json_encoding_report_time_stamp", "iso8601"); + else if(strcmp(value, "None") == 0) + dmuci_set_value_by_section((struct uci_section *)data, "json_encoding_report_time_stamp", "none"); + break; + } + return 0; +} + +/*#Device.BulkData.Profile.{i}.HTTP.URL!UCI:cwmp_bulkdata/profile,@i-1/http_url*/ +int get_BulkDataProfileHTTP_URL(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "http_url", value); + return 0; +} + +int set_BulkDataProfileHTTP_URL(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "http_url", value); + break; + } + return 0; +} + +/*#Device.BulkData.Profile.{i}.HTTP.Username!UCI:cwmp_bulkdata/profile,@i-1/http_username*/ +int get_BulkDataProfileHTTP_Username(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "http_username", value); + return 0; +} + +int set_BulkDataProfileHTTP_Username(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "http_username", value); + break; + } + return 0; +} + +/*#Device.BulkData.Profile.{i}.HTTP.Password!UCI:cwmp_bulkdata/profile,@i-1/http_password*/ +int get_BulkDataProfileHTTP_Password(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = ""; + return 0; +} + +int set_BulkDataProfileHTTP_Password(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "http_password", value); + break; + } + return 0; +} + +int get_BulkDataProfileHTTP_CompressionsSupported(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = "GZIP,Compress,Deflate"; + return 0; +} + +/*#Device.BulkData.Profile.{i}.HTTP.Compression!UCI:cwmp_bulkdata/profile,@i-1/http_compression*/ +int get_BulkDataProfileHTTP_Compression(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "http_compression", value); + if(strcmp(*value, "gzip") == 0) + *value = "GZIP"; + else if(strcmp(*value, "compress") == 0) + *value = "Compress"; + else if(strcmp(*value, "deflate") == 0) + *value = "Deflate"; + return 0; +} + +int set_BulkDataProfileHTTP_Compression(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + break; + case VALUESET: + if(strcmp(value, "GZIP") == 0) + dmuci_set_value_by_section((struct uci_section *)data, "http_compression", "gzip"); + else if(strcmp(value, "Compress") == 0) + dmuci_set_value_by_section((struct uci_section *)data, "http_compression", "compress"); + else if(strcmp(value, "Deflate") == 0) + dmuci_set_value_by_section((struct uci_section *)data, "http_compression", "deflate"); + break; + } + return 0; +} + +int get_BulkDataProfileHTTP_MethodsSupported(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + *value = "POST,PUT"; + return 0; +} + +/*#Device.BulkData.Profile.{i}.HTTP.Method!UCI:cwmp_bulkdata/profile,@i-1/http_method*/ +int get_BulkDataProfileHTTP_Method(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "http_method", value); + if(strcmp(*value, "post") == 0) + *value = "POST"; + else if(strcmp(*value, "put") == 0) + *value = "PUT"; + return 0; +} + +int set_BulkDataProfileHTTP_Method(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + break; + case VALUESET: + if(strcmp(value, "POST") == 0) + dmuci_set_value_by_section((struct uci_section *)data, "http_method", "post"); + else if(strcmp(value, "PUT") == 0) + dmuci_set_value_by_section((struct uci_section *)data, "http_method", "put"); + break; + } + return 0; +} + +/*#Device.BulkData.Profile.{i}.HTTP.UseDateHeader!UCI:cwmp_bulkdata/profile,@i-1/http_use_date_header*/ +int get_BulkDataProfileHTTP_UseDateHeader(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "http_use_date_header", value); + return 0; +} + +int set_BulkDataProfileHTTP_UseDateHeader(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + bool b; + switch (action) { + case VALUECHECK: + if (string_to_bool(value, &b)) + return FAULT_9007; + break; + case VALUESET: + string_to_bool(value, &b); + dmuci_set_value_by_section((struct uci_section *)data, "http_use_date_header", b ? "1" : "0"); + break; + } + return 0; +} + +/*#Device.BulkData.Profile.{i}.HTTP.RetryEnable!UCI:cwmp_bulkdata/profile,@i-1/http_retry_enable*/ +int get_BulkDataProfileHTTP_RetryEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "http_retry_enable", value); + return 0; +} + +int set_BulkDataProfileHTTP_RetryEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + bool b; + switch (action) { + case VALUECHECK: + if (string_to_bool(value, &b)) + return FAULT_9007; + break; + case VALUESET: + string_to_bool(value, &b); + dmuci_set_value_by_section((struct uci_section *)data, "http_retry_enable", b ? "1" : "0"); + break; + } + return 0; +} + +/*#Device.BulkData.Profile.{i}.HTTP.RetryMinimumWaitInterval!UCI:cwmp_bulkdata/profile,@i-1/http_retry_minimum_wait_interval*/ +int get_BulkDataProfileHTTP_RetryMinimumWaitInterval(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "http_retry_minimum_wait_interval", value); + return 0; +} + +int set_BulkDataProfileHTTP_RetryMinimumWaitInterval(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "http_retry_minimum_wait_interval", value); + break; + } + return 0; +} + +/*#Device.BulkData.Profile.{i}.HTTP.RetryIntervalMultiplier!UCI:cwmp_bulkdata/profile,@i-1/http_retry_interval_multiplier*/ +int get_BulkDataProfileHTTP_RetryIntervalMultiplier(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "http_retry_interval_multiplier", value); + return 0; +} + +int set_BulkDataProfileHTTP_RetryIntervalMultiplier(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "http_retry_interval_multiplier", value); + break; + } + return 0; +} + +/*#Device.BulkData.Profile.{i}.HTTP.RequestURIParameterNumberOfEntries!UCI:cwmp_bulkdata/profile_http_request_uri_parameter,false/false*/ +int get_BulkDataProfileHTTP_RequestURIParameterNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + char *profile_id, *curr_profile_id; + struct uci_section *s = NULL; + int cnt = 0; + + dmuci_get_value_by_section_string((struct uci_section *)data, "profile_id", &curr_profile_id); + uci_foreach_sections("cwmp_bulkdata", "profile_http_request_uri_parameter", s) { + dmuci_get_value_by_section_string(s, "profile_id", &profile_id); + if(strcmp(curr_profile_id, profile_id) != 0) + continue; + cnt++; + } + dmasprintf(value, "%d", cnt); + return 0; +} + +/*#Device.BulkData.Profile.{i}.HTTP.PersistAcrossReboot!UCI:cwmp_bulkdata/profile,@i-1/http_persist_across_reboot*/ +int get_BulkDataProfileHTTP_PersistAcrossReboot(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "http_persist_across_reboot", value); + return 0; +} + +int set_BulkDataProfileHTTP_PersistAcrossReboot(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + bool b; + switch (action) { + case VALUECHECK: + if (string_to_bool(value, &b)) + return FAULT_9007; + break; + case VALUESET: + string_to_bool(value, &b); + dmuci_set_value_by_section((struct uci_section *)data, "http_persist_across_reboot", b ? "1" : "0"); + break; + } + return 0; +} + +/*#Device.BulkData.Profile.{i}.HTTP.RequestURIParameter.{i}.Name!UCI:cwmp_bulkdata/profile_http_request_uri_parameter,@i-1/name*/ +int get_BulkDataProfileHTTPRequestURIParameter_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "name", value); + return 0; +} + +int set_BulkDataProfileHTTPRequestURIParameter_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "name", value); + break; + } + return 0; +} + +/*#Device.BulkData.Profile.{i}.HTTP.RequestURIParameter.{i}.Reference!UCI:cwmp_bulkdata/profile_http_request_uri_parameter,@i-1/reference*/ +int get_BulkDataProfileHTTPRequestURIParameter_Reference(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value) +{ + dmuci_get_value_by_section_string((struct uci_section *)data, "reference", value); + return 0; +} + +int set_BulkDataProfileHTTPRequestURIParameter_Reference(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action) +{ + switch (action) { + case VALUECHECK: + break; + case VALUESET: + dmuci_set_value_by_section((struct uci_section *)data, "reference", value); + break; + } + return 0; +} + diff --git a/dmtree/tr157/bulkdata.h b/dmtree/tr157/bulkdata.h new file mode 100644 index 00000000..bdbeb210 --- /dev/null +++ b/dmtree/tr157/bulkdata.h @@ -0,0 +1,125 @@ +/* +* This program is free software: you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation, either version 2 of the License, or +* (at your option) any later version. +* +* Copyright (C) 2019 iopsys Software Solutions AB +* Author: Amin Ben Ramdhane +*/ + +#ifndef __BULKDATA_H +#define __BULKDATA_H + +extern DMOBJ tBulkDataObj[]; +extern DMLEAF tBulkDataParams[]; +extern DMOBJ tBulkDataProfileObj[]; +extern DMLEAF tBulkDataProfileParams[]; +extern DMLEAF tBulkDataProfileParameterParams[]; +extern DMLEAF tBulkDataProfileCSVEncodingParams[]; +extern DMLEAF tBulkDataProfileJSONEncodingParams[]; +extern DMOBJ tBulkDataProfileHTTPObj[]; +extern DMLEAF tBulkDataProfileHTTPParams[]; +extern DMLEAF tBulkDataProfileHTTPRequestURIParameterParams[]; + +int browseBulkDataProfileInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance); +int browseBulkDataProfileParameterInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance); +int browseBulkDataProfileHTTPRequestURIParameterInst(struct dmctx *dmctx, DMNODE *parent_node, void *prev_data, char *prev_instance); + +int addObjBulkDataProfile(char *refparam, struct dmctx *ctx, void *data, char **instance); +int delObjBulkDataProfile(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action); +int addObjBulkDataProfileParameter(char *refparam, struct dmctx *ctx, void *data, char **instance); +int delObjBulkDataProfileParameter(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action); +int addObjBulkDataProfileHTTPRequestURIParameter(char *refparam, struct dmctx *ctx, void *data, char **instance); +int delObjBulkDataProfileHTTPRequestURIParameter(char *refparam, struct dmctx *ctx, void *data, char *instance, unsigned char del_action); + +int get_BulkData_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkData_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkData_Status(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int get_BulkData_MinReportingInterval(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int get_BulkData_Protocols(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int get_BulkData_EncodingTypes(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int get_BulkData_ParameterWildCardSupported(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int get_BulkData_MaxNumberOfProfiles(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int get_BulkData_MaxNumberOfParameterReferences(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int get_BulkData_ProfileNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int get_BulkDataProfile_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfile_Enable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfile_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfile_Alias(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfile_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfile_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfile_NumberOfRetainedFailedReports(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfile_NumberOfRetainedFailedReports(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfile_Protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfile_Protocol(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfile_EncodingType(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfile_EncodingType(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfile_ReportingInterval(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfile_ReportingInterval(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfile_TimeReference(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfile_TimeReference(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfile_StreamingHost(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfile_StreamingHost(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfile_StreamingPort(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfile_StreamingPort(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfile_StreamingSessionID(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfile_StreamingSessionID(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfile_FileTransferURL(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfile_FileTransferURL(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfile_FileTransferUsername(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfile_FileTransferUsername(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfile_FileTransferPassword(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfile_FileTransferPassword(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfile_ControlFileFormat(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfile_ControlFileFormat(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfile_ParameterNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int get_BulkDataProfile_Controller(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int get_BulkDataProfileParameter_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfileParameter_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfileParameter_Reference(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfileParameter_Reference(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfileCSVEncoding_FieldSeparator(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfileCSVEncoding_FieldSeparator(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfileCSVEncoding_RowSeparator(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfileCSVEncoding_RowSeparator(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfileCSVEncoding_EscapeCharacter(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfileCSVEncoding_EscapeCharacter(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfileCSVEncoding_ReportFormat(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfileCSVEncoding_ReportFormat(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfileCSVEncoding_RowTimestamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfileCSVEncoding_RowTimestamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfileJSONEncoding_ReportFormat(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfileJSONEncoding_ReportFormat(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfileJSONEncoding_ReportTimestamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfileJSONEncoding_ReportTimestamp(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfileHTTP_URL(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfileHTTP_URL(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfileHTTP_Username(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfileHTTP_Username(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfileHTTP_Password(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfileHTTP_Password(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfileHTTP_CompressionsSupported(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int get_BulkDataProfileHTTP_Compression(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfileHTTP_Compression(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfileHTTP_MethodsSupported(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int get_BulkDataProfileHTTP_Method(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfileHTTP_Method(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfileHTTP_UseDateHeader(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfileHTTP_UseDateHeader(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfileHTTP_RetryEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfileHTTP_RetryEnable(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfileHTTP_RetryMinimumWaitInterval(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfileHTTP_RetryMinimumWaitInterval(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfileHTTP_RetryIntervalMultiplier(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfileHTTP_RetryIntervalMultiplier(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfileHTTP_RequestURIParameterNumberOfEntries(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int get_BulkDataProfileHTTP_PersistAcrossReboot(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfileHTTP_PersistAcrossReboot(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfileHTTPRequestURIParameter_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfileHTTPRequestURIParameter_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); +int get_BulkDataProfileHTTPRequestURIParameter_Reference(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value); +int set_BulkDataProfileHTTPRequestURIParameter_Reference(char *refparam, struct dmctx *ctx, void *data, char *instance, char *value, int action); + +#endif //__BULKDATA_H + diff --git a/dmtree/tr181/device.c b/dmtree/tr181/device.c index 4080d084..60c15297 100644 --- a/dmtree/tr181/device.c +++ b/dmtree/tr181/device.c @@ -53,6 +53,9 @@ #ifdef BBF_TR104 #include "voice_services.h" #endif +#ifdef BBF_TR157 +#include "bulkdata.h" +#endif /* *** BBFDM *** */ DMOBJ tEntry181Obj[] = { @@ -109,5 +112,8 @@ DMOBJ tRoot_181_Obj[] = { {"USB", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tUSBObj, tUSBParams, NULL, BBFDM_BOTH}, //{"QoS", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tQoSObj, tQoSParams, NULL, BBFDM_BOTH}, {"XMPP", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL,tXMPPObj, tXMPPParams, NULL, BBFDM_BOTH}, +#ifdef BBF_TR157 +{"BulkData", &DMREAD, NULL, NULL, NULL, NULL, NULL, NULL, tBulkDataObj, tBulkDataParams, NULL, BBFDM_BOTH}, +#endif {0} }; diff --git a/json/tr181.json b/json/tr181.json index 82267371..c7b19f24 100644 --- a/json/tr181.json +++ b/json/tr181.json @@ -46755,7 +46755,22 @@ "usp" ], "read": true, - "write": true + "write": true, + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "bulkdata", + "name": "bulkdata" + }, + "option": { + "name": "enable" + } + } + } + ] }, "Status": { "type": "string", @@ -46769,6 +46784,21 @@ "Enabled", "Disabled", "Error" + ], + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "bulkdata", + "name": "bulkdata" + }, + "option": { + "name": "enable" + } + } + } ] }, "MinReportingInterval": { @@ -46850,7 +46880,18 @@ "usp" ], "read": true, - "write": false + "write": false, + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile" + } + } + } + ] }, "Device.BulkData.Profile.{i}.": { "type": "object", @@ -46859,7 +46900,17 @@ "usp" ], "access": true, - "array": true, + "array": true, + "mapping": { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile" + }, + "dmmapfile": "dmmap_cwmp_profile" + } + }, "Enable": { "type": "boolean", "protocols": [ @@ -46867,7 +46918,22 @@ "usp" ], "read": true, - "write": true + "write": true, + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile", + "index": "@i-1" + }, + "option": { + "name": "enable" + } + } + } + ] }, "Alias": { "type": "string", @@ -46876,7 +46942,22 @@ "usp" ], "read": true, - "write": true + "write": true, + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile", + "index": "@i-1" + }, + "option": { + "name": "profile_alias" + } + } + } + ] }, "Name": { "type": "string", @@ -46885,7 +46966,22 @@ "usp" ], "read": true, - "write": true + "write": true, + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile", + "index": "@i-1" + }, + "option": { + "name": "name" + } + } + } + ] }, "NumberOfRetainedFailedReports": { "type": "int", @@ -46897,7 +46993,22 @@ "min": "-1" }, "read": true, - "write": true + "write": true, + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile", + "index": "@i-1" + }, + "option": { + "name": "nbre_of_retained_failed_reports" + } + } + } + ] }, "Protocol": { "type": "string", @@ -46906,7 +47017,22 @@ "usp" ], "read": true, - "write": true + "write": true, + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile", + "index": "@i-1" + }, + "option": { + "name": "protocol" + } + } + } + ] }, "EncodingType": { "type": "string", @@ -46915,7 +47041,22 @@ "usp" ], "read": true, - "write": true + "write": true, + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile", + "index": "@i-1" + }, + "option": { + "name": "encoding_type" + } + } + } + ] }, "ReportingInterval": { "type": "unsignedInt", @@ -46928,7 +47069,22 @@ }, "unit": "seconds", "read": true, - "write": true + "write": true, + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile", + "index": "@i-1" + }, + "option": { + "name": "reporting_interval" + } + } + } + ] }, "TimeReference": { "type": "dateTime", @@ -46937,7 +47093,22 @@ "usp" ], "read": true, - "write": true + "write": true, + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile", + "index": "@i-1" + }, + "option": { + "name": "time_reference" + } + } + } + ] }, "StreamingHost": { "type": "string", @@ -47017,7 +47188,18 @@ "usp" ], "read": true, - "write": false + "write": false, + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile_parameter" + } + } + } + ] }, "Controller": { "type": "string", @@ -47035,6 +47217,16 @@ ], "access": true, "array": true, + "mapping": { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile_parameter" + }, + "dmmapfile": "dmmap_cwmp_profile_parameter" + } + }, "Name": { "type": "string", "protocols": [ @@ -47042,7 +47234,22 @@ "usp" ], "read": true, - "write": true + "write": true, + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile_parameter", + "index": "@i-1" + }, + "option": { + "name": "name" + } + } + } + ] }, "Reference": { "type": "string", @@ -47051,7 +47258,22 @@ "usp" ], "read": true, - "write": true + "write": true, + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile_parameter", + "index": "@i-1" + }, + "option": { + "name": "reference" + } + } + } + ] } }, "Device.BulkData.Profile.{i}.CSVEncoding.": { @@ -47069,7 +47291,22 @@ "usp" ], "read": true, - "write": true + "write": true, + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile", + "index": "@i-1" + }, + "option": { + "name": "csv_encoding_field_separator" + } + } + } + ] }, "RowSeparator": { "type": "string", @@ -47078,7 +47315,22 @@ "usp" ], "read": true, - "write": true + "write": true, + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile", + "index": "@i-1" + }, + "option": { + "name": "csv_encoding_row_separator" + } + } + } + ] }, "EscapeCharacter": { "type": "string", @@ -47087,7 +47339,22 @@ "usp" ], "read": true, - "write": true + "write": true, + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile", + "index": "@i-1" + }, + "option": { + "name": "csv_encoding_escape_character" + } + } + } + ] }, "ReportFormat": { "type": "string", @@ -47100,6 +47367,21 @@ "values": [ "ParameterPerRow", "ParameterPerColumn" + ], + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile", + "index": "@i-1" + }, + "option": { + "name": "csv_encoding_report_format" + } + } + } ] }, "RowTimestamp": { @@ -47114,6 +47396,21 @@ "Unix-Epoch", "ISO-8601", "None" + ], + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile", + "index": "@i-1" + }, + "option": { + "name": "csv_encoding_row_time_stamp" + } + } + } ] } }, @@ -47136,6 +47433,21 @@ "values": [ "ObjectHierarchy", "NameValuePair" + ], + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile", + "index": "@i-1" + }, + "option": { + "name": "json_encoding_report_format" + } + } + } ] }, "ReportTimestamp": { @@ -47150,6 +47462,21 @@ "Unix-Epoch", "ISO-8601", "None" + ], + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile", + "index": "@i-1" + }, + "option": { + "name": "json_encoding_report_time_stamp" + } + } + } ] } }, @@ -47168,7 +47495,22 @@ "usp" ], "read": true, - "write": true + "write": true, + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile", + "index": "@i-1" + }, + "option": { + "name": "http_url" + } + } + } + ] }, "Username": { "type": "string", @@ -47177,7 +47519,22 @@ "usp" ], "read": true, - "write": true + "write": true, + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile", + "index": "@i-1" + }, + "option": { + "name": "http_username" + } + } + } + ] }, "Password": { "type": "string", @@ -47186,7 +47543,22 @@ "usp" ], "read": true, - "write": true + "write": true, + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile", + "index": "@i-1" + }, + "option": { + "name": "http_password" + } + } + } + ] }, "CompressionsSupported": { "type": "string", @@ -47209,7 +47581,22 @@ "usp" ], "read": true, - "write": true + "write": true, + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile", + "index": "@i-1" + }, + "option": { + "name": "http_compression" + } + } + } + ] }, "MethodsSupported": { "type": "string", @@ -47231,7 +47618,22 @@ "usp" ], "read": true, - "write": true + "write": true, + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile", + "index": "@i-1" + }, + "option": { + "name": "http_method" + } + } + } + ] }, "UseDateHeader": { "type": "boolean", @@ -47240,7 +47642,22 @@ "usp" ], "read": true, - "write": true + "write": true, + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile", + "index": "@i-1" + }, + "option": { + "name": "http_use_date_header" + } + } + } + ] }, "RetryEnable": { "type": "boolean", @@ -47249,7 +47666,22 @@ "usp" ], "read": true, - "write": true + "write": true, + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile", + "index": "@i-1" + }, + "option": { + "name": "http_retry_enable" + } + } + } + ] }, "RetryMinimumWaitInterval": { "type": "unsignedInt", @@ -47262,7 +47694,22 @@ "max": "65535" }, "read": true, - "write": true + "write": true, + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile", + "index": "@i-1" + }, + "option": { + "name": "http_retry_minimum_wait_interval" + } + } + } + ] }, "RetryIntervalMultiplier": { "type": "unsignedInt", @@ -47275,7 +47722,22 @@ "max": "65535" }, "read": true, - "write": true + "write": true, + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile", + "index": "@i-1" + }, + "option": { + "name": "http_retry_interval_multiplier" + } + } + } + ] }, "RequestURIParameterNumberOfEntries": { "type": "unsignedInt", @@ -47284,7 +47746,18 @@ "usp" ], "read": true, - "write": false + "write": false, + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile_http_request_uri_parameter" + } + } + } + ] }, "PersistAcrossReboot": { "type": "boolean", @@ -47293,7 +47766,22 @@ "usp" ], "read": true, - "write": true + "write": true, + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile", + "index": "@i-1" + }, + "option": { + "name": "http_persist_across_reboot" + } + } + } + ] }, "Device.BulkData.Profile.{i}.HTTP.RequestURIParameter.{i}.": { "type": "object", @@ -47303,6 +47791,16 @@ ], "access": true, "array": true, + "mapping": { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile_http_request_uri_parameter" + }, + "dmmapfile": "dmmap_cwmp_profile_http_request_uri_parameter" + } + }, "Name": { "type": "string", "protocols": [ @@ -47310,7 +47808,22 @@ "usp" ], "read": true, - "write": true + "write": true, + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile_http_request_uri_parameter", + "index": "@i-1" + }, + "option": { + "name": "name" + } + } + } + ] }, "Reference": { "type": "string", @@ -47319,7 +47832,22 @@ "usp" ], "read": true, - "write": true + "write": true, + "mapping": [ + { + "type": "uci", + "uci": { + "file": "cwmp_bulkdata", + "section": { + "type": "profile_http_request_uri_parameter", + "index": "@i-1" + }, + "option": { + "name": "reference" + } + } + } + ] } } }