#include "schc.h"
#include "schc_config.h"
Go to the source code of this file.
|
| enum | tx_state {
INIT_TX = 0,
SEND = 1,
RESEND = 2,
WAIT_BITMAP = 3,
END_TX = 4,
ERR = 5
} |
| |
| enum | rx_state {
RECV_WINDOW = 0,
WAIT_NEXT_WINDOW = 1,
WAIT_MISSING_FRAG = 2,
WAIT_END = 3,
END_RX = 4,
ABORT = 5
} |
| |
|
| int8_t | schc_fragmenter_init (schc_fragmentation_t *tx_conn, uint8_t(*send)(uint8_t *data, uint16_t length, uint32_t device_id), void(*end_rx)(schc_fragmentation_t *conn), void(*remove_timer_entry)(uint32_t device_id)) |
| | Initializes the SCHC fragmenter. More...
|
| |
| int8_t | schc_fragment (schc_fragmentation_t *tx_conn) |
| | the sender state machine More...
|
| |
| int8_t | schc_reassemble (schc_fragmentation_t *rx_conn) |
| | the receiver state machine More...
|
| |
| void | schc_reset (schc_fragmentation_t *conn) |
| | reset a connection More...
|
| |
| schc_fragmentation_t * | schc_input (uint8_t *data, uint16_t len, schc_fragmentation_t *rx_conn, uint32_t device_id) |
| | This function should be called whenever a packet is received. More...
|
| |
| void | schc_ack_input (uint8_t *data, uint16_t len, schc_fragmentation_t *tx_conn, uint32_t device_id) |
| | This function should be called whenever an ack is received. More...
|
| |
| schc_fragmentation_t * | schc_fragment_input (uint8_t *data, uint16_t len, uint32_t device_id) |
| | This function should be called whenever a fragment is received an open connection is picked for the device out of a pool of connections to keep track of the packet. More...
|
| |
| schc_fragmentation_t * | schc_get_connection (uint32_t device_id) |
| | find a connection based on a device id or open a new connection if there was no connection for this device yet More...
|
| |
| uint16_t | get_mbuf_len (schc_mbuf_t *head) |
| | returns the total length of the mbuf More...
|
| |
| void | mbuf_copy (schc_mbuf_t *head, uint8_t *ptr) |
| | copy the byte alligned contents of the mbuf chain to the passed pointer More...
|
| |
◆ SCHC_ACK_INPUT
Return code: Indicator.
Generic indication that an acknowledgment was received
◆ SCHC_END
Return code: End of fragmentation cycle.
Indicates successful completion of an SCHC fragmentation cycle.
◆ SCHC_FAILURE
Return code: Error.
Generic indication that an SCHC operation went wrong
◆ SCHC_FRAG_INPUT
| #define SCHC_FRAG_INPUT 2 |
Return code: Indicator.
Generic indication that a fragment was received
◆ SCHC_NO_FRAGMENTATION
| #define SCHC_NO_FRAGMENTATION -2 |
Return code: Error.
Generic indication that no fragmentation was needed
◆ SCHC_SUCCESS
Return code: No error.
Indicates successful completion of an SCHC operation.
◆ schc_fragmentation_ack_t
◆ schc_fragmentation_t
◆ schc_mbuf_t
◆ rx_state
| Enumerator |
|---|
| RECV_WINDOW | |
| WAIT_NEXT_WINDOW | |
| WAIT_MISSING_FRAG | |
| WAIT_END | |
| END_RX | |
| ABORT | |
◆ tx_state
| Enumerator |
|---|
| INIT_TX | |
| SEND | |
| RESEND | |
| WAIT_BITMAP | |
| END_TX | |
| ERR | |
◆ get_mbuf_len()
returns the total length of the mbuf
- Parameters
-
- Returns
- len the total length of the fragment
◆ mbuf_copy()
copy the byte alligned contents of the mbuf chain to the passed pointer
- Parameters
-
| head | the head of the list |
| ptr | the pointer to copy the contents to |
◆ schc_ack_input()
| void schc_ack_input |
( |
uint8_t * |
data, |
|
|
uint16_t |
len, |
|
|
schc_fragmentation_t * |
tx_conn, |
|
|
uint32_t |
device_id |
|
) |
| |
This function should be called whenever an ack is received.
- Parameters
-
| data | a pointer to the received data |
| len | the length of the received packet |
| tx_conn | a pointer to the tx initialization structure |
| device_id | the device id from the rx source |
◆ schc_fragment()
the sender state machine
- Parameters
-
| tx_conn | a pointer to the tx connection structure |
- Returns
- 0 TBD -1 failed to initialize the connection -2 no fragmentation was needed for this packet
◆ schc_fragment_input()
This function should be called whenever a fragment is received an open connection is picked for the device out of a pool of connections to keep track of the packet.
- Parameters
-
| data | a pointer to the data packet |
| len | the length of the received packet |
| device_id | the device id from the rx source |
- Returns
- conn the connection
◆ schc_fragmenter_init()
| int8_t schc_fragmenter_init |
( |
schc_fragmentation_t * |
tx_conn, |
|
|
uint8_t(*)(uint8_t *data, uint16_t length, uint32_t device_id) |
send, |
|
|
void(*)(schc_fragmentation_t *conn) |
end_rx, |
|
|
void(*)(uint32_t device_id) |
remove_timer_entry |
|
) |
| |
Initializes the SCHC fragmenter.
- Parameters
-
| tx_conn | a pointer to the tx initialization structure |
| send | a pointer to the send callback |
| end_rx | this function is called to indicate that the last rx timer has expired |
| remove_timer_entry | some scheduler implementations need a callback to remove a timer entry for a certain device |
- Returns
- error codes on error
◆ schc_get_connection()
find a connection based on a device id or open a new connection if there was no connection for this device yet
- Parameters
-
| device_id | the id of the device to open a connection for |
- Returns
- conn a pointer to the selected connection 0 if no free connections are available
◆ schc_input()
This function should be called whenever a packet is received.
- Parameters
-
| data | a pointer to the received data |
| len | the length of the received packet |
| tx_conn | a pointer to the tx initialization structure |
| device_id | the device id from the rx source |
◆ schc_reassemble()
the receiver state machine
- Parameters
-
| conn | a pointer to the connection |
- Returns
- 0 TBD
◆ schc_reset()
reset a connection
- Parameters
-
| conn | a pointer to the connection to reset |