#include "proxyconfigread/proxyconfigread.h"
#include "trapper/trapper_server.h"
#include "cachehistory/cachehistory_server.h"
#include "discovery/discovery_server.h"
#include "autoreg/autoreg_server.h"
#include "zbxexpression.h"
#include "zbxcommshigh.h"
#include "zbx_rtc_constants.h"
#include "zbxcacheconfig.h"
#include "zbxipcservice.h"
static zbx_get_program_type_f zbx_get_program_type_cb = NULL;
static int connect_to_proxy(const zbx_dc_proxy_t *proxy, zbx_socket_t *sock, int timeout,
const char *config_source_ip)
const char *tls_arg1, *tls_arg2;
zabbix_log(LOG_LEVEL_DEBUG, "In %s() address:%s port:%hu timeout:%d conn:%u", __func__, proxy->addr,
proxy->port, timeout, (unsigned int)proxy->tls_connect);
switch (proxy->tls_connect)
case ZBX_TCP_SEC_UNENCRYPTED:
#if defined(HAVE_GNUTLS) || defined(HAVE_OPENSSL)
case ZBX_TCP_SEC_TLS_CERT:
tls_arg1 = proxy->tls_issuer;
tls_arg2 = proxy->tls_subject;
case ZBX_TCP_SEC_TLS_PSK:
tls_arg1 = proxy->tls_psk_identity;
tls_arg2 = proxy->tls_psk;
case ZBX_TCP_SEC_TLS_CERT:
case ZBX_TCP_SEC_TLS_PSK:
zabbix_log(LOG_LEVEL_ERR, "TLS connection is configured to be used with passive proxy \"%s\""
" but support for TLS was not compiled into %s.", proxy->name,
get_program_type_string(zbx_get_program_type_cb()));
THIS_SHOULD_NEVER_HAPPEN;
if (FAIL == (ret = zbx_tcp_connect(sock, config_source_ip, proxy->addr, proxy->port, timeout,
proxy->tls_connect, tls_arg1, tls_arg2)))
zabbix_log(LOG_LEVEL_ERR, "cannot connect to proxy \"%s\": %s", proxy->name, zbx_socket_strerror());
zabbix_log(LOG_LEVEL_DEBUG, "End of %s():%s", __func__, zbx_result_string(ret));