asoma.dev · the C reference for libose
libose
the C library every o.se host is built on
Loading...
Searching...
No Matches
ose_slip.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2019-22 John MacCallum Permission is hereby granted,
3 free of charge, to any person obtaining a copy of this software
4 and associated documentation files (the "Software"), to deal in
5 the Software without restriction, including without limitation the
6 rights to use, copy, modify, merge, publish, distribute,
7 sublicense, and/or sell copies of the Software, and to permit
8 persons to whom the Software is furnished to do so, subject to the
9 following conditions:
10
11 The above copyright notice and this permission notice shall be
12 included in all copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
18 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 DEALINGS IN THE SOFTWARE.
22*/
23
62
63#ifndef OSE_SLIP_H
64#define OSE_SLIP_H
65
66#include "ose.h"
67
68#ifdef __cplusplus
69extern "C" {
70#endif
71
72#define OSE_SLIP_END 0300
73#define OSE_SLIP_ESC 0333
74#define OSE_SLIP_ESC_END 0334
75#define OSE_SLIP_ESC_ESC 0335
76
81{
82 uint8_t *buf;
83 int32_t buflen;
84 int32_t count;
86 int32_t state;
104};
105
110struct ose_SLIPBuf ose_initSLIPBuf(uint8_t *buf, int32_t buflen);
111
121int ose_SLIPDecode(uint8_t c, struct ose_SLIPBuf *s);
122
130int32_t ose_SLIPEncode(const uint8_t * const src, int32_t srclen,
131 uint8_t *dest, int32_t destlen);
132
133#ifdef __cplusplus
134}
135#endif
136
137#endif
provides global definitions and types
int ose_SLIPDecode(uint8_t c, struct ose_SLIPBuf *s)
Feed one byte.
Definition ose_slip.c:71
int32_t ose_SLIPEncode(const uint8_t *const src, int32_t srclen, uint8_t *dest, int32_t destlen)
Encode srclen bytes of src into dest, terminated by END.
Definition ose_slip.c:194
Decoder state. Make one with ose_initSLIPBuf().
Definition ose_slip.h:81
int32_t state
Definition ose_slip.h:86
int32_t buflen
Definition ose_slip.h:83
int textmode
Treat a newline as the end of a message. Off by default.
Definition ose_slip.h:103
int32_t count
Definition ose_slip.h:84
uint8_t * buf
Definition ose_slip.h:82
int havenullbyte
Definition ose_slip.h:87