All Projects → tiehuis → nanopack

tiehuis / nanopack

Licence: MIT license
Lightweight Msgpack Encoder

Programming Languages

c
50402 projects - #5 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to nanopack

Basic verilog
Must-have verilog systemverilog modules
Stars: ✭ 247 (+1546.67%)
Mutual labels:  encoder
arancino-daemon
No description or website provided.
Stars: ✭ 12 (-20%)
Mutual labels:  msgpack
urlpack
Pure JavaScript toolkit for data URLs (MessagePack, Base58 and Base62)
Stars: ✭ 51 (+240%)
Mutual labels:  encoder
BatchEncoder
BatchEncoder is an audio files conversion software.
Stars: ✭ 145 (+866.67%)
Mutual labels:  encoder
video-quality-metrics
Test specified presets/CRF values for the x264 or x265 encoder. Compares VMAF/SSIM/PSNR numerically & via graphs.
Stars: ✭ 87 (+480%)
Mutual labels:  encoder
libcluon
libcluon is a small and efficient, single-file and header-only library written in modern C++ to power microservices.
Stars: ✭ 81 (+440%)
Mutual labels:  msgpack
Base64 Encoder
Base64 Encoder
Stars: ✭ 245 (+1533.33%)
Mutual labels:  encoder
logfmt
Package logfmt marshals and unmarshals logfmt messages.
Stars: ✭ 156 (+940%)
Mutual labels:  encoder
badchars
Bad char generator to instruct encoders such as shikata-ga-nai to transform those to other chars.
Stars: ✭ 178 (+1086.67%)
Mutual labels:  encoder
neovim-java
Neovim Java client library. Provides multiple interfaces for communicating with Neovim instance via multiple different protocols. - Moved to https://codeberg.org/neovim-java/neovim-java
Stars: ✭ 34 (+126.67%)
Mutual labels:  msgpack
rmarsh
Ruby Marshal 4.8 encoder/decoder in Golang. Why? Who knows.
Stars: ✭ 15 (+0%)
Mutual labels:  encoder
restish
Restish is a CLI for interacting with REST-ish HTTP APIs with some nice features built-in
Stars: ✭ 453 (+2920%)
Mutual labels:  msgpack
cache
Aplus Framework Cache Library
Stars: ✭ 18 (+20%)
Mutual labels:  msgpack
Flacon
Audio File Encoder. Extracts audio tracks from an audio CD image to separate tracks.
Stars: ✭ 252 (+1580%)
Mutual labels:  encoder
Ffast-Java
Ffast 基于Srping boot + Mybatis Plus后台管理系统前后分离快速开发解决方案
Stars: ✭ 104 (+593.33%)
Mutual labels:  msgpack
Enmime
MIME mail encoding and decoding package for Go
Stars: ✭ 246 (+1540%)
Mutual labels:  encoder
sms
A Go library for encoding and decoding SMSs
Stars: ✭ 37 (+146.67%)
Mutual labels:  encoder
USB-Rubber-Ducky-App
🐣 Windows GUI for USB Rubber Ducky
Stars: ✭ 63 (+320%)
Mutual labels:  encoder
gonvert
Golang character encoding converter with an automatic code-estimation.
Stars: ✭ 24 (+60%)
Mutual labels:  encoder
gocnab
CNAB (Un)Marshaler
Stars: ✭ 20 (+33.33%)
Mutual labels:  encoder

nanopack

Build Status Coverage Status

The smallest msgpack encoding interface. This is designed for embedded devices where memory constraints are tight and the output format is usually static.

For reference, the resulting .a archive is ~1.9K when compiling with GCC and -Os.

If you are not on a resource-constrained embedded device, I'd recommend instead using the mpack library.

#include "nanopack.h"

int main(void)
{
    size_t len;
    uint8_t buf[64];
    np_buf w = np_make_buf(buf, sizeof(buf));

    np_map(&w, 2);
    np_str(&w, "key1");
    np_i32(&w, "value1");

    // msgpack data stored from buf[0..w.len]
}

Installation

The easiest method to use is to copy the nanopack.c and nanopack.h files directly into your project.

It is advisable to run the test suite on your device before using to ensure that it works as intended as there may be issues on more exotic architectures (i.e. ones-complement devices).

Requirements

  • A C89 compiler
  • stdint.h for (u)int(8|16|32|64)_t types
  • stddef.h for size_t

If either of the system header files are missing, these can be manually written with relative ease (~15 lines of code for integer definitions).

Questions

Why no decoding?

Isn't required for my purposes. It is also unsuitable for embedded devices which act as dumb beacons (don't receive external data).

Buffer Overruns are possible!

This wrapper assumes that the caller knows the limits of the generated data and will preallocate fixed buffers to be able to hold the full amount.

How can I check errors?

The library assumes that you call it with the correct arguments and test it before continuing. If called correctly, there should never be errors to report.

Remarks

Minor inspiration taken from mpack and libmpack which are both licensed under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].