Source
static void zbx_lld_deserialize_diag_stats(const unsigned char *data, zbx_uint64_t *items_num, zbx_uint64_t *values_num)
/*
** Zabbix
** Copyright (C) 2001-2022 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.
**/
/******************************************************************************
* *
* Function: zbx_lld_serialize_item_value *
* *
******************************************************************************/
zbx_uint32_t zbx_lld_serialize_item_value(unsigned char **data, zbx_uint64_t itemid, zbx_uint64_t hostid,
const char *value, const zbx_timespec_t *ts, unsigned char meta, zbx_uint64_t lastlogsize, int mtime,
const char *error)
{
unsigned char *ptr;
zbx_uint32_t data_len = 0, value_len, error_len;
zbx_serialize_prepare_value(data_len, itemid);
zbx_serialize_prepare_value(data_len, hostid);
zbx_serialize_prepare_str(data_len, value);
zbx_serialize_prepare_value(data_len, *ts);
zbx_serialize_prepare_str(data_len, error);
zbx_serialize_prepare_value(data_len, meta);
if (0 != meta)
{
zbx_serialize_prepare_value(data_len, lastlogsize);
zbx_serialize_prepare_value(data_len, mtime);
}
*data = (unsigned char *)zbx_malloc(NULL, data_len);
ptr = *data;
ptr += zbx_serialize_value(ptr, itemid);
ptr += zbx_serialize_value(ptr, hostid);
ptr += zbx_serialize_str(ptr, value, value_len);
ptr += zbx_serialize_value(ptr, *ts);
ptr += zbx_serialize_str(ptr, error, error_len);
ptr += zbx_serialize_value(ptr, meta);
if (0 != meta)