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