Source
/*
** Copyright (C) 2001-2025 Zabbix SIA
**
** This program is free software: you can redistribute it and/or modify it under the terms of
** the GNU Affero General Public License as published by the Free Software Foundation, version 3.
**
** 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 Affero General Public License for more details.
**
** You should have received a copy of the GNU Affero General Public License along with this program.
** If not, see <https://www.gnu.org/licenses/>.
**/
static const char *get_tcpsvc_step_string(zbx_zabbix_tcpsvc_step_t step)
{
switch (step)
{
case ZABBIX_TCPSVC_STEP_CONNECT_INIT:
return "init";
case ZABBIX_TCPSVC_STEP_CONNECT_WAIT:
return "connect";
case ZABBIX_TCPSVC_STEP_SEND:
return "send";
case ZABBIX_TCPSVC_STEP_RECV:
return "receive";
default:
return "unknown";
}
}
static int tcpsvc_send_context_init(const unsigned char svc_type, unsigned char flags,
zbx_tcp_send_context_t *context, AGENT_RESULT *result)
{
memset(context, 0, sizeof(zbx_tcp_send_context_t));
switch (svc_type)
{
case SVC_SMTP:
case SVC_FTP:
case SVC_POP:
case SVC_NNTP:
context->data = "QUIT\r\n";
break;
case SVC_IMAP:
context->data = "a1 LOGOUT\r\n";
break;
case SVC_SSH:
case SVC_HTTP:
case SVC_TCP:
break;
default:
SET_MSG_RESULT(result, zbx_dsprintf(NULL, "Error of unknown service:%u", svc_type));
return FAIL;
}