diff options
author | Artjoms Rimdjonoks <artjoms.rimdjonoks@zabbix.com> | 2022-11-08 09:58:26 +0300 |
---|---|---|
committer | Artjoms Rimdjonoks <artjoms.rimdjonoks@zabbix.com> | 2022-11-08 09:58:26 +0300 |
commit | 87e29798bfe984bd6ed3e5c1ce36d45f499ffa5f (patch) | |
tree | 4b11714a165d9036e64e1b0f45866bfdd6e54c39 /include | |
parent | ac4886b8da7d6d3b4490f187938a616bfda65b88 (diff) | |
parent | 4d9b9a2abd5c198a5dadbcdd10c413b4c4f4acd5 (diff) |
.......... [DEV-2134] updated to latest master
Diffstat (limited to 'include')
-rw-r--r-- | include/disk.h | 31 | ||||
-rw-r--r-- | include/zbxcommon.h | 1 | ||||
-rw-r--r-- | include/zbxjson.h | 46 | ||||
-rw-r--r-- | include/zbxwin32.h (renamed from include/perfmon.h) | 37 | ||||
-rw-r--r-- | include/zbxwinservice.h | 7 |
5 files changed, 72 insertions, 50 deletions
diff --git a/include/disk.h b/include/disk.h deleted file mode 100644 index e544863e612..00000000000 --- a/include/disk.h +++ /dev/null @@ -1,31 +0,0 @@ -/* -** 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_DISK_H -#define ZABBIX_DISK_H - -#include "config.h" - -#if !defined(_WINDOWS) && !defined(__MINGW32__) -# error "This module is only available for Windows OS" -#endif - -zbx_uint64_t get_cluster_size(const char *path, char **error); - -#endif /* ZABBIX_DISK_H */ diff --git a/include/zbxcommon.h b/include/zbxcommon.h index a950e280195..284cffb1286 100644 --- a/include/zbxcommon.h +++ b/include/zbxcommon.h @@ -834,6 +834,7 @@ void zbx_version(void); const char *get_program_name(const char *path); typedef unsigned char (*zbx_get_program_type_f)(void); +typedef const char *(*zbx_get_progname_f)(void); typedef enum { diff --git a/include/zbxjson.h b/include/zbxjson.h index 28ed6fd68a6..e5c91376b14 100644 --- a/include/zbxjson.h +++ b/include/zbxjson.h @@ -21,6 +21,7 @@ #define ZABBIX_ZJSON_H #include "zbxtypes.h" +#include "zbxalgo.h" #define ZBX_PROTO_TAG_CLOCK "clock" #define ZBX_PROTO_TAG_NS "ns" @@ -250,7 +251,8 @@ typedef enum ZBX_JSON_TYPE_OBJECT, ZBX_JSON_TYPE_NULL, ZBX_JSON_TYPE_TRUE, - ZBX_JSON_TYPE_FALSE + ZBX_JSON_TYPE_FALSE, + ZBX_JSON_TYPE_NUMBER } zbx_json_type_t; @@ -330,11 +332,51 @@ typedef struct /* set to 1 when jsonpath points at single location */ unsigned char definite; + unsigned char first_match; /* set to 1 if first match must be returned */ } zbx_jsonpath_t; -void zbx_jsonpath_clear(zbx_jsonpath_t *jsonpath); +typedef struct zbx_jsonobj zbx_jsonobj_t; + +ZBX_PTR_VECTOR_DECL(jsonobj_ptr, zbx_jsonobj_t *) + +typedef union +{ + char *string; + double number; + zbx_hashset_t object; + zbx_vector_jsonobj_ptr_t array; +} +zbx_jsonobj_data_t; + +typedef struct +{ + char *path; /* the path that was indexed - for example @.a.b.c */ + zbx_hashset_t objects; +} +zbx_jsonobj_index_t; + +struct zbx_jsonobj +{ + zbx_json_type_t type; + zbx_jsonobj_data_t data; + zbx_jsonobj_index_t *index; +}; + +typedef struct +{ + char *name; + zbx_jsonobj_t value; +} +zbx_jsonobj_el_t; + int zbx_jsonpath_compile(const char *path, zbx_jsonpath_t *jsonpath); int zbx_jsonpath_query(const struct zbx_json_parse *jp, const char *path, char **output); +void zbx_jsonpath_clear(zbx_jsonpath_t *jsonpath); + +int zbx_jsonobj_open(const char *data, zbx_jsonobj_t *obj); +void zbx_jsonobj_clear(zbx_jsonobj_t *obj); +int zbx_jsonobj_query(zbx_jsonobj_t *obj, const char *path, char **output); +int zbx_jsonobj_to_string(char **str, size_t *str_alloc, size_t *str_offset, zbx_jsonobj_t *obj); #endif /* ZABBIX_ZJSON_H */ diff --git a/include/perfmon.h b/include/zbxwin32.h index c52c85a2f9b..a8382c38d17 100644 --- a/include/perfmon.h +++ b/include/zbxwin32.h @@ -17,15 +17,21 @@ ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ -#ifndef ZABBIX_PERFMON_H -#define ZABBIX_PERFMON_H +#ifndef ZABBIX_WIN32_H +#define ZABBIX_WIN32_H +#include "config.h" #include "zbxsysinc.h" +#include "zbxtypes.h" +#include "zbxcommon.h" #if !defined(_WINDOWS) && !defined(__MINGW32__) # error "This module is only available for Windows OS" #endif +#define zbx_get_builtin_object_name(ctr) zbx_get_counter_name(zbx_get_builtin_object_index(ctr)) +#define zbx_get_builtin_counter_name(ctr) zbx_get_counter_name(zbx_get_builtin_counter_index(ctr)) + /* this struct must be only modified along with mapping builtin_counter_ref[] in perfmon.c */ typedef enum { @@ -80,22 +86,27 @@ typedef struct perf_counter_data } zbx_perf_counter_data_t; +zbx_uint64_t zbx_get_cluster_size(const char *path, char **error); + PDH_STATUS zbx_PdhMakeCounterPath(const char *function, PDH_COUNTER_PATH_ELEMENTS *cpe, char *counterpath); PDH_STATUS zbx_PdhOpenQuery(const char *function, PDH_HQUERY query); PDH_STATUS zbx_PdhAddCounter(const char *function, zbx_perf_counter_data_t *counter, PDH_HQUERY query, const char *counterpath, zbx_perf_counter_lang_t lang, PDH_HCOUNTER *handle); PDH_STATUS zbx_PdhCollectQueryData(const char *function, const char *counterpath, PDH_HQUERY query); -PDH_STATUS zbx_PdhGetRawCounterValue(const char *function, const char *counterpath, PDH_HCOUNTER handle, PPDH_RAW_COUNTER value); +PDH_STATUS zbx_PdhGetRawCounterValue(const char *function, const char *counterpath, PDH_HCOUNTER handle, + PPDH_RAW_COUNTER value); + +PDH_STATUS zbx_calculate_counter_value(const char *function, const char *counterpath, + zbx_perf_counter_lang_t lang, double *value); +wchar_t *zbx_get_counter_name(DWORD pdhIndex); +int zbx_check_counter_path(char *counterPath, int convert_from_numeric); +int zbx_init_builtin_counter_indexes(void); +DWORD zbx_get_builtin_object_index(zbx_builtin_counter_ref_t counter_ref); +DWORD zbx_get_builtin_counter_index(zbx_builtin_counter_ref_t counter_ref); +wchar_t *zbx_get_all_counter_names(HKEY reg_key, wchar_t *reg_value_name); -PDH_STATUS calculate_counter_value(const char *function, const char *counterpath, zbx_perf_counter_lang_t lang, double *value); -wchar_t *get_counter_name(DWORD pdhIndex); -int check_counter_path(char *counterPath, int convert_from_numeric); -int init_builtin_counter_indexes(void); -DWORD get_builtin_object_index(zbx_builtin_counter_ref_t counter_ref); -DWORD get_builtin_counter_index(zbx_builtin_counter_ref_t counter_ref); -wchar_t *get_all_counter_names(HKEY reg_key, wchar_t *reg_value_name); +int zbx_win_exception_filter(struct _EXCEPTION_POINTERS *ep); -#define get_builtin_object_name(ctr) get_counter_name(get_builtin_object_index(ctr)) -#define get_builtin_counter_name(ctr) get_counter_name(get_builtin_counter_index(ctr)) +void zbx_init_library_win32(zbx_get_progname_f get_progname); -#endif /* ZABBIX_PERFMON_H */ +#endif /* ZABBIX_WIN32_H */ diff --git a/include/zbxwinservice.h b/include/zbxwinservice.h index 9ac2e3b866f..4313b585ec0 100644 --- a/include/zbxwinservice.h +++ b/include/zbxwinservice.h @@ -26,17 +26,16 @@ #include "zbxthreads.h" -extern ZBX_THREAD_HANDLE *threads; +typedef void (*zbx_on_exit_t)(int); -void service_start(int flags); +void zbx_service_start(int flags); int ZabbixCreateService(const char *path, int multiple_agents, const char *config_file); int ZabbixRemoveService(void); int ZabbixStartService(void); int ZabbixStopService(void); -typedef void (*zbx_on_exit_t)(int); -void set_parent_signal_handler(zbx_on_exit_t zbx_on_exit_cb_arg); +void zbx_set_parent_signal_handler(zbx_on_exit_t zbx_on_exit_cb_arg); int ZBX_IS_RUNNING(void); void ZBX_DO_EXIT(void); |