#include <stdint.h>Go to the source code of this file.
Macros | |
| #define | COBS_ENCODE_MEASURE_MAX(src_len) |
Functions | |
| int | cobs_encode (uint8_t *restrict dest, const uint8_t *restrict src, const size_t src_len, const uint32_t prefix) |
| size_t | cobs_encode_measure (const uint8_t *restrict src, const size_t src_len, const uint32_t prefix) |
Consistent Overhead Byte Stuffing header
See common/cobs.c for discussion
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
| #define COBS_ENCODE_MEASURE_MAX | ( | src_len | ) |
| int cobs_encode | ( | uint8_t *restrict | dest, |
| const uint8_t *restrict | src, | ||
| const size_t | src_len, | ||
| const uint32_t | prefix ) |
Encodes src in the Consistent Overhead Byte Stuffing algorithm, and writes the result to dest. dest must be sufficiently long. use cobs_encode_measure() to compute the size of the buff or use COBS_ENCODE_MEASURE_MAX(src_len) macro to get the max buffer size needed (e.g. for static allocation)
| [out] | dest | The location to write the stuffed data to |
| [in] | src | The location of the incoming data |
| src_len | The length of the source data | |
| prefix | The four character stream identifier |
| size_t cobs_encode_measure | ( | const uint8_t *restrict | src, |
| const size_t | src_len, | ||
| const uint32_t | prefix ) |
Same as cobs_encode() but doesn't write to an output buffer. Used to determine how much space is needed for src.
| [in] | src | The location of the incoming data |
| src_len | The length of the source data | |
| prefix | The four character stream identifier |