Source
if (SUCCEED != zbx_tcp_send_ext(sock, *buffer, buffer_size, reserved, ZBX_TCP_PROTOCOL | ZBX_TCP_COMPRESS, 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.
**/
extern unsigned int configured_tls_connect_mode;
extern char *CONFIG_TLS_SERVER_CERT_ISSUER;
extern char *CONFIG_TLS_SERVER_CERT_SUBJECT;
extern char *CONFIG_TLS_PSK_IDENTITY;
int connect_to_server(zbx_socket_t *sock, int timeout, int retry_interval)
{
int res, lastlogtime, now;
char *tls_arg1, *tls_arg2;
zabbix_log(LOG_LEVEL_DEBUG, "In connect_to_server() [%s]:%d [timeout:%d]",
CONFIG_SERVER, CONFIG_SERVER_PORT, timeout);
switch (configured_tls_connect_mode)
{
case ZBX_TCP_SEC_UNENCRYPTED:
tls_arg1 = NULL;
tls_arg2 = NULL;
break;
case ZBX_TCP_SEC_TLS_CERT:
tls_arg1 = CONFIG_TLS_SERVER_CERT_ISSUER;
tls_arg2 = CONFIG_TLS_SERVER_CERT_SUBJECT;
break;
case ZBX_TCP_SEC_TLS_PSK:
tls_arg1 = CONFIG_TLS_PSK_IDENTITY;
tls_arg2 = NULL; /* zbx_tls_connect() will find PSK */
break;
default:
THIS_SHOULD_NEVER_HAPPEN;
return FAIL;
}