diff options
author | Artjoms Rimdjonoks <artjoms.rimdjonoks@zabbix.com> | 2022-04-10 22:27:34 +0300 |
---|---|---|
committer | Artjoms Rimdjonoks <artjoms.rimdjonoks@zabbix.com> | 2022-04-10 22:27:34 +0300 |
commit | 7d5bc4b46ff6f7c5cf788f02ff3bf178d7d22424 (patch) | |
tree | 35c46957de6916268b3933c27151350bb50841c2 /include | |
parent | fac0cd94cfcc1a44b1433790699909b61f46a212 (diff) | |
parent | f13a3f887da6168e89d5388f331ef041b26f97c5 (diff) |
.......... [DEV-2127] updated to the latest master
Diffstat (limited to 'include')
-rw-r--r-- | include/avail_protocol.h | 29 | ||||
-rw-r--r-- | include/common.h | 2 | ||||
-rw-r--r-- | include/common/zbxsysinc.h (renamed from include/sysinc.h) | 0 | ||||
-rw-r--r-- | include/common/zbxtypes.h (renamed from include/zbxtypes.h) | 2 | ||||
-rw-r--r-- | include/db.h | 50 | ||||
-rw-r--r-- | include/dbcache.h | 13 | ||||
-rw-r--r-- | include/export.h | 2 | ||||
-rw-r--r-- | include/perfmon.h | 2 | ||||
-rw-r--r-- | include/setproctitle.h | 2 | ||||
-rw-r--r-- | include/sha256crypt.h | 2 | ||||
-rw-r--r-- | include/zbxavailability.h | 51 | ||||
-rw-r--r-- | include/zbxexec.h | 2 | ||||
-rw-r--r-- | include/zbxmedia.h | 2 | ||||
-rw-r--r-- | include/zbxnix.h | 2 | ||||
-rw-r--r-- | include/zbxsymbols.h | 2 |
15 files changed, 71 insertions, 92 deletions
diff --git a/include/avail_protocol.h b/include/avail_protocol.h deleted file mode 100644 index f82bd8c84a8..00000000000 --- a/include/avail_protocol.h +++ /dev/null @@ -1,29 +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_AVAIL_PROTOCOL_H -#define ZABBIX_AVAIL_PROTOCOL_H - -#include "db.h" - -void zbx_availability_serialize(unsigned char **data, size_t *data_alloc, size_t *data_offset, - const zbx_interface_availability_t *interface_availability); -void zbx_availability_deserialize(const unsigned char *data, zbx_uint32_t size, - zbx_vector_availability_ptr_t *interface_availabilities); -#endif diff --git a/include/common.h b/include/common.h index 3260cc43415..ee0c01de34f 100644 --- a/include/common.h +++ b/include/common.h @@ -20,7 +20,7 @@ #ifndef ZABBIX_COMMON_H #define ZABBIX_COMMON_H -#include "sysinc.h" +#include "zbxsysinc.h" #include "module.h" #include "version.h" diff --git a/include/sysinc.h b/include/common/zbxsysinc.h index e7632ef38b9..e7632ef38b9 100644 --- a/include/sysinc.h +++ b/include/common/zbxsysinc.h diff --git a/include/zbxtypes.h b/include/common/zbxtypes.h index e39f7602f9d..b3aa3adf095 100644 --- a/include/zbxtypes.h +++ b/include/common/zbxtypes.h @@ -20,7 +20,7 @@ #ifndef ZABBIX_TYPES_H #define ZABBIX_TYPES_H -#include "sysinc.h" +#include "zbxsysinc.h" #if defined(_WINDOWS) # define ZBX_THREAD_LOCAL __declspec(thread) diff --git a/include/db.h b/include/db.h index 7ea14bc6261..90cd0d18a7d 100644 --- a/include/db.h +++ b/include/db.h @@ -396,7 +396,7 @@ typedef struct DB_MEDIATYPE } DB_MEDIATYPE; -void zbx_db_mediatype_clean(DB_MEDIATYPE *mt); +void zbx_db_mediatype_clean(DB_MEDIATYPE *mt); void zbx_serialize_mediatype(unsigned char **data, zbx_uint32_t *data_alloc, zbx_uint32_t *data_offset, const DB_MEDIATYPE *mt); zbx_uint32_t zbx_deserialize_mediatype(const unsigned char *data, DB_MEDIATYPE *mt); @@ -404,7 +404,7 @@ zbx_uint32_t zbx_deserialize_mediatype(const unsigned char *data, DB_MEDIATYPE * typedef struct { zbx_uint64_t alertid; - zbx_uint64_t actionid; + zbx_uint64_t actionid; int clock; zbx_uint64_t mediatypeid; char *sendto; @@ -589,7 +589,7 @@ typedef struct #define ZBX_FLAGS_TRIGGER_DIFF_UPDATE_STATE 0x0004 #define ZBX_FLAGS_TRIGGER_DIFF_UPDATE_ERROR 0x0008 #define ZBX_FLAGS_TRIGGER_DIFF_UPDATE \ - (ZBX_FLAGS_TRIGGER_DIFF_UPDATE_VALUE | ZBX_FLAGS_TRIGGER_DIFF_UPDATE_LASTCHANGE | \ + (ZBX_FLAGS_TRIGGER_DIFF_UPDATE_VALUE | ZBX_FLAGS_TRIGGER_DIFF_UPDATE_LASTCHANGE | \ ZBX_FLAGS_TRIGGER_DIFF_UPDATE_STATE | ZBX_FLAGS_TRIGGER_DIFF_UPDATE_ERROR) #define ZBX_FLAGS_TRIGGER_DIFF_UPDATE_PROBLEM_COUNT 0x1000 #define ZBX_FLAGS_TRIGGER_DIFF_RECALCULATE_PROBLEM_COUNT 0x2000 @@ -736,49 +736,6 @@ void zbx_db_insert_clean(zbx_db_insert_t *self); void zbx_db_insert_autoincrement(zbx_db_insert_t *self, const char *field_name); int zbx_db_get_database_type(void); -/* agent (ZABBIX, SNMP, IPMI, JMX) availability data */ -typedef struct -{ - /* flags specifying which fields are set, see ZBX_FLAGS_AGENT_STATUS_* defines */ - unsigned char flags; - - /* agent availability fields */ - unsigned char available; - char *error; - int errors_from; - int disable_until; -} -zbx_agent_availability_t; - -#define ZBX_FLAGS_AGENT_STATUS_NONE 0x00000000 -#define ZBX_FLAGS_AGENT_STATUS_AVAILABLE 0x00000001 -#define ZBX_FLAGS_AGENT_STATUS_ERROR 0x00000002 -#define ZBX_FLAGS_AGENT_STATUS_ERRORS_FROM 0x00000004 -#define ZBX_FLAGS_AGENT_STATUS_DISABLE_UNTIL 0x00000008 - -#define ZBX_FLAGS_AGENT_STATUS (ZBX_FLAGS_AGENT_STATUS_AVAILABLE | \ - ZBX_FLAGS_AGENT_STATUS_ERROR | \ - ZBX_FLAGS_AGENT_STATUS_ERRORS_FROM | \ - ZBX_FLAGS_AGENT_STATUS_DISABLE_UNTIL) - -#define ZBX_AGENT_ZABBIX (INTERFACE_TYPE_AGENT - 1) -#define ZBX_AGENT_SNMP (INTERFACE_TYPE_SNMP - 1) -#define ZBX_AGENT_IPMI (INTERFACE_TYPE_IPMI - 1) -#define ZBX_AGENT_JMX (INTERFACE_TYPE_JMX - 1) -#define ZBX_AGENT_UNKNOWN 255 -#define ZBX_AGENT_MAX INTERFACE_TYPE_COUNT - -typedef struct -{ - zbx_uint64_t interfaceid; - zbx_agent_availability_t agent; - /* ensure chronological order in case of flapping interface availability */ - int id; -} -zbx_interface_availability_t; - -ZBX_PTR_VECTOR_DECL(availability_ptr, zbx_interface_availability_t *) - typedef struct { zbx_uint64_t eventid; @@ -791,7 +748,6 @@ typedef struct } zbx_event_t; -void zbx_db_update_interface_availabilities(const zbx_vector_availability_ptr_t *interface_availabilities); int DBget_user_by_active_session(const char *sessionid, zbx_user_t *user); int DBget_user_by_auth_token(const char *formatted_auth_token_hash, zbx_user_t *user); void zbx_user_init(zbx_user_t *user); diff --git a/include/dbcache.h b/include/dbcache.h index 11b0db6dfbf..a8ae9fc1a96 100644 --- a/include/dbcache.h +++ b/include/dbcache.h @@ -25,6 +25,7 @@ #include "zbxcomms.h" #include "zbxshmem.h" #include "zbxeval.h" +#include "zbxavailability.h" #define ZBX_SYNC_DONE 0 #define ZBX_SYNC_MORE 1 @@ -55,6 +56,13 @@ #define ZBX_IPC_CONFIG_RELOAD_REQUEST 1 #define ZBX_IPC_CONFIG_RELOAD_RESPONSE 2 +#define ZBX_AGENT_ZABBIX (INTERFACE_TYPE_AGENT - 1) +#define ZBX_AGENT_SNMP (INTERFACE_TYPE_SNMP - 1) +#define ZBX_AGENT_IPMI (INTERFACE_TYPE_IPMI - 1) +#define ZBX_AGENT_JMX (INTERFACE_TYPE_JMX - 1) +#define ZBX_AGENT_UNKNOWN 255 +#define ZBX_AGENT_MAX INTERFACE_TYPE_COUNT + extern int CONFIG_TIMEOUT; extern zbx_uint64_t CONFIG_CONF_CACHE_SIZE; @@ -831,11 +839,6 @@ void zbx_dc_get_actions_eval(zbx_vector_ptr_t *actions, unsigned char opflags); int DCget_interfaces_availability(zbx_vector_ptr_t *interfaces, int *ts); void DCtouch_interfaces_availability(const zbx_vector_uint64_t *interfaceids); -void zbx_interface_availability_init(zbx_interface_availability_t *availability, zbx_uint64_t interfaceid); -void zbx_interface_availability_clean(zbx_interface_availability_t *ia); -void zbx_interface_availability_free(zbx_interface_availability_t *availability); -int zbx_interface_availability_is_set(const zbx_interface_availability_t *ia); - void zbx_set_availability_diff_ts(int ts); void zbx_dc_correlation_rules_init(zbx_correlation_rules_t *rules); diff --git a/include/export.h b/include/export.h index 761fda25a53..238465a9df4 100644 --- a/include/export.h +++ b/include/export.h @@ -20,7 +20,7 @@ #ifndef ZABBIX_EXPORT_H #define ZABBIX_EXPORT_H -#include "sysinc.h" +#include "zbxsysinc.h" #define ZBX_FLAG_EXPTYPE_EVENTS 1 #define ZBX_FLAG_EXPTYPE_HISTORY 2 diff --git a/include/perfmon.h b/include/perfmon.h index 2202c32f7bb..c52c85a2f9b 100644 --- a/include/perfmon.h +++ b/include/perfmon.h @@ -20,7 +20,7 @@ #ifndef ZABBIX_PERFMON_H #define ZABBIX_PERFMON_H -#include "sysinc.h" +#include "zbxsysinc.h" #if !defined(_WINDOWS) && !defined(__MINGW32__) # error "This module is only available for Windows OS" diff --git a/include/setproctitle.h b/include/setproctitle.h index f61c036d58e..7600600c394 100644 --- a/include/setproctitle.h +++ b/include/setproctitle.h @@ -20,7 +20,7 @@ #ifndef ZABBIX_SETPROCTITLE_H #define ZABBIX_SETPROCTITLE_H -#include "sysinc.h" +#include "zbxsysinc.h" #if defined(__linux__) /* Linux */ # define PS_OVERWRITE_ARGV diff --git a/include/sha256crypt.h b/include/sha256crypt.h index f799f0c4f5b..8eedba2eb2e 100644 --- a/include/sha256crypt.h +++ b/include/sha256crypt.h @@ -20,7 +20,7 @@ #ifndef ZABBIX_SHA256CRYPT_H #define ZABBIX_SHA256CRYPT_H -#include "sysinc.h" +#include "zbxsysinc.h" #define ZBX_SHA256_DIGEST_SIZE 32 diff --git a/include/zbxavailability.h b/include/zbxavailability.h index b5008c208e0..8482a5c7747 100644 --- a/include/zbxavailability.h +++ b/include/zbxavailability.h @@ -23,10 +23,59 @@ #include "zbxtypes.h" #include "db.h" +/* agent (ZABBIX, SNMP, IPMI, JMX) availability data */ +typedef struct +{ + /* flags specifying which fields are set, see ZBX_FLAGS_AGENT_STATUS_* defines */ + unsigned char flags; + + /* agent availability fields */ + unsigned char available; + char *error; + int errors_from; + int disable_until; +} +zbx_agent_availability_t; + +#define ZBX_FLAGS_AGENT_STATUS_NONE 0x00000000 +#define ZBX_FLAGS_AGENT_STATUS_AVAILABLE 0x00000001 +#define ZBX_FLAGS_AGENT_STATUS_ERROR 0x00000002 +#define ZBX_FLAGS_AGENT_STATUS_ERRORS_FROM 0x00000004 +#define ZBX_FLAGS_AGENT_STATUS_DISABLE_UNTIL 0x00000008 + +#define ZBX_FLAGS_AGENT_STATUS (ZBX_FLAGS_AGENT_STATUS_AVAILABLE | \ + ZBX_FLAGS_AGENT_STATUS_ERROR | \ + ZBX_FLAGS_AGENT_STATUS_ERRORS_FROM | \ + ZBX_FLAGS_AGENT_STATUS_DISABLE_UNTIL) + +typedef struct +{ + zbx_uint64_t interfaceid; + zbx_agent_availability_t agent; + /* ensure chronological order in case of flapping interface availability */ + int id; +} +zbx_interface_availability_t; + +ZBX_PTR_VECTOR_DECL(availability_ptr, zbx_interface_availability_t *) + #define ZBX_IPC_SERVICE_AVAILABILITY "availability" -#define ZBX_IPC_AVAILABILITY_REQUEST 1 void zbx_availability_flush(unsigned char *data, zbx_uint32_t size); void zbx_availabilities_flush(const zbx_vector_availability_ptr_t *interface_availabilities); +void zbx_interface_availability_init(zbx_interface_availability_t *availability, zbx_uint64_t interfaceid); +void zbx_interface_availability_clean(zbx_interface_availability_t *ia); +void zbx_interface_availability_free(zbx_interface_availability_t *availability); +void zbx_agent_availability_init(zbx_agent_availability_t *agent, unsigned char available, const char *error, + int errors_from, int disable_until); + +int zbx_interface_availability_is_set(const zbx_interface_availability_t *ia); + +void zbx_db_update_interface_availabilities(const zbx_vector_availability_ptr_t *interface_availabilities); + +void zbx_availability_serialize(unsigned char **data, size_t *data_alloc, size_t *data_offset, + const zbx_interface_availability_t *interface_availability); +void zbx_availability_deserialize(const unsigned char *data, zbx_uint32_t size, + zbx_vector_availability_ptr_t *interface_availabilities); #endif /* ZABBIX_AVAILABILITY_H */ diff --git a/include/zbxexec.h b/include/zbxexec.h index 9ec549216b1..e9c15946a8c 100644 --- a/include/zbxexec.h +++ b/include/zbxexec.h @@ -20,7 +20,7 @@ #ifndef ZABBIX_ZBXEXEC_H #define ZABBIX_ZBXEXEC_H -#include "sysinc.h" +#include "zbxsysinc.h" #define ZBX_EXIT_CODE_CHECKS_DISABLED 0 #define ZBX_EXIT_CODE_CHECKS_ENABLED 1 diff --git a/include/zbxmedia.h b/include/zbxmedia.h index 570dbcece79..edb8b1e591e 100644 --- a/include/zbxmedia.h +++ b/include/zbxmedia.h @@ -20,7 +20,7 @@ #ifndef ZABBIX_ZBXMEDIA_H #define ZABBIX_ZBXMEDIA_H -#include "sysinc.h" /* using "config.h" would be better, but it causes warnings when compiled with Net-SNMP */ +#include "zbxsysinc.h" /* using "config.h" would be better, but it causes warnings when compiled with Net-SNMP */ #define ZBX_MEDIA_CONTENT_TYPE_TEXT 0 #define ZBX_MEDIA_CONTENT_TYPE_HTML 1 diff --git a/include/zbxnix.h b/include/zbxnix.h index 80c484e21cd..8e0f5ebb877 100644 --- a/include/zbxnix.h +++ b/include/zbxnix.h @@ -20,7 +20,7 @@ #ifndef ZABBIX_ZBXNIX_H #define ZABBIX_ZBXNIX_H -#include "sysinc.h" +#include "zbxsysinc.h" /* IPC start */ #include "zbxtypes.h" diff --git a/include/zbxsymbols.h b/include/zbxsymbols.h index 354f4204be4..b9c4cf47f2c 100644 --- a/include/zbxsymbols.h +++ b/include/zbxsymbols.h @@ -20,7 +20,7 @@ #ifndef ZABBIX_SYMBOLS_H #define ZABBIX_SYMBOLS_H -#include "sysinc.h" +#include "zbxsysinc.h" #if defined(_WINDOWS) || defined(__MINGW32__) |