mirror of
https://dev.iopsys.eu/bbf/icwmp.git
synced 2025-12-10 07:44:41 +01:00
Add WiFi Neighboring diagnostics
This commit is contained in:
parent
3f38b6f47a
commit
a0da2716b9
4 changed files with 39 additions and 16 deletions
|
|
@ -32,9 +32,11 @@ struct diagnostic_input {
|
|||
#define TRACEROUTE_NUMBER_INPUTS 8
|
||||
#define UDPECHO_NUMBER_INPUTS 9
|
||||
#define NSLKUP_NUMBER_INPUTS 5
|
||||
#define WIFINEIGHB_NUMBER_INPUTS 0
|
||||
|
||||
#define IP_DIAGNOSTICS_OBJECT "Device.IP.Diagnostics."
|
||||
#define DNS_DIAGNOSTICS_OBJECT "Device.DNS.Diagnostics."
|
||||
#define WIFI_DIAGNOSTCS_OBJECT "Device.WiFi."
|
||||
|
||||
#define DOWNLOAD_DIAG_ACT_NAME "DownloadDiagnostics()"
|
||||
#define UPLOAD_DIAG_ACT_NAME "UploadDiagnostics()"
|
||||
|
|
@ -43,6 +45,7 @@ struct diagnostic_input {
|
|||
#define TRACE_ROUTE_DIAG_ACT_NAME "TraceRoute()"
|
||||
#define UDPECHO_DIAG_ACT_NAME "UDPEchoDiagnostics()"
|
||||
#define NSLOOKUP_DIAG_ACT_NAME "NSLookupDiagnostics()"
|
||||
#define WIFINEIBORING_DIAG_ACT_NAME "NeighboringWiFiDiagnostic()"
|
||||
|
||||
struct diagnostic_input download_diagnostics_array[DOWNLOAD_NUMBER_INPUTS] = {
|
||||
{ "Interface", "Device.IP.Diagnostics.DownloadDiagnostics.Interface", NULL },
|
||||
|
|
@ -149,21 +152,23 @@ void empty_ubus_callback(struct ubus_request *req __attribute__((unused)), int t
|
|||
|
||||
static int cwmp_diagnostics_operate(char *diagnostics_object, char *action_name, struct diagnostic_input diagnostics_array[], int number_inputs)
|
||||
{
|
||||
int e, i;
|
||||
int e;
|
||||
struct blob_buf b = { 0 };
|
||||
|
||||
memset(&b, 0, sizeof(struct blob_buf));
|
||||
blob_buf_init(&b, 0);
|
||||
bb_add_string(&b, "path", diagnostics_object);
|
||||
bb_add_string(&b, "action", action_name);
|
||||
void *tbl = blobmsg_open_table(&b, "input");
|
||||
for (i = 0; i < number_inputs; i++) {
|
||||
if (diagnostics_array[i].value == NULL || diagnostics_array[i].value[0] == '\0')
|
||||
continue;
|
||||
bb_add_string(&b, diagnostics_array[i].input_name, diagnostics_array[i].value);
|
||||
if (number_inputs > 0) {
|
||||
int i;
|
||||
void *tbl = blobmsg_open_table(&b, "input");
|
||||
for (i = 0; i < number_inputs; i++) {
|
||||
if (diagnostics_array[i].value == NULL || diagnostics_array[i].value[0] == '\0')
|
||||
continue;
|
||||
bb_add_string(&b, diagnostics_array[i].input_name, diagnostics_array[i].value);
|
||||
}
|
||||
blobmsg_close_table(&b, tbl);
|
||||
}
|
||||
blobmsg_close_table(&b, tbl);
|
||||
|
||||
e = icwmp_ubus_invoke(USP_OBJECT_NAME, "operate", b.head, empty_ubus_callback, NULL);
|
||||
blob_buf_free(&b);
|
||||
|
||||
|
|
@ -172,6 +177,17 @@ static int cwmp_diagnostics_operate(char *diagnostics_object, char *action_name,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int cwmp_wifi_neighboring__diagnostics()
|
||||
{
|
||||
struct diagnostic_input empty_array[1] = {{}};
|
||||
if (cwmp_diagnostics_operate(WIFI_DIAGNOSTCS_OBJECT, WIFINEIBORING_DIAG_ACT_NAME, empty_array, WIFINEIGHB_NUMBER_INPUTS) == -1)
|
||||
return -1;
|
||||
|
||||
CWMP_LOG(INFO, "WiFi neighboring 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)
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
bool set_diagnostic_parameter_structure_value(char *parameter_name, char *value);
|
||||
|
||||
int cwmp_wifi_neighboring__diagnostics();
|
||||
int cwmp_download_diagnostics();
|
||||
int cwmp_upload_diagnostics();
|
||||
int cwmp_ip_ping_diagnostics();
|
||||
|
|
|
|||
|
|
@ -668,6 +668,11 @@ int run_session_end_func(void)
|
|||
cwmp_upload_diagnostics();
|
||||
}
|
||||
|
||||
if (end_session_flag & END_SESSION_NEIGBORING_WIFI_DIAGNOSTIC) {
|
||||
CWMP_LOG(INFO, "Executing wifi neighboring diagnostic: end session request");
|
||||
cwmp_wifi_neighboring__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;
|
||||
|
|
|
|||
|
|
@ -67,14 +67,15 @@ enum end_session_enum
|
|||
END_SESSION_TRACEROUTE_DIAGNOSTIC = 1 << 9,
|
||||
END_SESSION_UDPECHO_DIAGNOSTIC = 1 << 10,
|
||||
END_SESSION_SERVERSELECTION_DIAGNOSTIC = 1 << 11,
|
||||
END_SESSION_SET_NOTIFICATION_UPDATE = 1 << 12,
|
||||
END_SESSION_RESTART_SERVICES = 1 << 13,
|
||||
END_SESSION_INIT_NOTIFY = 1 << 14,
|
||||
END_SESSION_DOWNLOAD = 1 << 15,
|
||||
END_SESSION_SCHEDULE_DOWNLOAD = 1 << 16,
|
||||
END_SESSION_UPLOAD = 1 << 17,
|
||||
END_SESSION_SCHEDULE_INFORM = 1 << 18,
|
||||
END_SESSION_CDU = 1 << 19
|
||||
END_SESSION_NEIGBORING_WIFI_DIAGNOSTIC = 1<<12,
|
||||
END_SESSION_SET_NOTIFICATION_UPDATE = 1 << 13,
|
||||
END_SESSION_RESTART_SERVICES = 1 << 14,
|
||||
END_SESSION_INIT_NOTIFY = 1 << 15,
|
||||
END_SESSION_DOWNLOAD = 1 << 16,
|
||||
END_SESSION_SCHEDULE_DOWNLOAD = 1 << 17,
|
||||
END_SESSION_UPLOAD = 1 << 18,
|
||||
END_SESSION_SCHEDULE_INFORM = 1 << 19,
|
||||
END_SESSION_CDU = 1 << 20
|
||||
};
|
||||
|
||||
enum enum_session_status
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue