1 /* 2 ** Zabbix 3 ** Copyright (C) 2001-2021 Zabbix SIA 4 ** 5 ** This program is free software; you can redistribute it and/or modify 6 ** it under the terms of the GNU General Public License as published by 7 ** the Free Software Foundation; either version 2 of the License, or 8 ** (at your option) any later version. 9 ** 10 ** This program is distributed in the hope that it will be useful, 11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 ** GNU General Public License for more details. 14 ** 15 ** You should have received a copy of the GNU General Public License 16 ** along with this program; if not, write to the Free Software 17 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18 **/ 19 20 #include "common.h" 21 22 typedef struct 23 { 24 char *addr; 25 double min; 26 double sum; 27 double max; 28 int rcv; 29 int cnt; 30 char *status; /* array of individual response statuses: 1 - valid, 0 - timeout */ 31 } 32 ZBX_FPING_HOST; 33 34 typedef enum 35 { 36 ICMPPING = 0, 37 ICMPPINGSEC, 38 ICMPPINGLOSS 39 } 40 icmpping_t; 41 42 typedef enum 43 { 44 ICMPPINGSEC_MIN = 0, 45 ICMPPINGSEC_AVG, 46 ICMPPINGSEC_MAX 47 } 48 icmppingsec_type_t; 49 50 typedef struct 51 { 52 int count; 53 int interval; 54 int size; 55 int timeout; 56 zbx_uint64_t itemid; 57 char *addr; 58 icmpping_t icmpping; 59 icmppingsec_type_t type; 60 } 61 icmpitem_t; 62 63 int zbx_ping(ZBX_FPING_HOST *hosts, int hosts_count, int count, int period, int size, int timeout, 64 char *error, size_t max_error_len); 65