Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
* 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 <amin.benramdhane@pivasoftware.com>
*
*/
#ifndef __DMDIAGNOSTICS_H__
#define __DMDIAGNOSTICS_H__
#define DOWNLOAD_UPLOAD_PROTOCOL_HTTP "http://"
#define DOWNLOAD_UPLOAD_PROTOCOL_FTP "ftp://"
#define default_date_format "AAAA-MM-JJTHH:MM:SS.000000Z"
#define default_date_size sizeof(default_date_format) + 1
#define FTP_SIZE_RESPONSE "213"
#define FTP_PASV_RESPONSE "227 Entering Passive"
#define FTP_TRANSFERT_COMPLETE "226 Transfer"
#define FTP_RETR_REQUEST "RETR"
#define FTP_STOR_REQUEST "STOR"
struct download_diag
{
char romtime[default_date_size];
char bomtime[default_date_size];
char eomtime[default_date_size];
int test_bytes_received;
unsigned long total_bytes_received;
char tcpopenrequesttime[default_date_size];
char tcpopenresponsetime[default_date_size];
int tmp;
int first_data;
uint16_t ip_len;
uint32_t ack_seq;
uint32_t random_seq;
uint32_t get_ack;
uint32_t ftp_syn;
};
struct upload_diagnostic_stats
{
char romtime[default_date_size];
char bomtime[default_date_size];
char eomtime[default_date_size];
unsigned long total_bytes_sent;
char tcpopenrequesttime[default_date_size];
char tcpopenresponsetime[default_date_size];
int tmp;
int first_data;
uint16_t ip_len;
uint32_t ack_seq;
uint32_t random_seq;
uint32_t get_ack;
uint32_t ftp_syn;
};
enum download_diagnostic_protocol {
DOWNLOAD_DIAGNOSTIC_HTTP = 1,
DOWNLOAD_DIAGNOSTIC_FTP
};
enum diagnostic_type {
DOWNLOAD_DIAGNOSTIC = 1,
UPLOAD_DIAGNOSTIC
};
char *get_param_diagnostics(char *diag, char *option);
void set_param_diagnostics(char *diag, char *option, char *value);
void init_download_stats(void);
void init_upload_stats(void);
int extract_stats(char *dump_file, int proto, int diagnostic_type, char *protocol);
int get_default_gateway_device( char **gw );
int start_upload_download_diagnostic(int diagnostic_type);
#endif