zabbix-agent2/src/libs/zbxdbcache/dbconfig.c
/******************************************************************************
 *                                                                            *
 * Function: DCset_interfaces_availability                                    *
 *                                                                            *
 * Purpose: update availability of interfaces in configuration cache and      *
 *          return the updated field flags                                    *
 *                                                                            *
 * Parameters: availabilities - [IN/OUT] the interfacess availability data    *
 *                                                                            *
 * Return value: SUCCEED - at least one interface availability data           *
 *                         was updated                                        *
 *               FAIL    - no interfaces were updated                         *
 *                                                                            *
 ******************************************************************************/
DCset_interfaces_availability

Purpose: update availability of interfaces in configuration cache and
return the updated field flags

Parameters: availabilities - [IN/OUT] the interfacess availability data

Return value: SUCCEED - at least one interface availability data
was updated
FAIL    - no interfaces were updated
DCset_interfaces_availability Purpose : update availability of interfaces in configuration cache and return the updated field flags Parameters : availabilities - [ IN / OUT ] the interfacess availability data Return value : SUCCEED - at least one interface availability data was updated FAIL - no interfaces were updated
int	DCset_interfaces_availability(zbx_vector_availability_ptr_t *availabilities)
{
	int				i;
	ZBX_DC_INTERFACE		*dc_interface;
	zbx_interface_availability_t	*ia;
	int				ret = FAIL, now;
	now = time(NULL);
	WRLOCK_CACHE;
	for (i = 0; i < availabilities->values_num; i++)
	{
		ia = availabilities->values[i];
		if (NULL == (dc_interface = (ZBX_DC_INTERFACE *)zbx_hashset_search(&config->interfaces,
				&ia->interfaceid)))
		{
			int	j;
			for (j = 0; j < ZBX_AGENT_MAX; j++)
				ia->agent.flags = ZBX_FLAGS_AGENT_STATUS_NONE;
			continue;
		}
		if (SUCCEED == DCinterface_set_availability(dc_interface, now, ia))
			ret = SUCCEED;
	}
	UNLOCK_CACHE;
	return ret;
}
int DCset_interfaces_availability ( zbx_vector_availability_ptr_t * availabilities ) { int i ; ZBX_DC_INTERFACE * dc_interface ; zbx_interface_availability_t * ia ; int ret = FAIL , now ; now = time ( NULL ) ; WRLOCK_CACHE ; for ( i = 0 ; i < availabilities -> values_num ; i ++ ) { ia = availabilities -> values [ i ] ; if ( NULL == ( dc_interface = ( ZBX_DC_INTERFACE * ) zbx_hashset_search ( & config -> interfaces , & ia -> interfaceid ) ) ) { int j ; for ( j = 0 ; j < ZBX_AGENT_MAX ; j ++ ) ia -> agent . flags = ZBX_FLAGS_AGENT_STATUS_NONE ; continue ; } if ( SUCCEED == DCinterface_set_availability ( dc_interface , now , ia ) ) ret = SUCCEED ; } UNLOCK_CACHE ; return ret ; }
Function: DCset_interfaces_availability                                    
                                                                            
 Purpose: update availability of interfaces in configuration cache and      
          return the updated field flags                                    
                                                                            
 Parameters: availabilities - [IN/OUT] the interfacess availability data    
                                                                            
 Return value: SUCCEED - at least one interface availability data           
                         was updated                                        
               FAIL    - no interfaces were updated
Function : DCset_interfaces_availability Purpose : update availability of interfaces in configuration cache and return the updated field flags Parameters : availabilities - [ IN / OUT ] the interfacess availability data Return value : SUCCEED - at least one interface availability data was updated FAIL - no interfaces were updated
/* reset availability flag so this host is ignored when saving availability diff to DB */