Name Date Size #Lines LOC

..--

demo/H09-Jul-2024-145

doc/H09-Jul-2024-2,2501,451

docs/H09-Jul-2024-41,04536,521

examples/H09-Jul-2024-409276

misc/H09-Jul-2024-4822

oss-fuzz/H09-Jul-2024-6739

src/H09-Jul-2024-5,8343,561

test/H09-Jul-2024-4,2853,318

.clang-formatH A D09-Jul-20244 KiB152150

.travis-qemu.shH A D09-Jul-20243.9 KiB13891

.travis.ymlH A D09-Jul-20241.5 KiB6144

CHANGELOG.mdH A D09-Jul-20242.7 KiB7563

CMakeLists.txtH A D09-Jul-20244.6 KiB134104

CNAMEH A D09-Jul-202411 11

DoxyfileH A D09-Jul-2024103.4 KiB2,4181,869

LICENSE.mdH A D09-Jul-20241 KiB2217

README.mdH A D09-Jul-20243.5 KiB11487

appveyor.ymlH A D09-Jul-2024639 2715

clang-format.shH A D09-Jul-2024290 115

cppcheck_suppressions.txtH A D09-Jul-2024112 54

refresh_templates.shH A D09-Jul-2024187 53

release.shH A D09-Jul-20241.9 KiB8862

README.md

1# [libcbor](https://github.com/PJK/libcbor)
2
3[![Build Status](https://travis-ci.org/PJK/libcbor.svg?branch=master)](https://travis-ci.org/PJK/libcbor)
4[![Build status](https://ci.appveyor.com/api/projects/status/8kkmvmefelsxp5u2?svg=true)](https://ci.appveyor.com/project/PJK/libcbor)
5[![Documentation Status](https://readthedocs.org/projects/libcbor/badge/?version=latest)](https://readthedocs.org/projects/libcbor/?badge=latest)
6
7**libcbor** is a C library for parsing and generating [CBOR](http://tools.ietf.org/html/rfc7049), the general-purpose schema-less binary data format.
8
9## Main features
10 - Complete RFC conformance
11 - Robust C99 implementation
12 - Layered architecture offers both control and convenience
13 - Flexible memory management
14 - No shared global state - threading friendly
15 - Proper handling of UTF-8
16 - Full support for streams & incremental processing
17 - Extensive documentation and test suite
18 - No runtime dependencies, small footprint
19
20## Getting started
21
22### Compile from source
23
24```bash
25git clone https://github.com/PJK/libcbor
26cmake -DCMAKE_BUILD_TYPE=Release -DCBOR_CUSTOM_ALLOC=ON libcbor
27make
28make install
29```
30
31### Homebrew
32
33```bash
34brew tap pjk/libcbor
35brew install libcbor
36```
37
38### Ubuntu 18.04 and above
39
40```bash
41sudo add-apt-repository universe
42sudo apt-get install libcbor-dev
43```
44
45### Fedora & RPM friends
46
47```bash
48yum install libcbor-devel
49```
50
51## Usage example
52
53```c
54#include <cbor.h>
55#include <stdio.h>
56
57int main(int argc, char * argv[])
58{
59	/* Preallocate the map structure */
60	cbor_item_t * root = cbor_new_definite_map(2);
61	/* Add the content */
62	cbor_map_add(root, (struct cbor_pair) {
63		.key = cbor_move(cbor_build_string("Is CBOR awesome?")),
64		.value = cbor_move(cbor_build_bool(true))
65	});
66	cbor_map_add(root, (struct cbor_pair) {
67		.key = cbor_move(cbor_build_uint8(42)),
68		.value = cbor_move(cbor_build_string("Is the answer"))
69	});
70	/* Output: `length` bytes of data in the `buffer` */
71	unsigned char * buffer;
72	size_t buffer_size,
73		length = cbor_serialize_alloc(root, &buffer, &buffer_size);
74
75	fwrite(buffer, 1, length, stdout);
76	free(buffer);
77
78	fflush(stdout);
79	cbor_decref(&root);
80}
81```
82
83## Documentation
84Get the latest documentation at [libcbor.readthedocs.org](http://libcbor.readthedocs.org/)
85
86## Contributions
87
88All bug reports and contributions are welcome. Please see https://github.com/PJK/libcbor for more info.
89
90Kudos to all the [contributors](https://github.com/PJK/libcbor/graphs/contributors)!
91
92## License
93The MIT License (MIT)
94
95Copyright (c) Pavel Kalvoda, 2014-2019
96
97Permission is hereby granted, free of charge, to any person obtaining a copy
98of this software and associated documentation files (the "Software"), to deal
99in the Software without restriction, including without limitation the rights
100to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
101copies of the Software, and to permit persons to whom the Software is
102furnished to do so, subject to the following conditions:
103
104The above copyright notice and this permission notice shall be included in all
105copies or substantial portions of the Software.
106
107THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
108IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
109FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
110AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
111LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
112OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
113SOFTWARE.
114