Source
static int get_addr_info(const char *addr_in, const char *port_in, struct addrinfo *hints, net_count_info_t *info,
/*
** Zabbix
** Copyright (C) 2001-2022 Zabbix SIA
**
** 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.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
typedef struct
{
zbx_uint64_t ibytes;
zbx_uint64_t ipackets;
zbx_uint64_t ierr;
zbx_uint64_t idrop;
zbx_uint64_t ififo;
zbx_uint64_t iframe;
zbx_uint64_t icompressed;
zbx_uint64_t imulticast;
zbx_uint64_t obytes;
zbx_uint64_t opackets;
zbx_uint64_t oerr;
zbx_uint64_t odrop;
zbx_uint64_t ocolls;
zbx_uint64_t ofifo;
zbx_uint64_t ocarrier;
zbx_uint64_t ocompressed;
}
net_stat_t;
typedef struct
{
struct addrinfo *ai;
unsigned short port;
unsigned int prefix_sz;
unsigned char mapped;
}
net_count_info_t;
/* max number of bits in IPv4 CIDR prefix */
/* max number of bits in IPv6 CIDR prefix */
enum
{
STATE_UNKNOWN = 0,
STATE_ESTABLISHED,
STATE_SYN_SENT,
STATE_SYN_RECV,
STATE_FIN_WAIT1,
STATE_FIN_WAIT2,
STATE_TIME_WAIT,
STATE_CLOSE,
STATE_CLOSE_WAIT,
STATE_LAST_ACK,
STATE_LISTEN,
STATE_CLOSING,
STATE_MAXSTATES
};
enum
{
NLERR_OK = 0,
NLERR_UNKNOWN,
NLERR_SOCKCREAT,
NLERR_BADSEND,
NLERR_BADRECV,
NLERR_RECVTIMEOUT,