Source
SET_UI64_RESULT(result, zbx_ifrow_get_out_ucast_pkts(&ifrow) + zbx_ifrow_get_out_nucast_pkts(&ifrow));
/*
** Zabbix
** Copyright (C) 2001-2023 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.
**/
/* __stdcall calling convention is used for GetIfEntry2(). In order to declare a */
/* pointer to GetIfEntry2() we have to expand NETIOPAPI_API macro manually since */
/* part of it must be together with the pointer name in the parentheses. */
typedef NETIO_STATUS (NETIOAPI_API_ *pGetIfEntry2_t)(PMIB_IF_ROW2 Row);
/* GetIfEntry2() is available since Windows Vista and Windows Server 2008. In */
/* earlier Windows releases this pointer remains set to NULL and GetIfEntry() is */
/* used directly instead. */
static pGetIfEntry2_t pGetIfEntry2 = NULL;
/* GetIfEntry2() and GetIfEntry() work with different MIB interface structures. */
/* Use zbx_ifrow_t variables and zbx_ifrow_*() functions below instead of */
/* version specific MIB interface API. */
typedef struct
{
MIB_IFROW *ifRow; /* 32-bit counters */
MIB_IF_ROW2 *ifRow2; /* 64-bit counters, supported since Windows Vista, Server 2008 */
}
zbx_ifrow_t;
/******************************************************************************
* *
* Purpose: initialize the zbx_ifrow_t variable *
* *
* Parameters: *
* pIfRow - [IN/OUT] pointer to zbx_ifrow_t variable with all *
* members set to NULL *
* *
* Comments: allocates memory, call zbx_ifrow_clean() with the same pointer *
* to free it *
* *
******************************************************************************/
static void zbx_ifrow_init(zbx_ifrow_t *pIfRow)
{
HMODULE module;