blob: eb2735a7127e35df707dbff8ac0c33ac7b757c0f (
plain)
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
|
#pragma once
#include "../../config.h"
#include <stddef.h>
#include <stdlib.h>
enum {
UNKNOWN_PACKET_LOSS = 200, /* 200% */
DEFAULT_MAX_PACKETS = 5 /* default no. of ICMP ECHO packets */
};
#define UNKNOWN_TRIP_TIME -1.0 /* -1 seconds */
#define MAX_ADDR_START 1
typedef struct {
bool display_html;
int max_packets;
char **addresses;
size_t n_addresses;
int wpl;
int cpl;
double wrta;
double crta;
} check_ping_config;
check_ping_config check_ping_config_init() {
check_ping_config tmp = {
.display_html = false,
.max_packets = -1,
.addresses = NULL,
.n_addresses = 0,
.wpl = UNKNOWN_PACKET_LOSS,
.cpl = UNKNOWN_PACKET_LOSS,
.wrta = UNKNOWN_TRIP_TIME,
.crta = UNKNOWN_TRIP_TIME,
};
tmp.addresses = calloc(MAX_ADDR_START, sizeof(char *));
tmp.addresses[0] = NULL;
return tmp;
}
|