roo_io
API Documentation for roo_io
Loading...
Searching...
No Matches
cobs.h File Reference
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
Include dependency graph for cobs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  cobs_enc_ctx
 
struct  cobs_decode_inc_ctx
 
struct  cobs_decode_inc_args
 

Macros

#define COBS_ENCODE_MAX(DECODED_LEN)    (1 + (DECODED_LEN) + (((DECODED_LEN) + 253) / 254) + ((DECODED_LEN) == 0))
 

Typedefs

typedef struct cobs_enc_ctx cobs_enc_ctx_t
 
typedef struct cobs_decode_inc_ctx cobs_decode_inc_ctx_t
 
typedef struct cobs_decode_inc_args cobs_decode_inc_args_t
 

Enumerations

enum  cobs_ret_t { COBS_RET_SUCCESS = 0 , COBS_RET_ERR_BAD_ARG , COBS_RET_ERR_BAD_PAYLOAD , COBS_RET_ERR_EXHAUSTED }
 
enum  { COBS_FRAME_DELIMITER = 0x00 , COBS_TINYFRAME_SENTINEL_VALUE = 0x5A , COBS_TINYFRAME_SAFE_BUFFER_SIZE = 256 }
 

Functions

cobs_ret_t cobs_encode_tinyframe (void *buf, size_t len)
 
cobs_ret_t cobs_decode_tinyframe (void *buf, size_t len)
 
cobs_ret_t cobs_decode (void const *enc, size_t enc_len, void *out_dec, size_t dec_max, size_t *out_dec_len)
 
cobs_ret_t cobs_encode (void const *dec, size_t dec_len, void *out_enc, size_t enc_max, size_t *out_enc_len)
 
cobs_ret_t cobs_encode_inc_begin (void *out_enc, size_t enc_max, cobs_enc_ctx_t *out_ctx)
 
cobs_ret_t cobs_encode_inc (cobs_enc_ctx_t *ctx, void const *dec_src, size_t dec_len)
 
cobs_ret_t cobs_encode_inc_end (cobs_enc_ctx_t *ctx, size_t *out_enc_len)
 
cobs_ret_t cobs_decode_inc_begin (cobs_decode_inc_ctx_t *ctx)
 
cobs_ret_t cobs_decode_inc (cobs_decode_inc_ctx_t *ctx, cobs_decode_inc_args_t const *args, size_t *out_enc_src_len, size_t *out_dec_dst_len, bool *out_decode_complete)
 

Macro Definition Documentation

◆ COBS_ENCODE_MAX

#define COBS_ENCODE_MAX (   DECODED_LEN)     (1 + (DECODED_LEN) + (((DECODED_LEN) + 253) / 254) + ((DECODED_LEN) == 0))

Definition at line 46 of file cobs.h.

Typedef Documentation

◆ cobs_decode_inc_args_t

◆ cobs_decode_inc_ctx_t

◆ cobs_enc_ctx_t

typedef struct cobs_enc_ctx cobs_enc_ctx_t

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
COBS_FRAME_DELIMITER 
COBS_TINYFRAME_SENTINEL_VALUE 
COBS_TINYFRAME_SAFE_BUFFER_SIZE 

Definition at line 21 of file cobs.h.

◆ cobs_ret_t

enum cobs_ret_t
Enumerator
COBS_RET_SUCCESS 
COBS_RET_ERR_BAD_ARG 
COBS_RET_ERR_BAD_PAYLOAD 
COBS_RET_ERR_EXHAUSTED 

Definition at line 14 of file cobs.h.

Function Documentation

◆ cobs_decode()

cobs_ret_t cobs_decode ( void const *  enc,
size_t  enc_len,
void *  out_dec,
size_t  dec_max,
size_t *  out_dec_len 
)

◆ cobs_decode_inc()

◆ cobs_decode_inc_begin()

cobs_ret_t cobs_decode_inc_begin ( cobs_decode_inc_ctx_t ctx)

Definition at line 208 of file cobs.c.

References COBS_RET_ERR_BAD_ARG, COBS_RET_SUCCESS, and cobs_decode_inc_ctx::state.

Referenced by cobs_decode().

◆ cobs_decode_tinyframe()

cobs_ret_t cobs_decode_tinyframe ( void *  buf,
size_t  len 
)

◆ cobs_encode()

cobs_ret_t cobs_encode ( void const *  dec,
size_t  dec_len,
void *  out_enc,
size_t  enc_max,
size_t *  out_enc_len 
)

◆ cobs_encode_inc()

cobs_ret_t cobs_encode_inc ( cobs_enc_ctx_t ctx,
void const *  dec_src,
size_t  dec_len 
)

◆ cobs_encode_inc_begin()

cobs_ret_t cobs_encode_inc_begin ( void *  out_enc,
size_t  enc_max,
cobs_enc_ctx_t out_ctx 
)

◆ cobs_encode_inc_end()

cobs_ret_t cobs_encode_inc_end ( cobs_enc_ctx_t ctx,
size_t *  out_enc_len 
)

◆ cobs_encode_tinyframe()

cobs_ret_t cobs_encode_tinyframe ( void *  buf,
size_t  len 
)