/*1* Copyright (c) 2014-2020 Pavel Kalvoda <[email protected]>2*3* libcbor is free software; you can redistribute it and/or modify4* it under the terms of the MIT license. See LICENSE for details.5*/67#ifndef LIBCBOR_H_8#define LIBCBOR_H_910#include "cbor/common.h"11#include "cbor/data.h"1213#include "cbor/arrays.h"14#include "cbor/bytestrings.h"15#include "cbor/floats_ctrls.h"16#include "cbor/ints.h"17#include "cbor/maps.h"18#include "cbor/strings.h"19#include "cbor/tags.h"2021#include "cbor/callbacks.h"22#include "cbor/cbor_export.h"23#include "cbor/encoding.h"24#include "cbor/serialization.h"25#include "cbor/streaming.h"2627#ifdef __cplusplus28extern "C" {29#endif3031/*32* ============================================================================33* High level decoding34* ============================================================================35*/3637/** Loads data item from a buffer38*39* @param source The buffer40* @param source_size41* @param[out] result Result indicator. #CBOR_ERR_NONE on success42* @return Decoded CBOR item. The item's reference count is initialized to one.43* @return `NULL` on failure. In that case, \p result contains the location and44* description of the error.45*/46_CBOR_NODISCARD CBOR_EXPORT cbor_item_t* cbor_load(47cbor_data source, size_t source_size, struct cbor_load_result* result);4849/** Take a deep copy of an item50*51* All items this item points to (array and map members, string chunks, tagged52* items) will be copied recursively using #cbor_copy. The new item doesn't53* alias or point to any items from the original \p item. All the reference54* counts in the new structure are set to one.55*56* @param item item to copy57* @return Reference to the new item. The item's reference count is initialized58* to one.59* @return `NULL` if memory allocation fails60*/61_CBOR_NODISCARD CBOR_EXPORT cbor_item_t* cbor_copy(cbor_item_t* item);6263#if CBOR_PRETTY_PRINTER64#include <stdio.h>6566CBOR_EXPORT void cbor_describe(cbor_item_t* item, FILE* out);67#endif6869#ifdef __cplusplus70}71#endif7273#endif // LIBCBOR_H_747576