Source
xxxxxxxxxx
int zbx_ipc_async_socket_open(zbx_ipc_async_socket_t *asocket, const char *service_name, int timeout, char **error);
/*
** 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.
**/
typedef struct
{
/* the message code */
zbx_uint32_t code;
/* the data size */
zbx_uint32_t size;
/* the data */
unsigned char *data;
}
zbx_ipc_message_t;
/* Messaging socket, providing blocking connections to IPC service. */
/* The IPC socket api is used for simple write/read operations. */
typedef struct
{
/* socket descriptor */
int fd;
/* incoming data buffer */
unsigned char rx_buffer[ZBX_IPC_SOCKET_BUFFER_SIZE];
zbx_uint32_t rx_buffer_bytes;
zbx_uint32_t rx_buffer_offset;
}
zbx_ipc_socket_t;
typedef struct zbx_ipc_client zbx_ipc_client_t;
/* IPC service */
typedef struct
{
/* the listening socket descriptor */
int fd;
struct event_base *ev;
struct event *ev_listener;
struct event *ev_timer;
struct event *ev_alert;
/* the unix socket path */
char *path;
/* the connected clients */
zbx_vector_ptr_t clients;
/* the clients with messages */
zbx_queue_ptr_t clients_recv;
}
zbx_ipc_service_t;
typedef struct
{
zbx_ipc_client_t *client;
struct event_base *ev;
struct event *ev_timer;