You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
2.1 KiB

/*
** 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.
**/
#ifndef ZABBIX_UM_CACHE_MOCK_H
#define ZABBIX_UM_CACHE_MOCK_H
#include "zbxcacheconfig/dbconfig.h"
#include "zbxcacheconfig/dbsync.h"
typedef struct
{
zbx_uint64_t macroid;
zbx_uint64_t hostid;
unsigned char type;
char *macro;
char *value;
}
zbx_um_mock_macro_t;
ZBX_PTR_VECTOR_DECL(um_mock_macro, zbx_um_mock_macro_t *)
typedef struct
{
zbx_uint64_t hostid;
zbx_vector_um_mock_macro_t macros;
zbx_vector_uint64_t templateids;
}
zbx_um_mock_host_t;
typedef struct
{
const char *key;
const char *value;
}
zbx_um_mock_kv_t;
ZBX_PTR_VECTOR_DECL(um_mock_kv, zbx_um_mock_kv_t *)
typedef struct
{
const char *path;
zbx_vector_um_mock_kv_t kvs;
}
zbx_um_mock_kvset_t;
ZBX_PTR_VECTOR_DECL(um_mock_kvset, zbx_um_mock_kvset_t *)
typedef struct
{
zbx_hashset_t hosts;
zbx_vector_um_mock_kvset_t kvsets;
}
zbx_um_mock_cache_t;
void um_mock_config_init(void);
void um_mock_config_destroy(void);
void um_mock_cache_init(zbx_um_mock_cache_t *cache, zbx_mock_handle_t handle);
void um_mock_cache_init_from_config(zbx_um_mock_cache_t *cache, zbx_um_cache_t *cfg);
void um_mock_cache_clear(zbx_um_mock_cache_t *cache);
void um_mock_cache_dump(zbx_um_mock_cache_t *cache);
void um_mock_cache_diff(zbx_um_mock_cache_t *cache1, zbx_um_mock_cache_t *cache2, zbx_dbsync_t *gmacros,
zbx_dbsync_t *hmacros, zbx_dbsync_t *htmpls);
void mock_dbsync_clear(zbx_dbsync_t *sync);
#endif