Source
/*
** Zabbix
** Copyright (C) 2001-2023 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.
**/
void zbx_event_severity_free(zbx_event_severity_t *event_severity)
{
zbx_free(event_severity);
}
ZBX_PTR_VECTOR_IMPL(service, zbx_db_service *)
ZBX_PTR_VECTOR_IMPL(event_severity_ptr, zbx_event_severity_t *)
void zbx_service_flush(zbx_uint32_t code, unsigned char *data, zbx_uint32_t size)
{
static zbx_ipc_socket_t socket;
/* each process has a permanent connection to service manager */
if (FAIL == zbx_ipc_socket_connected(&socket))
{
char *error = NULL;
if (FAIL == zbx_ipc_socket_open(&socket, ZBX_IPC_SERVICE_SERVICE, SEC_PER_MIN, &error))
{
zabbix_log(LOG_LEVEL_CRIT, "cannot connect to service manager service: %s", error);
exit(EXIT_FAILURE);
}
}
if (FAIL == zbx_ipc_socket_write(&socket, code, data, size))
{
zabbix_log(LOG_LEVEL_CRIT, "cannot send data to service manager service");
exit(EXIT_FAILURE);
}
}
void zbx_service_send(zbx_uint32_t code, unsigned char *data, zbx_uint32_t size, zbx_ipc_message_t *response)
{
char *error = NULL;
static zbx_ipc_socket_t socket = {0};
/* each process has a permanent connection to service manager */
if (0 == socket.fd && FAIL == zbx_ipc_socket_open(&socket, ZBX_IPC_SERVICE_SERVICE, SEC_PER_MIN,
&error))
{