-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathcobs.h
38 lines (30 loc) · 876 Bytes
/
cobs.h
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
#pragma once
typedef enum {
COBS_RET_SUCCESS = 0,
COBS_RET_ERR_BAD_ARG,
COBS_RET_ERR_BAD_PAYLOAD,
COBS_RET_ERR_EXHAUSTED
} cobs_ret_t;
enum {
COBS_INPLACE_SENTINEL_VALUE = 0x5A,
COBS_INPLACE_SAFE_BUFFER_SIZE = 256
};
#ifdef __cplusplus
extern "C" {
#endif
cobs_ret_t cobs_encode_inplace(void *buf, unsigned len);
cobs_ret_t cobs_decode_inplace(void *buf, unsigned len);
unsigned cobs_encode_max(unsigned dec_len);
cobs_ret_t cobs_encode(void const *dec,
unsigned dec_len,
void *out_enc,
unsigned enc_max,
unsigned *out_enc_len);
cobs_ret_t cobs_decode(void const *enc,
unsigned enc_len,
void *out_dec,
unsigned dec_max,
unsigned *out_dec_len);
#ifdef __cplusplus
}
#endif