/usr/share/doc/libmsgpuck-dev/README.md is in libmsgpuck-dev 1.0.3-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | MsgPuck
=======
MsgPuck is a simple and efficient [MsgPack](http://msgpack.org) binary
serialization library in a self-contained header file.
* Can be easily incorporated into your project
* Is very easy to use (see examples below)
* Is fully tested and documented
* Has clean and readable C source code
* Is published under the very liberal license (BSD-2)
Status
------
MsgPuck is stable, which means it have been used in production without
serious bugs for quite a while now. The library is fully documented and
covered by unit tests.
Latest MsgPack specification (2013-09) is supported.
Please feel free to file a ticket if your have a problem or a question.
[![Build Status](https://travis-ci.org/rtsisyk/msgpuck.png)]
(https://travis-ci.org/rtsisyk/msgpuck)
Examples
--------
**Encoding:**
char buf[1024];
char *w = buf;
w = mp_encode_array(w, 4)
w = mp_encode_uint(w, 10);
w = mp_encode_str(w, "hello world", strlen("hello world"));
w = mp_encode_bool(w, true);
w = mp_encode_double(w, 3.1415);
**Validating:**
const char *end = buf + xx;
const char *b = buf;
int rc = mp_check(&b, end);
assert(rc == 0);
assert(b == end);
**Decoding:**
uint32_t size;
uint64_t ival;
const char *sval;
uint32_t sval_len;
bool bval;
double dval;
const char *r = buf;
size = mp_decode_array(&r);
/* size is 4 */
ival = mp_decode_uint(&r);
/* ival is 10; */
sval = mp_decode_str(&r, &sval_len);
/* sval is "hello world", sval_len is strlen("hello world") */
bval = mp_decode_bool(&r);
/* bval is true */
dval = mp_decode_double(&r);
/* dval is 3.1415 */
assert(r == w);
Usage
-----
You need a C89+ or C++03+ compatible compiler to use msgpuck.h.
Add this project as a submodule or just copy `msgpuck.h` to your project.
### Static Library
MsgPuck is designed to be fully embedded to your application by a C/C++
compiler. However, some functions require auxiliary static tables which
should be expanded somewhere in a compilation unit (`*.c` or `*.cc` file).
Please add libmsgpuck.a to your binary to avoid problems with unresolved
symbols.
### Just a Header
Include `msgpuck.h` as usual and define `MP_SOURCE 1` exactly in a single
compilation unit:
#define MP_SOURCE 1 /* define in a single .c/.cc file */
#include "msgpuck.h"
All non-inline versions of functions and global lookup tables will be
stored in the file. `MP_SOURCE` must be defined exactly in a single file of
your application, otherwise linker errors occur.
Documentation
-------------
* [API Documentation](http://rtsisyk.github.io/msgpuck/)
* [Specification](https://github.com/msgpack/msgpack/blob/master/spec.md)
API documentation can be also generated using `make doc` (Doxygen is required).
Contacts
--------
MsgPuck was written to use within [Tarantool](http://tarantool.org) -
the world's first full-featured MsgPack-based database.
* roman@tsisyk.com
|