Source
static zbx_jsonpath_list_node_t *jsonpath_list_append_name(zbx_jsonpath_list_node_t *head, const char *name, size_t len)
/*
** 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/>.
**/
typedef struct
{
zbx_jsonpath_token_group_t group;
int precedence;
}
zbx_jsonpath_token_def_t;
typedef struct
{
zbx_jsonobj_t *obj;
char *path;
zbx_hashset_t index;
}
zbx_jsonobj_index_t;
ZBX_PTR_VECTOR_DECL(jsonobj_index_ptr, zbx_jsonobj_index_t *)
ZBX_PTR_VECTOR_IMPL(jsonobj_index_ptr, zbx_jsonobj_index_t *)
struct zbx_jsonpath_index
{
zbx_vector_jsonobj_index_ptr_t indexes;
pthread_mutex_t lock;
};
static zbx_hashset_t *jsonpath_index_get(zbx_jsonpath_index_t *index, zbx_jsonobj_t *obj,
zbx_jsonpath_token_t *token);
static int jsonpath_query_object(zbx_jsonpath_context_t *ctx, zbx_jsonobj_t *obj, int path_depth);
static int jsonpath_query_array(zbx_jsonpath_context_t *ctx, zbx_jsonobj_t *array, int path_depth);
static int jsonpath_str_copy_value(char **str, size_t *str_alloc, size_t *str_offset, zbx_jsonobj_t *obj);
static void jsonpath_ctx_clear(zbx_jsonpath_context_t *ctx);
/* define token groups and precedence */