Source
zbx_pp_task_t *pp_task_value_seq_create(zbx_uint64_t itemid, zbx_pp_item_preproc_t *preproc, zbx_variant_t *value,
/*
** 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.
**/
ZBX_PTR_VECTOR_IMPL(pp_task_ptr, zbx_pp_task_t *)
void pp_task_free(zbx_pp_task_t *task);
/******************************************************************************
* *
* Purpose: create task *
* *
* Parameters: size - [IN] the task data size *
* *
* Return value: The created task. *
* *
******************************************************************************/
static zbx_pp_task_t *pp_task_create(size_t size)
{
zbx_pp_task_t *task;
task = (zbx_pp_task_t *)zbx_malloc(NULL, offsetof(zbx_pp_task_t, data) + size);
return task;
}
/******************************************************************************
* *
* Purpose: create preprocessing test task *
* *
* Parameters: preproc - [IN] the item preprocessing data *
* value - [IN] the value to preprocess, its contents will be *
* directly copied over and cleared by the task *
* (optional) *
* ts - [IN] the value timestamp *
* client - [IN] the request source *
* *
* Return value: The created task. *
* *
******************************************************************************/
zbx_pp_task_t *pp_task_test_create(zbx_pp_item_preproc_t *preproc, zbx_variant_t *value, zbx_timespec_t ts,
zbx_ipc_client_t *client)
{
zbx_pp_task_t *task = pp_task_create(sizeof(zbx_pp_task_test_t));
zbx_pp_task_test_t *d = (zbx_pp_task_test_t *)PP_TASK_DATA(task);
task->itemid = 0;
task->type = ZBX_PP_TASK_TEST;
d->value = *value;
d->ts = ts;
d->results = NULL;
d->results_num = 0;
zbx_variant_set_none(&d->result);
d->preproc = pp_item_preproc_copy(preproc);
d->client = client;
zbx_ipc_client_addref(client);
return task;
}
/******************************************************************************