diff options
Diffstat (limited to 'plugins-root/check_icmp.d/check_icmp_helpers.h')
-rw-r--r-- | plugins-root/check_icmp.d/check_icmp_helpers.h | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/plugins-root/check_icmp.d/check_icmp_helpers.h b/plugins-root/check_icmp.d/check_icmp_helpers.h new file mode 100644 index 00000000..49f720ec --- /dev/null +++ b/plugins-root/check_icmp.d/check_icmp_helpers.h | |||
@@ -0,0 +1,73 @@ | |||
1 | #pragma once | ||
2 | |||
3 | #include "../../lib/states.h" | ||
4 | #include <netinet/in_systm.h> | ||
5 | #include <netinet/in.h> | ||
6 | #include <netinet/ip.h> | ||
7 | #include <netinet/ip6.h> | ||
8 | #include <netinet/ip_icmp.h> | ||
9 | #include <netinet/icmp6.h> | ||
10 | #include <arpa/inet.h> | ||
11 | |||
12 | typedef struct rta_host { | ||
13 | unsigned short id; /* id in **table, and icmp pkts */ | ||
14 | char *name; /* arg used for adding this host */ | ||
15 | char *msg; /* icmp error message, if any */ | ||
16 | struct sockaddr_storage saddr_in; /* the address of this host */ | ||
17 | struct sockaddr_storage error_addr; /* stores address of error replies */ | ||
18 | unsigned long long time_waited; /* total time waited, in usecs */ | ||
19 | unsigned int icmp_sent, icmp_recv, icmp_lost; /* counters */ | ||
20 | unsigned char icmp_type, icmp_code; /* type and code from errors */ | ||
21 | unsigned short flags; /* control/status flags */ | ||
22 | |||
23 | double rta; /* measured RTA */ | ||
24 | double rtmax; /* max rtt */ | ||
25 | double rtmin; /* min rtt */ | ||
26 | |||
27 | double jitter; /* measured jitter */ | ||
28 | double jitter_max; /* jitter rtt maximum */ | ||
29 | double jitter_min; /* jitter rtt minimum */ | ||
30 | |||
31 | double EffectiveLatency; | ||
32 | double mos; /* Mean opinion score */ | ||
33 | double score; /* score */ | ||
34 | |||
35 | unsigned int last_tdiff; | ||
36 | unsigned int last_icmp_seq; /* Last ICMP_SEQ to check out of order pkts */ | ||
37 | unsigned char pl; /* measured packet loss */ | ||
38 | |||
39 | mp_state_enum rta_status; // check result for RTA checks | ||
40 | mp_state_enum jitter_status; // check result for Jitter checks | ||
41 | mp_state_enum mos_status; // check result for MOS checks | ||
42 | mp_state_enum score_status; // check result for score checks | ||
43 | mp_state_enum pl_status; // check result for packet loss checks | ||
44 | mp_state_enum order_status; // check result for packet order checks | ||
45 | |||
46 | struct rta_host *next; | ||
47 | } ping_target; | ||
48 | |||
49 | ping_target ping_target_init(); | ||
50 | |||
51 | typedef struct { | ||
52 | char *name; | ||
53 | ping_target *target_list; | ||
54 | unsigned int number_of_targets; | ||
55 | } check_icmp_target_container; | ||
56 | |||
57 | check_icmp_target_container check_icmp_target_container_init(); | ||
58 | |||
59 | typedef struct { | ||
60 | unsigned int icmp_sent; | ||
61 | unsigned int icmp_recv; | ||
62 | unsigned int icmp_lost; | ||
63 | unsigned short targets_down; | ||
64 | } check_icmp_state; | ||
65 | |||
66 | check_icmp_state check_icmp_state_init(); | ||
67 | |||
68 | typedef struct { | ||
69 | int errorcode; | ||
70 | ping_target host; | ||
71 | } rta_host_create_wrapper; | ||
72 | |||
73 | rta_host_create_wrapper rta_host_create(char *name, struct sockaddr_storage *address); | ||