libcbor  0.5.0
libcbor is a C library for parsing and generating CBOR, the general-purpose schema-less binary data format.
bytestrings.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2017 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_BYTESTRINGS_H
9 #define LIBCBOR_BYTESTRINGS_H
10 
11 #include "cbor/common.h"
12 
13 #ifdef __cplusplus
14 extern "C" {
15 #endif
16 
17 /*
18 * ============================================================================
19 * Byte string manipulation
20 * ============================================================================
21 */
22 
30 size_t cbor_bytestring_length(const cbor_item_t *item);
31 
38 
45 
55 
63 
72 
78 size_t cbor_bytestring_chunk_count(const cbor_item_t *item);
79 
91 
99 
107 
116 cbor_item_t *cbor_build_bytestring(cbor_data handle, size_t length);
117 
118 #ifdef __cplusplus
119 }
120 #endif
121 
122 
123 #endif //LIBCBOR_BYTESTRINGS_H
cbor_item_t * cbor_build_bytestring(cbor_data handle, size_t length)
Creates a new byte string and initializes it.
Definition: bytestrings.c:63
bool cbor_bytestring_add_chunk(cbor_item_t *item, cbor_item_t *chunk)
Appends a chunk to the bytestring.
Definition: bytestrings.c:95
size_t cbor_bytestring_chunk_count(const cbor_item_t *item)
Get the number of chunks this string consist of.
Definition: bytestrings.c:87
bool cbor_bytestring_is_indefinite(const cbor_item_t *item)
Is the byte string indefinite?
Definition: bytestrings.c:30
#define CBOR_RESTRICT_POINTER
Definition: common.h:33
cbor_item_t * cbor_new_indefinite_bytestring()
Creates a new indefinite byte string.
Definition: bytestrings.c:46
unsigned char * cbor_mutable_data
Definition: data.h:21
void cbor_bytestring_set_handle(cbor_item_t *item, cbor_mutable_data CBOR_RESTRICT_POINTER data, size_t length)
Set the handle to the binary data.
Definition: bytestrings.c:72
const unsigned char * cbor_data
Definition: data.h:20
bool cbor_bytestring_is_definite(const cbor_item_t *item)
Is the byte string definite?
Definition: bytestrings.c:24
cbor_item_t ** cbor_bytestring_chunks_handle(const cbor_item_t *item)
Get the handle to the array of chunks.
Definition: bytestrings.c:80
size_t cbor_bytestring_length(const cbor_item_t *item)
Returns the length of the binary data.
Definition: bytestrings.c:12
cbor_item_t * cbor_new_definite_bytestring()
Creates a new definite byte string.
Definition: bytestrings.c:35
The item handle.
Definition: data.h:149
cbor_mutable_data cbor_bytestring_handle(const cbor_item_t *item)
Get the handle to the binary data.
Definition: bytestrings.c:18