zabbix-agent2/src/libs/zbxdbcache/dbconfig.c
/******************************************************************************
 *                                                                            *
 * Function: DCconfig_get_snmp_interfaceids_by_addr                           *
 *                                                                            *
 * Purpose: get array of interface IDs for the specified address              *
 *                                                                            *
 * Return value: number of interface IDs returned                             *
 *                                                                            *
 * Author: Rudolfs Kreicbergs                                                 *
 *                                                                            *
 ******************************************************************************/
DCconfig_get_snmp_interfaceids_by_addr

Purpose: get array of interface IDs for the specified address

Return value: number of interface IDs returned

Author: Rudolfs Kreicbergs
DCconfig_get_snmp_interfaceids_by_addr Purpose : get array of interface IDs for the specified address Return value : number of interface IDs returned Author : Rudolfs Kreicbergs
int	DCconfig_get_snmp_interfaceids_by_addr(const char *addr, zbx_uint64_t **interfaceids)
{
	int				count = 0, i;
	const ZBX_DC_INTERFACE_ADDR	*dc_interface_snmpaddr;
	ZBX_DC_INTERFACE_ADDR		dc_interface_snmpaddr_local;
	zabbix_log(LOG_LEVEL_DEBUG, "In %s() addr:'%s'", __func__, addr);
	dc_interface_snmpaddr_local.addr = addr;
	RDLOCK_CACHE;
	if (NULL == (dc_interface_snmpaddr = (const ZBX_DC_INTERFACE_ADDR *)zbx_hashset_search(&config->interface_snmpaddrs, &dc_interface_snmpaddr_local)))
		goto unlock;
	*interfaceids = (zbx_uint64_t *)zbx_malloc(*interfaceids, dc_interface_snmpaddr->interfaceids.values_num * sizeof(zbx_uint64_t));
	for (i = 0; i < dc_interface_snmpaddr->interfaceids.values_num; i++)
		(*interfaceids)[i] = dc_interface_snmpaddr->interfaceids.values[i];
	count = i;
unlock:
	UNLOCK_CACHE;
	zabbix_log(LOG_LEVEL_DEBUG, "End of %s():%d", __func__, count);
	return count;
}
int DCconfig_get_snmp_interfaceids_by_addr ( const char * addr , zbx_uint64_t * * interfaceids ) { int count = 0 , i ; const ZBX_DC_INTERFACE_ADDR * dc_interface_snmpaddr ; ZBX_DC_INTERFACE_ADDR dc_interface_snmpaddr_local ; zabbix_log ( LOG_LEVEL_DEBUG , " " , __func__ , addr ) ; dc_interface_snmpaddr_local . addr = addr ; RDLOCK_CACHE ; if ( NULL == ( dc_interface_snmpaddr = ( const ZBX_DC_INTERFACE_ADDR * ) zbx_hashset_search ( & config -> interface_snmpaddrs , & dc_interface_snmpaddr_local ) ) ) goto unlock ; * interfaceids = ( zbx_uint64_t * ) zbx_malloc ( * interfaceids , dc_interface_snmpaddr -> interfaceids . values_num * sizeof ( zbx_uint64_t ) ) ; for ( i = 0 ; i < dc_interface_snmpaddr -> interfaceids . values_num ; i ++ ) ( * interfaceids ) [ i ] = dc_interface_snmpaddr -> interfaceids . values [ i ] ; count = i ; unlock : UNLOCK_CACHE ; zabbix_log ( LOG_LEVEL_DEBUG , " " , __func__ , count ) ; return count ; }
Function: DCconfig_get_snmp_interfaceids_by_addr                           
                                                                            
 Purpose: get array of interface IDs for the specified address              
                                                                            
 Return value: number of interface IDs returned                             
                                                                            
 Author: Rudolfs Kreicbergs
Function : DCconfig_get_snmp_interfaceids_by_addr Purpose : get array of interface IDs for the specified address Return value : number of interface IDs returned Author : Rudolfs Kreicbergs