diff --git a/src/diagnostic.c b/src/diagnostic.c index 9313723..30687c4 100644 --- a/src/diagnostic.c +++ b/src/diagnostic.c @@ -33,6 +33,7 @@ struct diagnostic_input { #define UDPECHO_NUMBER_INPUTS 9 #define NSLKUP_NUMBER_INPUTS 5 #define WIFINEIGHB_NUMBER_INPUTS 0 +#define IPLAYER_CAPACITY_INPUTS 22 #define IP_DIAGNOSTICS_OBJECT "Device.IP.Diagnostics." #define DNS_DIAGNOSTICS_OBJECT "Device.DNS.Diagnostics." @@ -46,6 +47,32 @@ struct diagnostic_input { #define UDPECHO_DIAG_ACT_NAME "UDPEchoDiagnostics()" #define NSLOOKUP_DIAG_ACT_NAME "NSLookupDiagnostics()" #define WIFINEIBORING_DIAG_ACT_NAME "NeighboringWiFiDiagnostic()" +#define IPLAYER_CAPACITY_ACT_NAME "IPLayerCapacity()" + +struct diagnostic_input iplayer_capacity_array[IPLAYER_CAPACITY_INPUTS] = { + { "Interface", "Device.IP.Diagnostics.IPLayerCapacityMetrics.Interface", NULL }, + { "Role", "Device.IP.Diagnostics.IPLayerCapacityMetrics.Role", NULL }, + { "Host", "Device.IP.Diagnostics.IPLayerCapacityMetrics.Host", NULL }, + { "Port", "Device.IP.Diagnostics.IPLayerCapacityMetrics.Port", NULL }, + { "JumboFramesPermitted", "Device.IP.Diagnostics.IPLayerCapacityMetrics.JumboFramesPermitted", NULL }, + { "DSCP", "Device.IP.Diagnostics.IPLayerCapacityMetrics.DSCP", NULL }, + { "ProtocolVersion", "Device.IP.Diagnostics.IPLayerCapacityMetrics.ProtocolVersion", NULL }, + { "UDPPayloadContent", "Device.IP.Diagnostics.IPLayerCapacityMetrics.UDPPayloadContent", NULL }, + { "TestType", "Device.IP.Diagnostics.IPLayerCapacityMetrics.TestType", NULL }, + { "IPDVEnable", "Device.IP.Diagnostics.IPLayerCapacityMetrics.IPDVEnable", NULL }, + { "StartSendingRateIndex", "Device.IP.Diagnostics.IPLayerCapacityMetrics.StartSendingRateIndex", NULL }, + { "NumberTestSubIntervals", "Device.IP.Diagnostics.IPLayerCapacityMetrics.NumberTestSubIntervals", NULL }, + { "NumberFirstModeTestSubIntervals", "Device.IP.Diagnostics.IPLayerCapacityMetrics.NumberFirstModeTestSubIntervals", NULL }, + { "TestSubInterval", "Device.IP.Diagnostics.IPLayerCapacityMetrics.TestSubInterval", NULL }, + { "StatusFeedbackInterval", "Device.IP.Diagnostics.IPLayerCapacityMetrics.StatusFeedbackInterval", NULL }, + { "SeqErrThresh", "Device.IP.Diagnostics.IPLayerCapacityMetrics.SeqErrThresh", NULL }, + { "ReordDupIgnoreEnable", "Device.IP.Diagnostics.IPLayerCapacityMetrics.ReordDupIgnoreEnable", NULL }, + { "LowerThresh", "Device.IP.Diagnostics.IPLayerCapacityMetrics.LowerThresh", NULL }, + { "UpperThresh", "Device.IP.Diagnostics.IPLayerCapacityMetrics.UpperThresh", NULL }, + { "HighSpeedDelta", "Device.IP.Diagnostics.IPLayerCapacityMetrics.HighSpeedDelta", NULL }, + { "SlowAdjThresh", "Device.IP.Diagnostics.IPLayerCapacityMetrics.SlowAdjThresh", NULL }, + { "RateAdjAlgorithm", "Device.IP.Diagnostics.IPLayerCapacityMetrics.RateAdjAlgorithm", NULL }, +}; struct diagnostic_input download_diagnostics_array[DOWNLOAD_NUMBER_INPUTS] = { { "Interface", "Device.IP.Diagnostics.DownloadDiagnostics.Interface", NULL }, @@ -145,7 +172,7 @@ bool set_diagnostic_parameter_structure_value(char *parameter_name, char *value) return set_specific_diagnostic_object_parameter_structure_value(&download_diagnostics_array, DOWNLOAD_NUMBER_INPUTS, parameter_name, value) || set_specific_diagnostic_object_parameter_structure_value(&upload_diagnostics_array, UPLOAD_NUMBER_INPUTS, parameter_name, value) || set_specific_diagnostic_object_parameter_structure_value(&ipping_diagnostics_array, IPPING_NUMBER_INPUTS, parameter_name, value) || set_specific_diagnostic_object_parameter_structure_value(&nslookup_diagnostics_array, NSLKUP_NUMBER_INPUTS, parameter_name, value) || set_specific_diagnostic_object_parameter_structure_value(&traceroute_diagnostics_array, TRACEROUTE_NUMBER_INPUTS, parameter_name, value) || set_specific_diagnostic_object_parameter_structure_value(&udpecho_diagnostics_array, UDPECHO_NUMBER_INPUTS, parameter_name, value) || - set_specific_diagnostic_object_parameter_structure_value(&seserverselection_diagnostics_array, SESERVERSELECT_NUMBER_INPUTS, parameter_name, value); + set_specific_diagnostic_object_parameter_structure_value(&seserverselection_diagnostics_array, SESERVERSELECT_NUMBER_INPUTS, parameter_name, value) || set_specific_diagnostic_object_parameter_structure_value(&iplayer_capacity_array, IPLAYER_CAPACITY_INPUTS, parameter_name, value); } void empty_ubus_callback(struct ubus_request *req __attribute__((unused)), int type __attribute__((unused)), struct blob_attr *msg __attribute__((unused))) {} @@ -188,6 +215,16 @@ int cwmp_wifi_neighboring__diagnostics() return 0; } +int cwmp_ip_layer_capacity_diagnostics() +{ + if (cwmp_diagnostics_operate(IP_DIAGNOSTICS_OBJECT, IPLAYER_CAPACITY_ACT_NAME, iplayer_capacity_array, IPLAYER_CAPACITY_INPUTS) == -1) + return -1; + + CWMP_LOG(INFO, "IP layer capacity diagnostic is successfully executed"); + cwmp_main->diag_session = true; + return 0; +} + int cwmp_download_diagnostics() { if (cwmp_diagnostics_operate(IP_DIAGNOSTICS_OBJECT, DOWNLOAD_DIAG_ACT_NAME, download_diagnostics_array, DOWNLOAD_NUMBER_INPUTS) == -1) diff --git a/src/diagnostic.h b/src/diagnostic.h index d0029d6..5789d1d 100644 --- a/src/diagnostic.h +++ b/src/diagnostic.h @@ -24,5 +24,6 @@ int cwmp_nslookup_diagnostics(); int cwmp_traceroute_diagnostics(); int cwmp_udp_echo_diagnostics(); int cwmp_serverselection_diagnostics(); +int cwmp_ip_layer_capacity_diagnostics(); #endif diff --git a/src/session.c b/src/session.c index aae0c6a..3985f2c 100644 --- a/src/session.c +++ b/src/session.c @@ -673,6 +673,11 @@ int run_session_end_func(void) cwmp_wifi_neighboring__diagnostics(); } + if (end_session_flag & END_SESSION_IPLAYERCAPACITY_DIAGNOSTIC) { + CWMP_LOG(INFO, "Executing IP layer capacity diagnostic: end session request"); + cwmp_ip_layer_capacity_diagnostics(); + } + if (cwmp_main->diag_session) { struct session_timer_event *periodic_inform_event = calloc(1, sizeof(struct session_timer_event)); periodic_inform_event->session_timer_evt.cb = cwmp_schedule_session_with_event; diff --git a/src/session.h b/src/session.h index 25e9a9a..f277d6c 100644 --- a/src/session.h +++ b/src/session.h @@ -75,7 +75,8 @@ enum end_session_enum END_SESSION_SCHEDULE_DOWNLOAD = 1 << 17, END_SESSION_UPLOAD = 1 << 18, END_SESSION_SCHEDULE_INFORM = 1 << 19, - END_SESSION_CDU = 1 << 20 + END_SESSION_CDU = 1 << 20, + END_SESSION_IPLAYERCAPACITY_DIAGNOSTIC = 1 << 21 }; enum enum_session_status