1*bb154e3eSDorjoy Chowdhury /* 2*bb154e3eSDorjoy Chowdhury * QEMU CBOR helpers 3*bb154e3eSDorjoy Chowdhury * 4*bb154e3eSDorjoy Chowdhury * Copyright (c) 2024 Dorjoy Chowdhury <dorjoychy111@gmail.com> 5*bb154e3eSDorjoy Chowdhury * 6*bb154e3eSDorjoy Chowdhury * This work is licensed under the terms of the GNU GPL, version 2 or 7*bb154e3eSDorjoy Chowdhury * (at your option) any later version. See the COPYING file in the 8*bb154e3eSDorjoy Chowdhury * top-level directory. 9*bb154e3eSDorjoy Chowdhury */ 10*bb154e3eSDorjoy Chowdhury 11*bb154e3eSDorjoy Chowdhury #ifndef QEMU_VIRTIO_CBOR_HELPERS_H 12*bb154e3eSDorjoy Chowdhury #define QEMU_VIRTIO_CBOR_HELPERS_H 13*bb154e3eSDorjoy Chowdhury 14*bb154e3eSDorjoy Chowdhury #include <cbor.h> 15*bb154e3eSDorjoy Chowdhury 16*bb154e3eSDorjoy Chowdhury bool qemu_cbor_map_add(cbor_item_t *map, cbor_item_t *key, cbor_item_t *value); 17*bb154e3eSDorjoy Chowdhury 18*bb154e3eSDorjoy Chowdhury bool qemu_cbor_array_push(cbor_item_t *array, cbor_item_t *value); 19*bb154e3eSDorjoy Chowdhury 20*bb154e3eSDorjoy Chowdhury bool qemu_cbor_add_bool_to_map(cbor_item_t *map, const char *key, bool value); 21*bb154e3eSDorjoy Chowdhury 22*bb154e3eSDorjoy Chowdhury bool qemu_cbor_add_uint8_to_map(cbor_item_t *map, const char *key, 23*bb154e3eSDorjoy Chowdhury uint8_t value); 24*bb154e3eSDorjoy Chowdhury 25*bb154e3eSDorjoy Chowdhury bool qemu_cbor_add_map_to_map(cbor_item_t *map, const char *key, 26*bb154e3eSDorjoy Chowdhury size_t nested_map_size, 27*bb154e3eSDorjoy Chowdhury cbor_item_t **nested_map); 28*bb154e3eSDorjoy Chowdhury 29*bb154e3eSDorjoy Chowdhury bool qemu_cbor_add_bytestring_to_map(cbor_item_t *map, const char *key, 30*bb154e3eSDorjoy Chowdhury uint8_t *arr, size_t len); 31*bb154e3eSDorjoy Chowdhury 32*bb154e3eSDorjoy Chowdhury bool qemu_cbor_add_null_to_map(cbor_item_t *map, const char *key); 33*bb154e3eSDorjoy Chowdhury 34*bb154e3eSDorjoy Chowdhury bool qemu_cbor_add_string_to_map(cbor_item_t *map, const char *key, 35*bb154e3eSDorjoy Chowdhury const char *value); 36*bb154e3eSDorjoy Chowdhury 37*bb154e3eSDorjoy Chowdhury bool qemu_cbor_add_uint8_array_to_map(cbor_item_t *map, const char *key, 38*bb154e3eSDorjoy Chowdhury uint8_t *arr, size_t len); 39*bb154e3eSDorjoy Chowdhury 40*bb154e3eSDorjoy Chowdhury bool qemu_cbor_add_uint8_key_bytestring_to_map(cbor_item_t *map, uint8_t key, 41*bb154e3eSDorjoy Chowdhury uint8_t *buf, size_t len); 42*bb154e3eSDorjoy Chowdhury 43*bb154e3eSDorjoy Chowdhury bool qemu_cbor_add_uint64_to_map(cbor_item_t *map, const char *key, 44*bb154e3eSDorjoy Chowdhury uint64_t value); 45*bb154e3eSDorjoy Chowdhury #endif 46