2014-04-22 14:22:39 -04:00
|
|
|
/*
|
|
|
|
* JSON Object API
|
2019-05-04 15:55:50 -04:00
|
|
|
*
|
2025-02-14 10:24:30 -05:00
|
|
|
* Copyright (C) 2014-2025 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
|
2019-05-04 15:55:50 -04:00
|
|
|
*
|
2014-04-22 14:22:39 -04:00
|
|
|
* Authors: Kevin Lin
|
2019-05-04 15:55:50 -04:00
|
|
|
*
|
2014-04-22 14:22:39 -04:00
|
|
|
* This program is free software; you can redistribute it and/or modify it under
|
|
|
|
* the terms of the GNU General Public License version 2 as published by the
|
|
|
|
* Free Software Foundation.
|
2019-05-04 15:55:50 -04:00
|
|
|
*
|
2014-04-22 14:22:39 -04:00
|
|
|
* 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.
|
2019-05-04 15:55:50 -04:00
|
|
|
*
|
2014-04-22 14:22:39 -04:00
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __JSON_C_H__
|
|
|
|
#define __JSON_C_H__
|
|
|
|
|
|
|
|
#if HAVE_CONFIG_H
|
|
|
|
#include "clamav-config.h"
|
|
|
|
#endif
|
|
|
|
|
2014-05-23 09:46:06 -04:00
|
|
|
#include "json.h"
|
2014-04-23 17:37:23 -04:00
|
|
|
|
2018-12-05 20:46:20 -05:00
|
|
|
#include "clamav-types.h"
|
2014-04-22 14:22:39 -04:00
|
|
|
#include "others.h"
|
|
|
|
|
2014-06-25 15:54:57 -04:00
|
|
|
#define JSON_TIMEOUT_SKIP_CYCLES 3
|
2014-06-25 13:08:18 -04:00
|
|
|
|
2019-05-04 15:55:50 -04:00
|
|
|
cl_error_t cli_json_timeout_cycle_check(cli_ctx *ctx, int *toval);
|
|
|
|
cl_error_t cli_json_parse_error(json_object *root, const char *errstr);
|
2014-06-25 13:08:18 -04:00
|
|
|
|
2019-05-04 15:55:50 -04:00
|
|
|
cl_error_t cli_jsonnull(json_object *obj, const char *key);
|
|
|
|
cl_error_t cli_jsonstr(json_object *obj, const char *key, const char *s);
|
|
|
|
cl_error_t cli_jsonstrlen(json_object *obj, const char *key, const char *s, int len);
|
|
|
|
cl_error_t cli_jsonint(json_object *obj, const char *key, int32_t i);
|
|
|
|
cl_error_t cli_jsonint64(json_object *obj, const char *key, int64_t i);
|
|
|
|
cl_error_t cli_jsonbool(json_object *obj, const char *key, int i);
|
|
|
|
cl_error_t cli_jsondouble(json_object *obj, const char *key, double d);
|
2016-05-10 18:43:42 -04:00
|
|
|
|
2014-06-13 20:39:52 -04:00
|
|
|
json_object *cli_jsonarray(json_object *obj, const char *key);
|
2019-05-04 15:55:50 -04:00
|
|
|
cl_error_t cli_jsonint_array(json_object *obj, int32_t val);
|
2014-06-13 20:39:52 -04:00
|
|
|
json_object *cli_jsonobj(json_object *obj, const char *key);
|
2019-05-04 15:55:50 -04:00
|
|
|
cl_error_t cli_json_delowner(json_object *owner, const char *key, int idx);
|
2018-12-03 12:40:13 -05:00
|
|
|
#define cli_json_delobj(obj) json_object_put(obj)
|
2014-04-29 15:39:06 -04:00
|
|
|
|
2018-12-03 12:40:13 -05:00
|
|
|
#define JSON_KEY_FILETYPE "FileType"
|
|
|
|
#define JSON_KEY_FILESIZE "FileSize"
|
2014-04-29 15:39:06 -04:00
|
|
|
|
2018-12-03 12:40:13 -05:00
|
|
|
#define JSON_VALUE_FILETYPE_PDF "CL_TYPE_PDF"
|
|
|
|
#define JSON_VALUE_FILETYPE_PPT "CL_TYPE_MSPPT"
|
|
|
|
#define JSON_VALUE_FILETYPE_WORD "CL_TYPE_WORD"
|
|
|
|
#define JSON_VALUE_FILETYPE_EXCEL "CL_TYPE_MSXLS"
|
2014-04-29 15:39:06 -04:00
|
|
|
|
2014-04-22 14:22:39 -04:00
|
|
|
#endif /*__JSON_C_H__*/
|