Source
static void json_add_string_with_limit(struct zbx_json *j, const char *tag, const char *value, zbx_json_type_t type)
/*
** 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/>.
**/
/******************************************************************************
* *
* Purpose: parses preprocessing test request *
* *
* Parameters: jp_item - [IN] item object of request *
* jp_options - [IN] options object of request *
* jp_steps - [IN] steps object of request *
* value - [IN] item value for preprocessing *
* value_size - [IN] size of item value for preprocessing *
* state - [IN] item state *
* values - [OUT] values to test optional *
* (history + current) *
* ts - [OUT] value timestamps *
* values_num - [OUT] *
* value_type - [OUT] *
* steps - [OUT] preprocessing steps *
* single - [OUT] is preproc step single *
* bypass_first - [OUT] flag to bypass first step *
* error - [OUT] error message *
* *
* Return value: SUCCEED - request was parsed successfully *
* FAIL - otherwise *
* *
******************************************************************************/
static int trapper_parse_preproc_test(const struct zbx_json_parse *jp_item,
const struct zbx_json_parse *jp_options, const struct zbx_json_parse *jp_steps, char *value,
size_t value_size, int state, char **values, zbx_timespec_t *ts, int *values_num,
unsigned char *value_type, zbx_vector_pp_step_ptr_t *steps, int *single, int *bypass_first,
char **error)
{
char buffer[MAX_STRING_LEN], *step_params = NULL, *error_handler_params = NULL;
const char *ptr;
int ret = FAIL;
struct zbx_json_parse jp_history, jp_step;
size_t size;
zbx_timespec_t ts_now;
if (FAIL == zbx_json_value_by_name(jp_item, ZBX_PROTO_TAG_VALUE_TYPE, buffer, sizeof(buffer), NULL))
{
*error = zbx_strdup(NULL, "Missing value type field.");
goto out;
}