A Serial Line IP (SLIP) Encoder.
More...
#include <SLIP.h>
|
| enum | { END = 0300
, ESC = 0333
, ESC_END = 0334
, ESC_ESC = 0335
} |
| | Key constants used in the SLIP protocol.
|
| |
|
| static size_t | encode (const uint8_t *buffer, size_t size, uint8_t *encodedBuffer) |
| | Encode a byte buffer with the SLIP encoder.
|
| |
| static size_t | decode (const uint8_t *encodedBuffer, size_t size, uint8_t *decodedBuffer) |
| | Decode a SLIP-encoded buffer.
|
| |
| static size_t | getEncodedBufferSize (size_t unencodedBufferSize) |
| | Get the maximum encoded buffer size needed for a given unencoded buffer size.
|
| |
A Serial Line IP (SLIP) Encoder.
Serial Line IP (SLIP) is a packet framing protocol: SLIP defines a sequence of characters that frame IP packets on a serial line and nothing more. It provides no addressing, packet type identification, error detection, correction or compression mechanisms. Because the protocol does so little its implementation is trivial and fast.
- See also
- http://tools.ietf.org/html/rfc1055
◆ decode()
| static size_t SLIP::decode |
( |
const uint8_t * |
encodedBuffer, |
|
|
size_t |
size, |
|
|
uint8_t * |
decodedBuffer |
|
) |
| |
|
inlinestatic |
Decode a SLIP-encoded buffer.
- Parameters
-
| encodedBuffer | A pointer to the encodedBuffer to decode. |
| size | The number of bytes in the encodedBuffer. |
| decodedBuffer | The target buffer for the decoded bytes. |
- Returns
- The number of bytes written to the
decodedBuffer.
- Warning
- decodedBuffer must have a minimum capacity of size.
◆ encode()
| static size_t SLIP::encode |
( |
const uint8_t * |
buffer, |
|
|
size_t |
size, |
|
|
uint8_t * |
encodedBuffer |
|
) |
| |
|
inlinestatic |
Encode a byte buffer with the SLIP encoder.
- Parameters
-
| buffer | A pointer to the unencoded buffer to encode. |
| size | The number of bytes in the buffer. |
| encodedBuffer | The buffer for the encoded bytes. |
- Returns
- The number of bytes written to the
encodedBuffer.
- Warning
- The encodedBuffer must have at least getEncodedBufferSize() allocated.
◆ getEncodedBufferSize()
| static size_t SLIP::getEncodedBufferSize |
( |
size_t |
unencodedBufferSize | ) |
|
|
inlinestatic |
Get the maximum encoded buffer size needed for a given unencoded buffer size.
SLIP has a start and a end markers (192 and 219). Marker value is replaced by 2 bytes in the encoded buffer. So in the worst case of sending a buffer with only '192' or '219', the encoded buffer length will be 2 * buffer.size() + 2
- Parameters
-
| unencodedBufferSize | The size of the buffer to be encoded. |
- Returns
- the maximum size of the required encoded buffer.
The documentation for this class was generated from the following file:
- lib/PacketSerial/src/Encoding/SLIP.h