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 | 68 |
1 files changed, 68 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..dc6ea40b --- /dev/null +++ b/plugins-root/check_icmp.d/check_icmp_helpers.h | |||
| @@ -0,0 +1,68 @@ | |||
| 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 ping_target { | ||
| 13 | unsigned short id; /* id in **table, and icmp pkts */ | ||
| 14 | char *msg; /* icmp error message, if any */ | ||
| 15 | |||
| 16 | struct sockaddr_storage address; /* the address of this host */ | ||
| 17 | struct sockaddr_storage error_addr; /* stores address of error replies */ | ||
| 18 | time_t 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 rtmax; /* max rtt */ | ||
| 24 | double rtmin; /* min rtt */ | ||
| 25 | |||
| 26 | double jitter; /* measured jitter */ | ||
| 27 | double jitter_max; /* jitter rtt maximum */ | ||
| 28 | double jitter_min; /* jitter rtt minimum */ | ||
| 29 | |||
| 30 | time_t last_tdiff; | ||
| 31 | unsigned int last_icmp_seq; /* Last ICMP_SEQ to check out of order pkts */ | ||
| 32 | |||
| 33 | bool found_out_of_order_packets; | ||
| 34 | |||
| 35 | struct ping_target *next; | ||
| 36 | } ping_target; | ||
| 37 | |||
| 38 | ping_target ping_target_init(); | ||
| 39 | |||
| 40 | typedef struct { | ||
| 41 | char *name; | ||
| 42 | ping_target *target_list; | ||
| 43 | unsigned int number_of_targets; | ||
| 44 | } check_icmp_target_container; | ||
| 45 | |||
| 46 | check_icmp_target_container check_icmp_target_container_init(); | ||
| 47 | |||
| 48 | typedef struct { | ||
| 49 | unsigned int icmp_sent; | ||
| 50 | unsigned int icmp_recv; | ||
| 51 | unsigned int icmp_lost; | ||
| 52 | unsigned short targets_down; | ||
| 53 | } check_icmp_state; | ||
| 54 | |||
| 55 | check_icmp_state check_icmp_state_init(); | ||
| 56 | |||
| 57 | typedef struct { | ||
| 58 | int errorcode; | ||
| 59 | ping_target host; | ||
| 60 | } ping_target_create_wrapper; | ||
| 61 | |||
| 62 | typedef struct { | ||
| 63 | int socket4; | ||
| 64 | int socket6; | ||
| 65 | } check_icmp_socket_set; | ||
| 66 | |||
| 67 | ping_target_create_wrapper ping_target_create(struct sockaddr_storage address); | ||
| 68 | unsigned int ping_target_list_append(ping_target *list, ping_target *elem); | ||
