1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
/*
** Zabbix
** Copyright (C) 2001-2022 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
|