zabbix-agent2/src/libs/zbxserver/expression.c
/******************************************************************************
 *                                                                            *
 * Function: expand_trigger_macros                                            *
 *                                                                            *
 * Purpose: expand macros in a trigger expression                             *
 *                                                                            *
 * Parameters: event - The trigger event structure                            *
 *             trigger - The trigger where to expand macros in                *
 *                                                                            *
 * Author: Andrea Biscuola                                                    *
 *                                                                            *
 ******************************************************************************/
expand_trigger_macros

Purpose: expand macros in a trigger expression

Parameters: event - The trigger event structure
trigger - The trigger where to expand macros in

Author: Andrea Biscuola
expand_trigger_macros Purpose : expand macros in a trigger expression Parameters : event - The trigger event structure trigger - The trigger where to expand macros in Author : Andrea Biscuola
static int	expand_trigger_macros(zbx_eval_context_t *ctx, const DB_EVENT *event, char *error, size_t maxerrlen)
{
	int 	i;
	for (i = 0; i < ctx->stack.values_num; i++)
	{
		zbx_eval_token_t	*token = &ctx->stack.values[i];
		if (ZBX_EVAL_TOKEN_VAR_MACRO != token->type && ZBX_EVAL_TOKEN_VAR_STR != token->type)
			continue;
		if (ZBX_VARIANT_STR != token->value.type)
			continue;
		if (FAIL == substitute_simple_macros_impl(NULL, event, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
				NULL, NULL, &token->value.data.str, MACRO_TYPE_TRIGGER_EXPRESSION, error, maxerrlen))
		{
			return FAIL;
		}
	}
	return SUCCEED;
}
static int expand_trigger_macros ( zbx_eval_context_t * ctx , const DB_EVENT * event , char * error , size_t maxerrlen ) { int i ; for ( i = 0 ; i < ctx -> stack . values_num ; i ++ ) { zbx_eval_token_t * token = & ctx -> stack . values [ i ] ; if ( ZBX_EVAL_TOKEN_VAR_MACRO != token -> type && ZBX_EVAL_TOKEN_VAR_STR != token -> type ) continue ; if ( ZBX_VARIANT_STR != token -> value . type ) continue ; if ( FAIL == substitute_simple_macros_impl ( NULL , event , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , & token -> value . data . str , MACRO_TYPE_TRIGGER_EXPRESSION , error , maxerrlen ) ) { return FAIL ; } } return SUCCEED ; }
Function: expand_trigger_macros                                            
                                                                            
 Purpose: expand macros in a trigger expression                             
                                                                            
 Parameters: event - The trigger event structure                            
             trigger - The trigger where to expand macros in                
                                                                            
 Author: Andrea Biscuola
Function : expand_trigger_macros Purpose : expand macros in a trigger expression Parameters : event - The trigger event structure trigger - The trigger where to expand macros in Author : Andrea Biscuola
/* all trigger macros macros are already extracted into strings */