zabbix-agent2/src/libs/zbxdbcache/dbconfig.c
/******************************************************************************
 *                                                                            *
 * Function: DCconfig_find_active_time_function                               *
 *                                                                            *
 * Purpose: check if the expression contains time based functions             *
 *                                                                            *
 * Parameters: expression    - [IN] the original expression                   *
 *             data          - [IN] the parsed and serialized expression      *
 *             trigger_timer - [IN] the trigger time function flags           *
 *                                                                            *
 ******************************************************************************/
DCconfig_find_active_time_function

Purpose: check if the expression contains time based functions

Parameters: expression    - [IN] the original expression
data          - [IN] the parsed and serialized expression
trigger_timer - [IN] the trigger time function flags
DCconfig_find_active_time_function Purpose : check if the expression contains time based functions Parameters : expression - [ IN ] the original expression data - [ IN ] the parsed and serialized expression trigger_timer - [ IN ] the trigger time function flags
static int	DCconfig_find_active_time_function(const char *expression, const unsigned char *data,
		unsigned char trigger_timer)
{
	int			i, ret = SUCCEED;
	const ZBX_DC_FUNCTION	*dc_function;
	const ZBX_DC_HOST	*dc_host;
	const ZBX_DC_ITEM	*dc_item;
	zbx_vector_uint64_t	functionids;
	zbx_vector_uint64_create(&functionids);
	zbx_get_serialized_expression_functionids(expression, data, &functionids);
	for (i = 0; i < functionids.values_num; i++)
	{
		if (NULL == (dc_function = (ZBX_DC_FUNCTION *)zbx_hashset_search(&config->functions,
				&functionids.values[i])))
		{
			continue;
		}
		if (ZBX_TRIGGER_TIMER_DEFAULT != trigger_timer || ZBX_FUNCTION_TYPE_TRENDS == dc_function->type ||
				ZBX_FUNCTION_TYPE_TIMER == dc_function->type)
		{
			if (NULL == (dc_item = zbx_hashset_search(&config->items, &dc_function->itemid)))
				continue;
			if (NULL == (dc_host = zbx_hashset_search(&config->hosts, &dc_item->hostid)))
				continue;
			if (SUCCEED != DCin_maintenance_without_data_collection(dc_host, dc_item))
				goto out;
		}
	}
	ret = (ZBX_TRIGGER_TIMER_DEFAULT != trigger_timer ? SUCCEED : FAIL);
out:
	zbx_vector_uint64_destroy(&functionids);
	return ret;
}
static int DCconfig_find_active_time_function ( const char * expression , const unsigned char * data , unsigned char trigger_timer ) { int i , ret = SUCCEED ; const ZBX_DC_FUNCTION * dc_function ; const ZBX_DC_HOST * dc_host ; const ZBX_DC_ITEM * dc_item ; zbx_vector_uint64_t functionids ; zbx_vector_uint64_create ( & functionids ) ; zbx_get_serialized_expression_functionids ( expression , data , & functionids ) ; for ( i = 0 ; i < functionids . values_num ; i ++ ) { if ( NULL == ( dc_function = ( ZBX_DC_FUNCTION * ) zbx_hashset_search ( & config -> functions , & functionids . values [ i ] ) ) ) { continue ; } if ( ZBX_TRIGGER_TIMER_DEFAULT != trigger_timer || ZBX_FUNCTION_TYPE_TRENDS == dc_function -> type || ZBX_FUNCTION_TYPE_TIMER == dc_function -> type ) { if ( NULL == ( dc_item = zbx_hashset_search ( & config -> items , & dc_function -> itemid ) ) ) continue ; if ( NULL == ( dc_host = zbx_hashset_search ( & config -> hosts , & dc_item -> hostid ) ) ) continue ; if ( SUCCEED != DCin_maintenance_without_data_collection ( dc_host , dc_item ) ) goto out ; } } ret = ( ZBX_TRIGGER_TIMER_DEFAULT != trigger_timer ? SUCCEED : FAIL ) ; out : zbx_vector_uint64_destroy ( & functionids ) ; return ret ; }
Function: DCconfig_find_active_time_function                               
                                                                            
 Purpose: check if the expression contains time based functions             
                                                                            
 Parameters: expression    - [IN] the original expression                   
             data          - [IN] the parsed and serialized expression      
             trigger_timer - [IN] the trigger time function flags
Function : DCconfig_find_active_time_function Purpose : check if the expression contains time based functions Parameters : expression - [ IN ] the original expression data - [ IN ] the parsed and serialized expression trigger_timer - [ IN ] the trigger time function flags