Source
int DBsync_template_dependencies_for_triggers(zbx_uint64_t hostid, const zbx_vector_uint64_t *trids, int is_update)
/*
** 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.
**/
typedef struct
{
zbx_uint64_t triggerid;
int flags;
}
resolve_dependencies_triggers_flags_t;
static zbx_hash_t triggers_flags_hash_func(const void *data)
{
const resolve_dependencies_triggers_flags_t *trigger_entry =
(const resolve_dependencies_triggers_flags_t *)data;
return ZBX_DEFAULT_UINT64_HASH_ALGO(&(trigger_entry->triggerid), sizeof(trigger_entry->triggerid),
ZBX_DEFAULT_HASH_SEED);
}
static int triggers_flags_compare_func(const void *d1, const void *d2)
{
const resolve_dependencies_triggers_flags_t *trigger_entry_1 =
(const resolve_dependencies_triggers_flags_t *)d1;
const resolve_dependencies_triggers_flags_t *trigger_entry_2 =
(const resolve_dependencies_triggers_flags_t *)d2;
ZBX_RETURN_IF_NOT_EQUAL(trigger_entry_1->triggerid, trigger_entry_2->triggerid);
return 0;
}
typedef struct
{
zbx_uint64_t trigger_dep_id;
zbx_uint64_t trigger_down_id;
zbx_uint64_t trigger_up_id;
int status;
int flags;
}
zbx_trigger_dep_vec_entry_t;