Source
static int zbx_get_snmp_response_error(const zbx_snmp_sess_t ssp, const zbx_dc_interface_t *interface, int status,
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** 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 Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
/*
* SNMP Dynamic Index Cache
* ========================
*
* Description
* -----------
*
* Zabbix caches the whole index table for the particular OID separately based on:
* * IP address;
* * port;
* * community string (SNMPv2c);
* * context, security name (SNMPv3).
*
* Zabbix revalidates each index before using it to get a value and rebuilds the index cache for the OID if the
* index is invalid.
*
* Example
* -------
*
* OID for getting memory usage of process by PID (index):
* HOST-RESOURCES-MIB::hrSWRunPerfMem:<PID>
*
* OID for getting PID (index) by process name (value):
* HOST-RESOURCES-MIB::hrSWRunPath:<PID> <NAME>
*
* SNMP OID as configured in Zabbix to get memory usage of "snmpd" process:
* HOST-RESOURCES-MIB::hrSWRunPerfMem["index","HOST-RESOURCES-MIB::hrSWRunPath","snmpd"]
*
* 1. Zabbix walks hrSWRunPath table and caches all <PID> and <NAME> pairs of particular SNMP agent/user.
* 2. Before each GET request Zabbix revalidates the cached <PID> by getting its <NAME> from hrSWRunPath table.
* 3. If the names match then Zabbix uses the cached <PID> in the GET request for the hrSWRunPerfMem.
* Otherwise Zabbix rebuilds the hrSWRunPath cache for the particular agent/user (see 1.).
*
* Implementation
* --------------
*
* The cache is implemented using hash tables. In ERD:
* zbx_snmpidx_main_key_t -------------------------------------------0< zbx_snmpidx_mapping_t
* (OID, host, <v2c: community|v3: (context, security name)>) (index, value)
*/
/******************************************************************************
* *
* This is zbx_snmp_walk() callback function prototype. *