Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/zabbix/zabbix.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtjoms Rimdjonoks <artjoms.rimdjonoks@zabbix.com>2021-05-07 13:47:40 +0300
committerArtjoms Rimdjonoks <artjoms.rimdjonoks@zabbix.com>2021-05-07 13:49:05 +0300
commit41e3dd118cc870619ab69d9ed0b97d568bde55f4 (patch)
tree2587d08132a68bac434cd6f125cb27cf973e0aa8 /include
parent5e5c5444e2f0102bdf34cec94851e4781b719022 (diff)
parentf9b34c32c38493307a3b2ebc73a4130223be96b5 (diff)
........S. [DEV-1836] updated to the latest master
Diffstat (limited to 'include')
-rw-r--r--include/common.h44
-rw-r--r--include/db.h19
-rw-r--r--include/dbcache.h1
-rw-r--r--include/mutexs.h1
-rw-r--r--include/preproc.h2
-rw-r--r--include/version.h4
-rw-r--r--include/zbxalert.h29
-rw-r--r--include/zbxalgo.h1
-rw-r--r--include/zbxipcservice.h3
-rw-r--r--include/zbxjson.h14
-rw-r--r--include/zbxlld.h4
-rw-r--r--include/zbxmedia.h4
-rw-r--r--include/zbxprometheus.h6
-rw-r--r--include/zbxreport.h34
-rw-r--r--include/zbxserialize.h10
-rw-r--r--include/zbxserver.h19
-rw-r--r--include/zbxtypes.h2
17 files changed, 145 insertions, 52 deletions
diff --git a/include/common.h b/include/common.h
index 8691b752cf6..10c16b69228 100644
--- a/include/common.h
+++ b/include/common.h
@@ -360,7 +360,7 @@ const char *zbx_dservice_type_string(zbx_dservice_type_t service);
#define CONDITION_TYPE_DVALUE 12
#define CONDITION_TYPE_HOST_TEMPLATE 13
#define CONDITION_TYPE_EVENT_ACKNOWLEDGED 14
-#define CONDITION_TYPE_APPLICATION 15
+/* #define CONDITION_TYPE_APPLICATION 15 deprecated */
#define CONDITION_TYPE_SUPPRESSED 16
#define CONDITION_TYPE_DRULE 18
#define CONDITION_TYPE_DCHECK 19
@@ -404,24 +404,6 @@ const char *zbx_dservice_type_string(zbx_dservice_type_t service);
#define EVENT_TYPE_TRIGGER_UNKNOWN 4
/* #define EVENT_TYPE_TRIGGER_NORMAL 5 deprecated */
-#define SCREEN_RESOURCE_GRAPH 0
-#define SCREEN_RESOURCE_SIMPLE_GRAPH 1
-#define SCREEN_RESOURCE_MAP 2
-#define SCREEN_RESOURCE_PLAIN_TEXT 3
-#define SCREEN_RESOURCE_HOST_INFO 4
-#define SCREEN_RESOURCE_TRIGGER_INFO 5
-#define SCREEN_RESOURCE_SERVER_INFO 6
-#define SCREEN_RESOURCE_CLOCK 7
-#define SCREEN_RESOURCE_SCREEN 8
-#define SCREEN_RESOURCE_TRIGGER_OVERVIEW 9
-#define SCREEN_RESOURCE_DATA_OVERVIEW 10
-#define SCREEN_RESOURCE_URL 11
-#define SCREEN_RESOURCE_ACTIONS 12
-#define SCREEN_RESOURCE_EVENTS 13
-#define SCREEN_RESOURCE_HOSTGROUP_TRIGGERS 14
-#define SCREEN_RESOURCE_SYSTEM_STATUS 15
-#define SCREEN_RESOURCE_HOST_TRIGGERS 16
-
typedef enum
{
SYSMAP_ELEMENT_TYPE_HOST = 0,
@@ -569,7 +551,9 @@ const char *get_program_type_string(unsigned char program_type);
#define ZBX_PROCESS_TYPE_ALERTSYNCER 30
#define ZBX_PROCESS_TYPE_HISTORYPOLLER 31
#define ZBX_PROCESS_TYPE_AVAILMAN 32
-#define ZBX_PROCESS_TYPE_COUNT 33 /* number of process types */
+#define ZBX_PROCESS_TYPE_REPORTMANAGER 33
+#define ZBX_PROCESS_TYPE_REPORTWRITER 34
+#define ZBX_PROCESS_TYPE_COUNT 35 /* number of process types */
#define ZBX_PROCESS_TYPE_UNKNOWN 255
const char *get_process_type_string(unsigned char proc_type);
int get_process_type_by_name(const char *proc_type_str);
@@ -855,9 +839,12 @@ zbx_script_t;
#define ZBX_SCRIPT_TYPE_IPMI 1
#define ZBX_SCRIPT_TYPE_SSH 2
#define ZBX_SCRIPT_TYPE_TELNET 3
-#define ZBX_SCRIPT_TYPE_GLOBAL_SCRIPT 4
#define ZBX_SCRIPT_TYPE_WEBHOOK 5
+#define ZBX_SCRIPT_SCOPE_ACTION 1
+#define ZBX_SCRIPT_SCOPE_HOST 2
+#define ZBX_SCRIPT_SCOPE_EVENT 4
+
#define ZBX_SCRIPT_EXECUTE_ON_AGENT 0
#define ZBX_SCRIPT_EXECUTE_ON_SERVER 1
#define ZBX_SCRIPT_EXECUTE_ON_PROXY 2 /* fall back to execution on server if target not monitored by proxy */
@@ -919,8 +906,8 @@ while (0)
\
do \
{ \
- zbx_error("ERROR [file and function: <%s,%s>, revision:%s] Something impossible has just happened.", \
- __FILE__, __func__, ZABBIX_REVISION); \
+ zbx_error("ERROR [file and function: <%s,%s>, revision:%s, line:%d] Something impossible has just" \
+ " happened.", __FILE__, __func__, ZABBIX_REVISION, __LINE__); \
zbx_backtrace(); \
} \
while (0)
@@ -1679,7 +1666,6 @@ int zbx_validate_value_dbl(double value, int dbl_precision);
void zbx_update_env(double time_now);
int zbx_get_agent_item_nextcheck(zbx_uint64_t itemid, const char *delay, int now,
int *nextcheck, char **error);
-
#define ZBX_DATA_SESSION_TOKEN_SIZE (MD5_DIGEST_SIZE * 2)
char *zbx_create_token(zbx_uint64_t seed);
@@ -1741,4 +1727,14 @@ int zbx_open_xml(char *data, int options, int maxerrlen, void **xml_doc, void **
int zbx_check_xml_memory(char *mem, int maxerrlen, char **errmsg);
#endif
+/* report scheduling */
+
+#define ZBX_REPORT_CYCLE_DAILY 0
+#define ZBX_REPORT_CYCLE_WEEKLY 1
+#define ZBX_REPORT_CYCLE_MONTHLY 2
+#define ZBX_REPORT_CYCLE_YEARLY 3
+
+int zbx_get_report_nextcheck(int now, unsigned char cycle, unsigned char weekdays, int start_time,
+ const char *tz);
+
#endif
diff --git a/include/db.h b/include/db.h
index 9876eff4c03..5338cbc4a24 100644
--- a/include/db.h
+++ b/include/db.h
@@ -179,6 +179,8 @@ struct _DC_TRIGGER;
#define ITEM_PARAMETER_NAME_LEN 255
#define ITEM_PARAMETER_VALUE_LEN 2048
+#define ITEM_TAG_FIELD_LEN 255
+
#define HISTORY_STR_VALUE_LEN 255
#define HISTORY_TEXT_VALUE_LEN 65535
#define HISTORY_LOG_VALUE_LEN 65535
@@ -208,6 +210,8 @@ struct _DC_TRIGGER;
#define FUNCTION_PARAM_LEN 255
+#define REPORT_ERROR_LEN 2048
+
#define ZBX_SQL_ITEM_FIELDS "i.itemid,i.key_,h.host,i.type,i.history,i.hostid,i.value_type,i.delta," \
"i.units,i.multiplier,i.formula,i.state,i.valuemapid,i.trends,i.data_type"
#define ZBX_SQL_ITEM_TABLES "hosts h,items i"
@@ -350,11 +354,10 @@ typedef struct
}
DB_EVENT;
-typedef struct
+typedef struct DB_MEDIATYPE
{
zbx_uint64_t mediatypeid;
zbx_media_type_t type;
- char *description;
char *smtp_server;
char *smtp_helo;
char *smtp_email;
@@ -363,14 +366,25 @@ typedef struct
char *gsm_modem;
char *username;
char *passwd;
+ char *script;
+ char *attempt_interval;
+ char *timeout;
unsigned short smtp_port;
unsigned char smtp_security;
unsigned char smtp_verify_peer;
unsigned char smtp_verify_host;
unsigned char smtp_authentication;
+ unsigned char content_type;
+ int maxsessions;
+ int maxattempts;
}
DB_MEDIATYPE;
+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);
+
typedef struct
{
zbx_uint64_t alertid;
@@ -877,4 +891,5 @@ void zbx_lld_override_operation_free(zbx_lld_override_operation_t *override_oper
void zbx_load_lld_override_operations(const zbx_vector_uint64_t *overrideids, char **sql, size_t *sql_alloc,
zbx_vector_ptr_t *ops);
+#define ZBX_TIMEZONE_DEFAULT_VALUE "default"
#endif
diff --git a/include/dbcache.h b/include/dbcache.h
index 1e66f16bee1..6f252b4fd44 100644
--- a/include/dbcache.h
+++ b/include/dbcache.h
@@ -964,6 +964,7 @@ int zbx_lld_macro_value_by_name(const struct zbx_json_parse *jp_row, const zbx_v
const char *macro, char **value);
int zbx_lld_macro_paths_compare(const void *d1, const void *d2);
+void zbx_dc_get_item_tags(zbx_uint64_t itemid, zbx_vector_ptr_t *item_tags);
void zbx_dc_get_item_tags_by_functionids(const zbx_uint64_t *functionids, size_t functionids_num,
zbx_vector_ptr_t *item_tags);
diff --git a/include/mutexs.h b/include/mutexs.h
index 756ec363086..38df8629be7 100644
--- a/include/mutexs.h
+++ b/include/mutexs.h
@@ -57,6 +57,7 @@ zbx_mutex_name_t;
typedef enum
{
ZBX_RWLOCK_CONFIG = 0,
+ ZBX_RWLOCK_VALUECACHE,
ZBX_RWLOCK_COUNT,
}
zbx_rwlock_name_t;
diff --git a/include/preproc.h b/include/preproc.h
index 6a011cbd716..b9cde38d2a0 100644
--- a/include/preproc.h
+++ b/include/preproc.h
@@ -43,7 +43,7 @@ zbx_preproc_item_stats_t;
/* the following functions are implemented differently for server and proxy */
-void zbx_preprocess_item_value(zbx_uint64_t itemid, unsigned char item_value_type, unsigned char item_flags,
+void zbx_preprocess_item_value(zbx_uint64_t itemid, zbx_uint64_t hostid, unsigned char item_value_type, unsigned char item_flags,
AGENT_RESULT *result, zbx_timespec_t *ts, unsigned char state, char *error);
void zbx_preprocessor_flush(void);
zbx_uint64_t zbx_preprocessor_get_queue_size(void);
diff --git a/include/version.h b/include/version.h
index c15eaf7e34a..fef5d4ade55 100644
--- a/include/version.h
+++ b/include/version.h
@@ -24,7 +24,7 @@
#define ZBX_STR(str) ZBX_STR2(str)
#define APPLICATION_NAME "Zabbix Agent"
-#define ZABBIX_REVDATE "1 March 2021"
+#define ZABBIX_REVDATE "26 April 2021"
#define ZABBIX_VERSION_MAJOR 5
#define ZABBIX_VERSION_MINOR 4
#define ZABBIX_VERSION_PATCH 0
@@ -36,7 +36,7 @@
# define ZABBIX_VERSION_RC_NUM {ZABBIX_RC_NUM}
# endif
#endif
-#define ZABBIX_VERSION_RC "beta2"
+#define ZABBIX_VERSION_RC "rc1"
#define ZABBIX_VERSION ZBX_STR(ZABBIX_VERSION_MAJOR) "." ZBX_STR(ZABBIX_VERSION_MINOR) "." \
ZBX_STR(ZABBIX_VERSION_PATCH) ZABBIX_VERSION_RC
#define ZABBIX_REVISION ZBX_STR(ZABBIX_VERSION_REVISION)
diff --git a/include/zbxalert.h b/include/zbxalert.h
index e8b6c8095cb..3209b5e7316 100644
--- a/include/zbxalert.h
+++ b/include/zbxalert.h
@@ -21,6 +21,8 @@
#define ZABBIX_ZBXALERT_H
#include "common.h"
+#include "db.h"
+#include "zbxipcservice.h"
typedef struct
{
@@ -31,10 +33,33 @@ typedef struct
}
zbx_am_source_stats_t;
-int zbx_alerter_get_diag_stats(zbx_uint64_t *alerts_num, char **error);
+typedef struct
+{
+ char *recipient;
+ char *info;
+ int status;
+}
+zbx_alerter_dispatch_result_t;
-int zbx_alerter_get_top_mediatypes(int limit, zbx_vector_uint64_pair_t *mediatypes, char **error);
+typedef struct
+{
+ zbx_ipc_async_socket_t alerter;
+ int total_num;
+ zbx_vector_ptr_t results;
+}
+zbx_alerter_dispatch_t;
+int zbx_alerter_get_diag_stats(zbx_uint64_t *alerts_num, char **error);
+int zbx_alerter_get_top_mediatypes(int limit, zbx_vector_uint64_pair_t *mediatypes, char **error);
int zbx_alerter_get_top_sources(int limit, zbx_vector_ptr_t *sources, char **error);
+int zbx_alerter_begin_dispatch(zbx_alerter_dispatch_t *dispatch, const char *subject, const char *message,
+ const char *content_name, const char *content_type, const char *content, zbx_uint32_t content_size,
+ char **error);
+int zbx_alerter_send_dispatch(zbx_alerter_dispatch_t *dispatch, const DB_MEDIATYPE *mediatype,
+ const zbx_vector_str_t *recipients, char **error);
+int zbx_alerter_end_dispatch(zbx_alerter_dispatch_t *dispatch, char **error);
+void zbx_alerter_dispatch_result_free(zbx_alerter_dispatch_result_t *result);
+void zbx_alerter_clear_dispatch(zbx_alerter_dispatch_t *dispatch);
+
#endif
diff --git a/include/zbxalgo.h b/include/zbxalgo.h
index a3ac1de008c..a1c0b377de0 100644
--- a/include/zbxalgo.h
+++ b/include/zbxalgo.h
@@ -457,5 +457,4 @@ int zbx_list_iterator_equal(const zbx_list_iterator_t *iterator1, const zbx_list
int zbx_list_iterator_isset(const zbx_list_iterator_t *iterator);
void zbx_list_iterator_update(zbx_list_iterator_t *iterator);
-
#endif
diff --git a/include/zbxipcservice.h b/include/zbxipcservice.h
index 8f9cd56e0b3..95e71ed5cba 100644
--- a/include/zbxipcservice.h
+++ b/include/zbxipcservice.h
@@ -107,6 +107,8 @@ void zbx_ipc_client_release(zbx_ipc_client_t *client);
int zbx_ipc_client_connected(zbx_ipc_client_t *client);
zbx_uint64_t zbx_ipc_client_id(const zbx_ipc_client_t *client);
zbx_ipc_client_t *zbx_ipc_client_by_id(const zbx_ipc_service_t *service, zbx_uint64_t id);
+void zbx_ipc_client_set_userdata(zbx_ipc_client_t *client, void *userdata);
+void *zbx_ipc_client_get_userdata(zbx_ipc_client_t *client);
int zbx_ipc_socket_open(zbx_ipc_socket_t *csocket, const char *service_name, int timeout, char **error);
void zbx_ipc_socket_close(zbx_ipc_socket_t *csocket);
@@ -121,6 +123,7 @@ int zbx_ipc_async_socket_send(zbx_ipc_async_socket_t *asocket, zbx_uint32_t code
int zbx_ipc_async_socket_recv(zbx_ipc_async_socket_t *asocket, int timeout, zbx_ipc_message_t **message);
int zbx_ipc_async_socket_flush(zbx_ipc_async_socket_t *asocket, int timeout);
int zbx_ipc_async_socket_check_unsent(zbx_ipc_async_socket_t *asocket);
+int zbx_ipc_async_socket_connected(zbx_ipc_async_socket_t *asocket);
int zbx_ipc_async_exchange(const char *service_name, zbx_uint32_t code, int timeout, const unsigned char *data,
zbx_uint32_t size, unsigned char **out, char **error);
diff --git a/include/zbxjson.h b/include/zbxjson.h
index 62c4f1b52e1..ba766305d69 100644
--- a/include/zbxjson.h
+++ b/include/zbxjson.h
@@ -80,9 +80,9 @@
#define ZBX_PROTO_TAG_JMX_ENDPOINT "jmx_endpoint"
#define ZBX_PROTO_TAG_EVENTID "eventid"
#define ZBX_PROTO_TAG_NAME "name"
+#define ZBX_PROTO_TAG_SEVERITY "severity"
#define ZBX_PROTO_TAG_HOSTS "hosts"
#define ZBX_PROTO_TAG_GROUPS "groups"
-#define ZBX_PROTO_TAG_APPLICATIONS "applications"
#define ZBX_PROTO_TAG_TAGS "tags"
#define ZBX_PROTO_TAG_TAG "tag"
#define ZBX_PROTO_TAG_PROBLEM_EVENTID "p_eventid"
@@ -166,7 +166,17 @@
#define ZBX_PROTO_TAG_EXPRESSIONS "expressions"
#define ZBX_PROTO_TAG_EXPRESSION "expression"
#define ZBX_PROTO_TAG_CLIENTIP "clientip"
+#define ZBX_PROTO_TAG_ITEM_TAGS "item_tags"
#define ZBX_PROTO_TAG_PROXY_UPLOAD "upload"
+#define ZBX_PROTO_TAG_DASHBOARDID "dashboardid"
+#define ZBX_PROTO_TAG_USERID "userid"
+#define ZBX_PROTO_TAG_PERIOD "period"
+#define ZBX_PROTO_TAG_NOW "now"
+#define ZBX_PROTO_TAG_SESSIONID "sessionid"
+#define ZBX_PROTO_TAG_SIGN "sign"
+#define ZBX_PROTO_TAG_DETAIL "detail"
+#define ZBX_PROTO_TAG_RECIPIENT "recipient"
+#define ZBX_PROTO_TAG_RECIPIENTS "recipients"
#define ZBX_PROTO_VALUE_FAILED "failed"
#define ZBX_PROTO_VALUE_SUCCESS "success"
@@ -202,6 +212,8 @@
#define ZBX_PROTO_VALUE_PROXY_UPLOAD_ENABLED "enabled"
#define ZBX_PROTO_VALUE_PROXY_UPLOAD_DISABLED "disabled"
+#define ZBX_PROTO_VALUE_REPORT_TEST "report.test"
+
typedef enum
{
ZBX_JSON_TYPE_UNKNOWN = 0,
diff --git a/include/zbxlld.h b/include/zbxlld.h
index 6df122d99ed..f4e3068bfe9 100644
--- a/include/zbxlld.h
+++ b/include/zbxlld.h
@@ -23,10 +23,10 @@
#include "common.h"
#include "zbxalgo.h"
-void zbx_lld_process_value(zbx_uint64_t itemid, const char *value, const zbx_timespec_t *ts, unsigned char meta,
+void zbx_lld_process_value(zbx_uint64_t itemid, zbx_uint64_t hostid, const char *value, const zbx_timespec_t *ts, unsigned char meta,
zbx_uint64_t lastlogsize, int mtime, const char *error);
-void zbx_lld_process_agent_result(zbx_uint64_t itemid, AGENT_RESULT *result, zbx_timespec_t *ts, char *error);
+void zbx_lld_process_agent_result(zbx_uint64_t itemid, zbx_uint64_t hostid, AGENT_RESULT *result, zbx_timespec_t *ts, char *error);
int zbx_lld_get_queue_size(zbx_uint64_t *size, char **error);
diff --git a/include/zbxmedia.h b/include/zbxmedia.h
index 763e457d3c7..b8a7d698088 100644
--- a/include/zbxmedia.h
+++ b/include/zbxmedia.h
@@ -24,6 +24,7 @@
#define ZBX_MEDIA_CONTENT_TYPE_TEXT 0
#define ZBX_MEDIA_CONTENT_TYPE_HTML 1
+#define ZBX_MEDIA_CONTENT_TYPE_MULTI 2 /* multipart/mixed message with pre-formatted message body */
extern char *CONFIG_SOURCE_IP;
@@ -41,4 +42,7 @@ int send_email(const char *smtp_server, unsigned short smtp_port, const char *sm
unsigned char content_type, int timeout, char *error, size_t max_error_len);
int send_sms(const char *device, const char *number, const char *message, char *error, int max_error_len);
+char *zbx_email_make_body(const char *message, unsigned char content_type, const char *attachment_name,
+ const char *attachment_type, const char *attachment, size_t attachment_size);
+
#endif
diff --git a/include/zbxprometheus.h b/include/zbxprometheus.h
index 698b44be2da..74eaf6efb07 100644
--- a/include/zbxprometheus.h
+++ b/include/zbxprometheus.h
@@ -17,8 +17,8 @@
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
**/
-#ifndef __zbxprometheus_h__
-#define __zbxprometheus_h__
+#ifndef ZABBIX_ZBXPROMETHEUS_H
+#define ZABBIX_ZBXPROMETHEUS_H
int zbx_prometheus_pattern(const char *data, const char *filter_data, const char *output, char **value,
char **error);
@@ -27,4 +27,4 @@ int zbx_prometheus_to_json(const char *data, const char *filter_data, char **val
int zbx_prometheus_validate_filter(const char *pattern, char **error);
int zbx_prometheus_validate_label(const char *label);
-#endif /* __zbxprometheus_h__ */
+#endif
diff --git a/include/zbxreport.h b/include/zbxreport.h
new file mode 100644
index 00000000000..8631e3d5083
--- /dev/null
+++ b/include/zbxreport.h
@@ -0,0 +1,34 @@
+/*
+** Zabbix
+** Copyright (C) 2001-2021 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_ZBXREPORT_H
+#define ZABBIX_ZBXREPORT_H
+
+#include "zbxjson.h"
+
+#define ZBX_REPORT_STATUS_ENABLED 0
+#define ZBX_REPORT_STATUS_DISABLED 1
+
+#define ZBX_REPORT_PERIOD_DAY 0
+#define ZBX_REPORT_PERIOD_WEEK 0
+#define ZBX_REPORT_PERIOD_MONTH 0
+#define ZBX_REPORT_PERIOD_YEAR 0
+
+void zbx_report_test(const struct zbx_json_parse *jp, zbx_uint64_t userid, struct zbx_json *j);
+
+#endif
diff --git a/include/zbxserialize.h b/include/zbxserialize.h
index 8afc9787be5..77790a312f6 100644
--- a/include/zbxserialize.h
+++ b/include/zbxserialize.h
@@ -22,16 +22,16 @@
#include "common.h"
-#define zbx_serialize_prepare_str(len, str) \
- str##_len = (NULL != str ? strlen(str) + 1 : 0); \
+#define zbx_serialize_prepare_str(len, str) \
+ str##_len = (NULL != str ? (zbx_uint32_t)strlen(str) + 1 : 0); \
len += str##_len + sizeof(zbx_uint32_t)
-#define zbx_serialize_prepare_str_len(len, str, str_len) \
- str_len = (NULL != str ? strlen(str) + 1 : 0); \
+#define zbx_serialize_prepare_str_len(len, str, str_len) \
+ str_len = (NULL != str ? (zbx_uint32_t)strlen(str) + 1 : 0); \
len += str_len + sizeof(zbx_uint32_t)
#define zbx_serialize_prepare_value(len, value) \
- len += sizeof(value)
+ len += (zbx_uint32_t)sizeof(value)
#define zbx_serialize_uint64(buffer, value) (memcpy(buffer, &value, sizeof(zbx_uint64_t)), sizeof(zbx_uint64_t))
diff --git a/include/zbxserver.h b/include/zbxserver.h
index 33e350977e9..dd8ae3f6503 100644
--- a/include/zbxserver.h
+++ b/include/zbxserver.h
@@ -51,6 +51,9 @@
#define MACRO_TYPE_EVENT_NAME 0x02000000 /* event name in trigger configuration */
#define MACRO_TYPE_EXPRESSION 0x04000000 /* macros in expression macro */
#define MACRO_TYPE_SCRIPT_PARAMS_FIELD 0x08000000
+#define MACRO_TYPE_SCRIPT_NORMAL 0x10000000
+#define MACRO_TYPE_SCRIPT_RECOVERY 0x20000000
+#define MACRO_TYPE_REPORT 0x40000000
#define MACRO_EXPAND_NO 0
#define MACRO_EXPAND_YES 1
@@ -63,15 +66,15 @@ void get_functionids(zbx_vector_uint64_t *functionids, const char *expression);
int evaluate_function(char **value, DC_ITEM *item, const char *function, const char *parameter,
const zbx_timespec_t *ts, char **error);
-int substitute_simple_macros(zbx_uint64_t *actionid, const DB_EVENT *event, const DB_EVENT *r_event,
- zbx_uint64_t *userid, const zbx_uint64_t *hostid, const DC_HOST *dc_host, const DC_ITEM *dc_item,
- DB_ALERT *alert, const DB_ACKNOWLEDGE *ack, const char *tz, char **data, int macro_type, char *error,
- int maxerrlen);
+int substitute_simple_macros(const zbx_uint64_t *actionid, const DB_EVENT *event, const DB_EVENT *r_event,
+ const zbx_uint64_t *userid, const zbx_uint64_t *hostid, const DC_HOST *dc_host, const DC_ITEM *dc_item,
+ const DB_ALERT *alert, const DB_ACKNOWLEDGE *ack, const char *tz, char **data, int macro_type,
+ char *error, int maxerrlen);
-int substitute_simple_macros_unmasked(zbx_uint64_t *actionid, const DB_EVENT *event, const DB_EVENT *r_event,
- zbx_uint64_t *userid, const zbx_uint64_t *hostid, const DC_HOST *dc_host, const DC_ITEM *dc_item,
- DB_ALERT *alert, const DB_ACKNOWLEDGE *ack, const char *tz, char **data, int macro_type, char *error,
- int maxerrlen);
+int substitute_simple_macros_unmasked(const zbx_uint64_t *actionid, const DB_EVENT *event, const DB_EVENT *r_event,
+ const zbx_uint64_t *userid, const zbx_uint64_t *hostid, const DC_HOST *dc_host, const DC_ITEM *dc_item,
+ const DB_ALERT *alert, const DB_ACKNOWLEDGE *ack, const char *tz, char **data, int macro_type,
+ char *error, int maxerrlen);
void evaluate_expressions(zbx_vector_ptr_t *triggers);
diff --git a/include/zbxtypes.h b/include/zbxtypes.h
index 42c55a17800..5182e11e675 100644
--- a/include/zbxtypes.h
+++ b/include/zbxtypes.h
@@ -214,7 +214,7 @@ zbx_uint128_t;
/* macro to test if a signed value has been assigned to unsigned type (char, short, int, long long) */
#define ZBX_IS_TOP_BIT_SET(x) (0 != ((__UINT64_C(1) << ((sizeof(x) << 3) - 1)) & (x)))
-#if defined(_WINDOWS)
+#if defined(_WINDOWS) || defined(__MINGW32__)
#define localtime_r(x, y) localtime_s(y, x)
#endif