Exclude '4 Value Change' event from InformParameters

This commit is contained in:
Suvendhu Hansa 2023-11-07 10:09:31 +00:00 committed by Vivek Kumar Dutta
parent 7852ca06ff
commit 6996b01bad
4 changed files with 55 additions and 10 deletions

View file

@ -81,8 +81,7 @@
#define foreach_elt_in_strlist(elt, str, delim) \
char *tmpchr; \
char buffer_str[strlen(str) + 1]; \
CWMP_STRNCPY(buffer_str, str, sizeof(buffer_str) - 1); \
buffer_str[sizeof(buffer_str) - 1] = '\0'; \
CWMP_STRNCPY(buffer_str, str, sizeof(buffer_str)); \
for (elt = strtok_r(buffer_str, delim, &tmpchr); elt != NULL; elt = strtok_r(NULL, delim, &tmpchr))
extern char *commandKey;

View file

@ -16,7 +16,7 @@
#define DU_STATE_CHANGE_SEC_NAME "du_state_change"
#define TRANSFER_COMPL_SEC_NAME "transfer_complete"
static char *CWMP_EVENTS[] = {"0 BOOTSTRAP", "1 BOOT", "2 PERIODIC", "3 SCHEDULED", "5 KICKED", "6 CONNECTION REQUEST", "7 TRANSFER COMPLETE", "8 DIAGNOSTICS COMPLETE", "9 REQUEST DOWNLOAD", "10 AUTONOMOUS TRANSFER COMPLETE", "11 DU STATE CHANGE COMPLETE", "M Reboot", "M ScheduleInform", "M Download", "M ScheduleDownload", "M Upload", "M ChangeDUState", "14 HEARTBEAT", NULL};
static char *CWMP_EVENTS[] = {"0 BOOTSTRAP", "1 BOOT", "2 PERIODIC", "3 SCHEDULED", "5 KICKED", "6 CONNECTION REQUEST", "7 TRANSFER COMPLETE", "8 DIAGNOSTICS COMPLETE", "9 REQUEST DOWNLOAD", "10 AUTONOMOUS TRANSFER COMPLETE", "11 DU STATE CHANGE COMPLETE", "12 AUTONOMOUS DU STATE CHANGE COMPLETE", "13 WAKEUP", "M Reboot", "M ScheduleInform", "M Download", "M ScheduleDownload", "M Upload", "M ChangeDUState", "14 HEARTBEAT", NULL};
static char *Forced_Inform_Parmeters[] = {"Device.RootDataModelVersion", "Device.DeviceInfo.HardwareVersion", "Device.DeviceInfo.SoftwareVersion", "Device.DeviceInfo.ProvisioningCode", "Device.ManagementServer.ParameterKey", "Device.ManagementServer.ConnectionRequestURL", "Device.ManagementServer.AliasBasedAddressing", NULL};
static char *DUStateOperationType[] = {"Install", "Update", "Uninstall", NULL};
static char *DUStateResultType[] = {"Success", "Failure", "Both", NULL};

View file

@ -397,24 +397,54 @@ int cwmp_get_int_event_code(const char *code)
else if (CWMP_STRNCMP(code, "4 ", 2) == 0)
return EVENT_IDX_4VALUE_CHANGE;
else if (CWMP_STRNCMP(code, "5 ", 2) == 0)
return EVENT_IDX_5KICKED;
else if (CWMP_STRNCMP(code, "6 ", 2) == 0)
return EVENT_IDX_6CONNECTION_REQUEST;
else if (CWMP_STRNCMP(code, "7 ", 2) == 0)
return EVENT_IDX_7TRANSFER_COMPLETE;
else if (CWMP_STRNCMP(code, "8 ", 2) == 0)
return EVENT_IDX_8DIAGNOSTICS_COMPLETE;
else if (CWMP_STRNCMP(code, "9 ", 2) == 0)
return EVENT_IDX_9REQUEST_DOWNLOAD;
else if (CWMP_STRNCMP(code, "10", 2) == 0)
return EVENT_IDX_10AUTONOMOUS_TRANSFER_COMPLETE;
else if (CWMP_STRNCMP(code, "11", 2) == 0)
return EVENT_IDX_11DU_STATE_CHANGE_COMPLETE;
else if (CWMP_STRNCMP(code, "12", 2) == 0)
return EVENT_IDX_12AUTONOMOUS_DU_STATE_CHANGE_COMPLETE;
else if (CWMP_STRNCMP(code, "13", 2) == 0)
return EVENT_IDX_13WAKEUP;
else if (CWMP_STRNCMP(code, "14", 2) == 0)
return EVENT_IDX_14HEARTBEAT;
else if (CWMP_STRCMP(code, "M Reboot") == 0)
return EVENT_IDX_M_Reboot;
else if (CWMP_STRCMP(code, "M ScheduleInform") == 0)
return EVENT_IDX_M_ScheduleInform;
else if (CWMP_STRCMP(code, "M Download") == 0)
return EVENT_IDX_M_Download;
else if (CWMP_STRCMP(code, "M ScheduleDownload") == 0)
return EVENT_IDX_M_Schedule_Download;
else if (CWMP_STRCMP(code, "M Upload") == 0)
return EVENT_IDX_M_Upload;
else if (CWMP_STRCMP(code, "M ChangeDUState") == 0)
return EVENT_IDX_M_ChangeDUState;
else
return EVENT_IDX_6CONNECTION_REQUEST;
}

View file

@ -229,8 +229,23 @@ bool event_in_session_event_list(char *event, struct list_head *list_evts)
bool check_inform_parameter_events_list_corresponding(char *events_str_list, struct list_head *list_evts)
{
char *evt = NULL;
if (CWMP_STRLEN(events_str_list) == 0)
return true;
if (CWMP_STRLEN(events_str_list) == 0) {
/* Need to check and if only '4 VALUE CHANGE' event in session event list,
* then this parameter should not be added in inform param */
bool add_param = false;
struct event_container *event_container = NULL;
list_for_each_entry(event_container, list_evts, list) {
if (event_container->code != EVENT_IDX_4VALUE_CHANGE) {
add_param = true;
break;
}
}
return add_param;
}
foreach_elt_in_strlist(evt, events_str_list, ",") {
if (event_in_session_event_list(evt, list_evts))
return true;
@ -350,10 +365,11 @@ static void load_inform_xml_schema(mxml_node_t **tree)
{
char *enable = NULL;
cwmp_uci_get_value_by_section_string(s, "enable", &enable);
if (strcasecmp(enable, "0") == 0 || strcasecmp(enable , "false") == 0)
continue;
char *parameter_name = NULL;
if (uci_str_to_bool(enable) == false)
continue;
char *parameter_name = NULL;
cwmp_uci_get_value_by_section_string(s, "parameter_name", &parameter_name);
if (CWMP_STRLEN(parameter_name) == 0)