12ee81decSopenharmony_ci/*
22ee81decSopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd.
32ee81decSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
42ee81decSopenharmony_ci * you may not use this file except in compliance with the License.
52ee81decSopenharmony_ci * You may obtain a copy of the License at
62ee81decSopenharmony_ci *
72ee81decSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0
82ee81decSopenharmony_ci *
92ee81decSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
102ee81decSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
112ee81decSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
122ee81decSopenharmony_ci * See the License for the specific language governing permissions and
132ee81decSopenharmony_ci * limitations under the License.
142ee81decSopenharmony_ci */
152ee81decSopenharmony_ci
162ee81decSopenharmony_ci#ifndef SEC_UTILS_JSON_H
172ee81decSopenharmony_ci#define SEC_UTILS_JSON_H
182ee81decSopenharmony_ci
192ee81decSopenharmony_ci#include <stdbool.h>
202ee81decSopenharmony_ci#include <stdint.h>
212ee81decSopenharmony_ci
222ee81decSopenharmony_ci#ifdef __cplusplus
232ee81decSopenharmony_ciextern "C" {
242ee81decSopenharmony_ci#endif
252ee81decSopenharmony_ci
262ee81decSopenharmony_citypedef void *DslmJsonHandle;
272ee81decSopenharmony_ci
282ee81decSopenharmony_ciDslmJsonHandle DslmCreateJson(const char *data);
292ee81decSopenharmony_civoid DslmDestroyJson(DslmJsonHandle handle);
302ee81decSopenharmony_ci
312ee81decSopenharmony_ciint32_t DslmGetJsonFieldInt(DslmJsonHandle handle, const char *field);
322ee81decSopenharmony_ciuint32_t DslmGetJsonFieldIntArray(DslmJsonHandle handle, const char *field, int32_t *array, int32_t arrayLen);
332ee81decSopenharmony_ciconst char *DslmGetJsonFieldString(DslmJsonHandle handle, const char *field);
342ee81decSopenharmony_ciDslmJsonHandle DslmGetJsonFieldJson(DslmJsonHandle handle, const char *field);
352ee81decSopenharmony_ci
362ee81decSopenharmony_ciDslmJsonHandle DslmGetJsonFieldJsonArray(DslmJsonHandle handle, uint32_t num);
372ee81decSopenharmony_ciint32_t DslmGetJsonFieldJsonArraySize(DslmJsonHandle handle);
382ee81decSopenharmony_ci
392ee81decSopenharmony_civoid DslmAddFieldIntToJson(DslmJsonHandle handle, const char *field, int32_t value);
402ee81decSopenharmony_civoid DslmAddFieldIntArrayToJson(DslmJsonHandle handle, const char *field, const int32_t *array, int32_t arrayLen);
412ee81decSopenharmony_civoid DslmAddFieldBoolToJson(DslmJsonHandle handle, const char *field, bool value);
422ee81decSopenharmony_civoid DslmAddFieldStringToJson(DslmJsonHandle handle, const char *field, const char *value);
432ee81decSopenharmony_civoid DslmAddFieldJsonToJson(DslmJsonHandle handle, const char *field, DslmJsonHandle json);
442ee81decSopenharmony_ci
452ee81decSopenharmony_cichar *DslmConvertJsonToString(DslmJsonHandle handle);
462ee81decSopenharmony_ci
472ee81decSopenharmony_cibool DslmCompareJsonData(DslmJsonHandle handleA, DslmJsonHandle handleB, bool caseSensitive);
482ee81decSopenharmony_ci
492ee81decSopenharmony_ci#ifdef __cplusplus
502ee81decSopenharmony_ci}
512ee81decSopenharmony_ci#endif
522ee81decSopenharmony_ci
532ee81decSopenharmony_ci#endif // SEC_UTILS_JSON_H