diff options
author | Roberts Lataria <roberts.lataria@zabbix.com> | 2022-10-17 13:18:16 +0300 |
---|---|---|
committer | Roberts Lataria <roberts.lataria@zabbix.com> | 2022-10-17 13:18:16 +0300 |
commit | 838c91fbdf4eb34eb8ff9ca7f2c6dc646f830bf8 (patch) | |
tree | f092f94512bfcccddc633e9658845c62d05298f1 /include | |
parent | 0335581d224647243caa9449b955e877357e47f6 (diff) | |
parent | 09245945a158d13a306490816319afaabce75b2c (diff) |
.......... [ZBXNEXT-7972] merged from upstream; wihtout conflicts
Diffstat (limited to 'include')
-rw-r--r-- | include/zbx_rtc_constants.h | 51 | ||||
-rw-r--r-- | include/zbxcommon.h | 28 | ||||
-rw-r--r-- | include/zbxha.h | 2 | ||||
-rw-r--r-- | include/zbxrtc.h | 19 |
4 files changed, 67 insertions, 33 deletions
diff --git a/include/zbx_rtc_constants.h b/include/zbx_rtc_constants.h new file mode 100644 index 00000000000..9c9eec52a90 --- /dev/null +++ b/include/zbx_rtc_constants.h @@ -0,0 +1,51 @@ +/* +** 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_ZBX_RTC_CONSTANTS_H +#define ZABBIX_ZBX_RTC_CONSTANTS_H + +/* runtime control commands */ +#define ZBX_RTC_UNKNOWN 0 +#define ZBX_RTC_LOG_LEVEL_INCREASE 1 +#define ZBX_RTC_LOG_LEVEL_DECREASE 2 +#define ZBX_RTC_HOUSEKEEPER_EXECUTE 3 +#define ZBX_RTC_CONFIG_CACHE_RELOAD 8 +#define ZBX_RTC_SNMP_CACHE_RELOAD 9 +#define ZBX_RTC_DIAGINFO 10 +#define ZBX_RTC_SECRETS_RELOAD 11 +#define ZBX_RTC_SERVICE_CACHE_RELOAD 12 +#define ZBX_RTC_TRIGGER_HOUSEKEEPER_EXECUTE 13 +#define ZBX_RTC_HA_STATUS 14 +#define ZBX_RTC_HA_REMOVE_NODE 15 +#define ZBX_RTC_HA_SET_FAILOVER_DELAY 16 +#define ZBX_RTC_USER_PARAMETERS_RELOAD 17 +#define ZBX_RTC_PROXY_CONFIG_CACHE_RELOAD 18 +#define ZBX_RTC_PROXYPOLLER_PROCESS 19 + +/* internal rtc messages */ +#define ZBX_RTC_SUBSCRIBE 100 +#define ZBX_RTC_SHUTDOWN 101 +#define ZBX_RTC_CONFIG_CACHE_RELOAD_WAIT 102 + +/* runtime control notifications, must be less than 10000 */ +#define ZBX_RTC_CONFIG_SYNC_NOTIFY 9999 + +#define ZBX_IPC_RTC_MAX 9999 + +#endif diff --git a/include/zbxcommon.h b/include/zbxcommon.h index 3bf80590d4e..a950e280195 100644 --- a/include/zbxcommon.h +++ b/include/zbxcommon.h @@ -854,34 +854,6 @@ typedef enum } zbx_task_t; -/* runtime control commands */ -#define ZBX_RTC_UNKNOWN 0 -#define ZBX_RTC_LOG_LEVEL_INCREASE 1 -#define ZBX_RTC_LOG_LEVEL_DECREASE 2 -#define ZBX_RTC_HOUSEKEEPER_EXECUTE 3 -#define ZBX_RTC_CONFIG_CACHE_RELOAD 8 -#define ZBX_RTC_SNMP_CACHE_RELOAD 9 -#define ZBX_RTC_DIAGINFO 10 -#define ZBX_RTC_SECRETS_RELOAD 11 -#define ZBX_RTC_SERVICE_CACHE_RELOAD 12 -#define ZBX_RTC_TRIGGER_HOUSEKEEPER_EXECUTE 13 -#define ZBX_RTC_HA_STATUS 14 -#define ZBX_RTC_HA_REMOVE_NODE 15 -#define ZBX_RTC_HA_SET_FAILOVER_DELAY 16 -#define ZBX_RTC_USER_PARAMETERS_RELOAD 17 -#define ZBX_RTC_PROXY_CONFIG_CACHE_RELOAD 18 -#define ZBX_RTC_PROXYPOLLER_PROCESS 19 - -/* internal rtc messages */ -#define ZBX_RTC_SUBSCRIBE 100 -#define ZBX_RTC_SHUTDOWN 101 -#define ZBX_RTC_CONFIG_CACHE_RELOAD_WAIT 102 - -/* runtime control notifications, must be less than 10000 */ -#define ZBX_RTC_CONFIG_SYNC_NOTIFY 9999 - -#define ZBX_IPC_RTC_MAX 9999 - typedef enum { HTTPTEST_AUTH_NONE = 0, diff --git a/include/zbxha.h b/include/zbxha.h index ee1e36a76a1..c7d58ecb3dc 100644 --- a/include/zbxha.h +++ b/include/zbxha.h @@ -20,6 +20,8 @@ #ifndef ZABBIX_ZBXHA_H #define ZABBIX_ZBXHA_H +#include "zbx_rtc_constants.h" + #define ZBX_IPC_SERVICE_HA "haservice" #define ZBX_IPC_SERVICE_HA_PAUSE 1 diff --git a/include/zbxrtc.h b/include/zbxrtc.h index ab44c05d245..9670babbe4e 100644 --- a/include/zbxrtc.h +++ b/include/zbxrtc.h @@ -20,8 +20,11 @@ #ifndef ZABBIX_ZBXRTC_H #define ZABBIX_ZBXRTC_H +#include "zbxalgo.h" #include "zbxipcservice.h" +#define ZBX_IPC_SERVICE_RTC "rtc" + typedef struct { zbx_ipc_client_t *client; @@ -49,20 +52,26 @@ typedef struct } zbx_rtc_t; +typedef int (*zbx_rtc_process_request_ex_func_t)(zbx_rtc_t *, int, const unsigned char *, char **); + /* provider API */ int zbx_rtc_init(zbx_rtc_t *rtc ,char **error); -void zbx_rtc_dispatch(zbx_rtc_t *rtc, zbx_ipc_client_t *client, zbx_ipc_message_t *message); -int zbx_rtc_wait_config_sync(zbx_rtc_t *rtc); +void zbx_rtc_dispatch(zbx_rtc_t *rtc, zbx_ipc_client_t *client, zbx_ipc_message_t *message, + zbx_rtc_process_request_ex_func_t cb_proc_req); +int zbx_rtc_wait_config_sync(zbx_rtc_t *rtc, zbx_rtc_process_request_ex_func_t cb_proc_req); void zbx_rtc_shutdown_subs(zbx_rtc_t *rtc); -void zbx_rtc_reset(zbx_rtc_t *rtc); /* client API */ -int zbx_rtc_process(const char *option, char **error); -int zbx_rtc_open(zbx_ipc_async_socket_t *asocket, int timeout, char **error); void zbx_rtc_notify_config_sync(zbx_ipc_async_socket_t *rtc); void zbx_rtc_subscribe(zbx_ipc_async_socket_t *rtc, unsigned char proc_type, int proc_num); int zbx_rtc_wait(zbx_ipc_async_socket_t *rtc, zbx_uint32_t *cmd, unsigned char **data, int timeout); int zbx_rtc_reload_config_cache(char **error); +int zbx_rtc_parse_options(const char *opt, zbx_uint32_t *code, char **data, char **error); +void zbx_rtc_notify(zbx_rtc_t *rtc, unsigned char process_type, int process_num, zbx_uint32_t code, + const unsigned char *data, zbx_uint32_t size); + +int zbx_rtc_async_exchange(char **data, zbx_uint32_t code, char **error); + #endif |