1da0d961cSdjm /* 2d3425be1Sdjm * Copyright (c) 2014-2020 Pavel Kalvoda <me@pavelkalvoda.com> 3da0d961cSdjm * 4da0d961cSdjm * libcbor is free software; you can redistribute it and/or modify 5da0d961cSdjm * it under the terms of the MIT license. See LICENSE for details. 6da0d961cSdjm */ 7da0d961cSdjm 8da0d961cSdjm #ifndef LIBCBOR_STREAMING_H 9da0d961cSdjm #define LIBCBOR_STREAMING_H 10da0d961cSdjm 11da0d961cSdjm #include "callbacks.h" 12*4dcc46c4Sdjm #include "cbor/cbor_export.h" 139e5c2ddcSdjm #include "cbor/common.h" 14da0d961cSdjm 15da0d961cSdjm #ifdef __cplusplus 16da0d961cSdjm extern "C" { 17da0d961cSdjm #endif 18da0d961cSdjm 19da0d961cSdjm /** Stateless decoder 20da0d961cSdjm * 21*4dcc46c4Sdjm * Will try parsing the \p source and will invoke the appropriate callback on 229e5c2ddcSdjm * success. Decodes one item at a time. No memory allocations occur. 23da0d961cSdjm * 24*4dcc46c4Sdjm * @param source Input buffer 25*4dcc46c4Sdjm * @param source_size Length of the buffer 26da0d961cSdjm * @param callbacks The callback bundle 27da0d961cSdjm * @param context An arbitrary pointer to allow for maintaining context. 28da0d961cSdjm */ 29*4dcc46c4Sdjm _CBOR_NODISCARD CBOR_EXPORT struct cbor_decoder_result cbor_stream_decode( 30*4dcc46c4Sdjm cbor_data source, size_t source_size, 319e5c2ddcSdjm const struct cbor_callbacks* callbacks, void* context); 32da0d961cSdjm 33da0d961cSdjm #ifdef __cplusplus 34da0d961cSdjm } 35da0d961cSdjm #endif 36da0d961cSdjm 37da0d961cSdjm #endif // LIBCBOR_STREAMING_H 38