1 /* 2 * Copyright (c) 2014-2020 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_BUILDER_CALLBACKS_H 9 #define LIBCBOR_BUILDER_CALLBACKS_H 10 11 #include "../callbacks.h" 12 #include "cbor/common.h" 13 #include "stack.h" 14 15 #ifdef __cplusplus 16 extern "C" { 17 #endif 18 19 /** High-level decoding context */ 20 struct _cbor_decoder_context { 21 /** Callback creating the last item has failed */ 22 bool creation_failed; 23 /** Stack expectation mismatch */ 24 bool syntax_error; 25 cbor_item_t *root; 26 struct _cbor_stack *stack; 27 }; 28 29 void cbor_builder_uint8_callback(void *, uint8_t); 30 31 void cbor_builder_uint16_callback(void *, uint16_t); 32 33 void cbor_builder_uint32_callback(void *, uint32_t); 34 35 void cbor_builder_uint64_callback(void *, uint64_t); 36 37 void cbor_builder_negint8_callback(void *, uint8_t); 38 39 void cbor_builder_negint16_callback(void *, uint16_t); 40 41 void cbor_builder_negint32_callback(void *, uint32_t); 42 43 void cbor_builder_negint64_callback(void *, uint64_t); 44 45 void cbor_builder_string_callback(void *, cbor_data, size_t); 46 47 void cbor_builder_string_start_callback(void *); 48 49 void cbor_builder_byte_string_callback(void *, cbor_data, size_t); 50 51 void cbor_builder_byte_string_start_callback(void *); 52 53 void cbor_builder_array_start_callback(void *, size_t); 54 55 void cbor_builder_indef_array_start_callback(void *); 56 57 void cbor_builder_map_start_callback(void *, size_t); 58 59 void cbor_builder_indef_map_start_callback(void *); 60 61 void cbor_builder_tag_callback(void *, uint64_t); 62 63 void cbor_builder_float2_callback(void *, float); 64 65 void cbor_builder_float4_callback(void *, float); 66 67 void cbor_builder_float8_callback(void *, double); 68 69 void cbor_builder_null_callback(void *); 70 71 void cbor_builder_undefined_callback(void *); 72 73 void cbor_builder_boolean_callback(void *, bool); 74 75 void cbor_builder_indef_break_callback(void *); 76 77 #ifdef __cplusplus 78 } 79 #endif 80 81 #endif // LIBCBOR_BUILDER_CALLBACKS_H 82