This module encodes and decodes SLIP packages. More...
Enumerations |
|
| enum |
slip_read_state_t
{
SLIP_STATE_DECODING , SLIP_STATE_ESC_RECEIVED , SLIP_STATE_CLEARING_INVALID_PACKET } |
|
Status information that is used while receiving and decoding a packet.
More...
|
|
Functions |
|
| ret_code_t | slip_encode (uint8_t *p_output, uint8_t *p_input, uint32_t input_length, uint32_t *p_output_buffer_length) |
|
Function for encoding a SLIP packet.
More...
|
|
| ret_code_t | slip_decode_add_byte ( slip_t *p_slip, uint8_t c) |
|
Function for decoding a SLIP packet.
More...
|
|
Detailed Description
This module encodes and decodes SLIP packages.
The SLIP protocol is described in RFC1055 .
Enumeration Type Documentation
| enum slip_read_state_t |
Status information that is used while receiving and decoding a packet.
Function Documentation
| ret_code_t slip_decode_add_byte | ( | slip_t * | p_slip , |
| uint8_t | c | ||
| ) |
Function for decoding a SLIP packet.
The decoded packet is put into
p_slip::p_buffer
. The index and buffer state is updated.
Ensure that
p_slip
is properly initialized. The initial state must be set to
SLIP_STATE_DECODING
.
- Parameters
-
[in,out] p_slip State of the decoding process. [in] c Byte to decode.
- Return values
-
NRF_SUCCESS If a packet has been parsed. The received packet can be retrieved from p_slip.NRF_ERROR_NULL If p_slipis NULL.NRF_ERROR_NO_MEM If there is no more room in the buffer provided by p_slip.NRF_ERROR_BUSY If the packet has not been parsed completely yet. NRF_ERROR_INVALID_DATA If the packet is encoded wrong. In this case, p_slip::stateis set to SLIP_STATE_CLEARING_INVALID_PACKET , and decoding will stay in this state until the END byte is received.
| ret_code_t slip_encode | ( | uint8_t * | p_output , |
| uint8_t * | p_input , | ||
| uint32_t | input_length , | ||
| uint32_t * | p_output_buffer_length | ||
| ) |
Function for encoding a SLIP packet.
The maximum size of the output data is (2*input size + 1) bytes. Ensure that the provided buffer is large enough.
- Parameters
-
[in,out] p_output The buffer where the encoded SLIP packet is stored. Ensure that it is large enough. [in,out] p_input The buffer to be encoded. [in,out] input_length The length of the input buffer. [out] p_output_buffer_length The length of the output buffer after the input has been encoded.
- Return values
-
NRF_SUCCESS If the input was successfully encoded into output. NRF_ERROR_NULL If one of the provided parameters is NULL.