This library contains C .h and .c files for byte stuffing. The library implements the following protocols:
- High-Level Data Link Control Asynchronous Framing protocol (part of PPP or Point to Point Protocol) - simply referred to as 'PPP' in this library.
- Consistent Overhead Bytes Stuffing (COBS)
Copy the headers into your project directly and add to your build environment.
Add this library as a submodule and link to the headers.
Add this to your CMakeLists.txt:
include(FetchContent)
FetchContent_Declare(
byte_stuffing
GIT_REPOSITORY https://github.com/Ocanath/byte-stuffing.git
GIT_TAG master # or specific commit/tag
)
FetchContent_MakeAvailable(byte_stuffing)
# Link the libraries to your target
target_link_libraries(your_target_name PRIVATE cobs PPP)To build the libraries manually:
mkdir build && cd build
cmake ..
cmake --build .This will generate:
libcobs.a- COBS (Consistent Overhead Byte Stuffing) librarylibPPP.a- PPP/HDLC (High-Level Data Link Control) library
Both libraries are C++ compatible. Include the headers in your C++ code:
#include "cobs.h" // COBS functionality
#include "PPP.h" // PPP/HDLC functionalityTo run the C unit tests, install ceedling and simply run: ceedling test:all
A Python implementation of COBS is available in cobs.py. To run the Python tests:
pip install pytest
pytest Python\test_cobs.py -v