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/>.
**/
ZBX_PTR_VECTOR_IMPL(pp_task_ptr, zbx_pp_task_t *)
/******************************************************************************
* *
* Purpose: create task *
* *
* Parameters: size - [IN] task data size *
* *
* Return value: The created task. *
* *
******************************************************************************/
static zbx_pp_task_t *pp_task_create(size_t size)
{
return (zbx_pp_task_t *)zbx_malloc(NULL, offsetof(zbx_pp_task_t, data) + size);
}
/******************************************************************************
* *
* Purpose: create preprocessing test task *
* *
* Parameters: preproc - [IN] item preprocessing data *
* value - [IN] value to preprocess, its contents will be *
* directly copied over and cleared by the task *
* (optional) *
* ts - [IN] value timestamp *
* client - [IN] 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;