Source
static int service_update_match_action(const zbx_service_update_t *update, const zbx_service_action_t *action)
/*
** Zabbix
** Copyright (C) 2001-2023 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
** 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 General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
/******************************************************************************
* *
* Purpose: match service update by service id *
* *
******************************************************************************/
static int condition_match_service(const zbx_service_action_condition_t *condition,
const zbx_service_update_t *update)
{
zbx_uint64_t serviceid;
if (SUCCEED != zbx_is_uint64(condition->value, &serviceid))
return FAIL;
return zbx_uint64match_condition(serviceid, update->service->serviceid, condition->op);
}
/******************************************************************************
* *
* Purpose: match service update by service name *
* *
******************************************************************************/
static int condition_match_service_name(const zbx_service_action_condition_t *condition,
const zbx_service_update_t *update)
{
return zbx_strmatch_condition(update->service->name, condition->value, condition->op);
}
/******************************************************************************
* *
* Purpose: match tag/tag+value using the specified operator *
* *
* Parameters: tags - [IN] the tags to match *
* name - [IN] the target tag name *
* value - [IN] the target tag value (NULL if only tag name are *
* being matched *
* op - [IN] the matching operator (ZBX_CONDITION_OPERATOR_*) *
* *
* Return value: SUCCEED - the tags matches *