Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
sn_coap_protocol.h File Reference
CoAP C-library User protocol interface header file. More...
Go to the source code of this file.
Functions | |
int16_t | sn_coap_protocol_build (struct coap_s *handle, sn_nsdl_addr_s *dst_addr_ptr, uint8_t *dst_packet_data_ptr, sn_coap_hdr_s *src_coap_msg_ptr, void *param) |
Builds Packet data from given CoAP header structure to be sent. | |
int8_t | sn_coap_protocol_exec (struct coap_s *handle, uint32_t current_time) |
Sends CoAP messages from re-sending queue, if there is any. | |
void | sn_coap_protocol_clear_retransmission_buffer (struct coap_s *handle) |
If re-transmissions are enabled, this function removes all messages from the retransmission queue. | |
int8_t | sn_coap_convert_block_size (uint16_t block_size) |
Utility function to convert block size. | |
int8_t | sn_coap_protocol_handle_block2_response_internally (struct coap_s *handle, uint8_t handle_response) |
This function change the state whether CoAP library sends the block 2 response automatically or not. | |
void | sn_coap_protocol_clear_sent_blockwise_messages (struct coap_s *handle) |
This function clears all the sent blockwise messages from the linked list. | |
void | sn_coap_protocol_clear_received_blockwise_messages (struct coap_s *handle) |
This function clears all the received blockwise messages from the linked list. | |
void | sn_coap_protocol_send_rst (struct coap_s *handle, uint16_t msg_id, sn_nsdl_addr_s *addr_ptr, void *param) |
This function sends a RESET message. | |
uint16_t | sn_coap_protocol_get_configured_blockwise_size (struct coap_s *handle) |
Get configured CoAP payload blockwise size. | |
void | sn_coap_protocol_linked_list_duplication_info_remove (struct coap_s *handle, const uint8_t *src_addr_ptr, const uint16_t port, const uint16_t msg_id) |
Removes stored Duplication info from Linked list. |
Detailed Description
CoAP C-library User protocol interface header file.
Definition in file sn_coap_protocol.h.
Function Documentation
int8_t sn_coap_convert_block_size | ( | uint16_t | block_size ) |
Utility function to convert block size.
- Parameters:
-
block_size Block size to convert.
- Returns:
- Value of range 0 - 6
Definition at line 2283 of file sn_coap_protocol.c.
int16_t sn_coap_protocol_build | ( | struct coap_s * | handle, |
sn_nsdl_addr_s * | dst_addr_ptr, | ||
uint8_t * | dst_packet_data_ptr, | ||
sn_coap_hdr_s * | src_coap_msg_ptr, | ||
void * | param | ||
) |
Builds Packet data from given CoAP header structure to be sent.
- Parameters:
-
*dst_addr_ptr is pointer to destination address where CoAP message will be sent (CoAP builder needs that information for message resending purposes) *dst_packet_data_ptr is pointer to destination of built Packet data *src_coap_msg_ptr is pointer to source of built Packet data param void pointer that will be passed to tx/rx function callback when those are called.
- Returns:
- Return value is byte count of built Packet data.
Note: If message is blockwised, all payload is not sent at the same time
In failure cases:
-1 = Failure in CoAP header structure
-2 = Failure in given pointer (= NULL)
-3 = Failure in Reset message
-4 = Failure in Resending message store
If there is not enough memory (or User given limit exceeded) for storing resending messages, situation is ignored.
Definition at line 420 of file sn_coap_protocol.c.
void sn_coap_protocol_clear_received_blockwise_messages | ( | struct coap_s * | handle ) |
This function clears all the received blockwise messages from the linked list.
- Parameters:
-
*handle Pointer to CoAP library handle
Definition at line 237 of file sn_coap_protocol.c.
void sn_coap_protocol_clear_retransmission_buffer | ( | struct coap_s * | handle ) |
If re-transmissions are enabled, this function removes all messages from the retransmission queue.
- Parameters:
-
*handle Pointer to CoAP library handle
Definition at line 309 of file sn_coap_protocol.c.
void sn_coap_protocol_clear_sent_blockwise_messages | ( | struct coap_s * | handle ) |
This function clears all the sent blockwise messages from the linked list.
- Parameters:
-
*handle Pointer to CoAP library handle
Definition at line 222 of file sn_coap_protocol.c.
int8_t sn_coap_protocol_exec | ( | struct coap_s * | handle, |
uint32_t | current_time | ||
) |
Sends CoAP messages from re-sending queue, if there is any.
Cleans also old messages from the duplication list and from block receiving list
This function can be called e.g. once in a second but also more frequently.
- Parameters:
-
*handle Pointer to CoAP library handle current_time is System time in seconds. This time is used for message re-sending timing and to identify old saved data.
- Returns:
- 0 if success -1 if failed
Definition at line 835 of file sn_coap_protocol.c.
uint16_t sn_coap_protocol_get_configured_blockwise_size | ( | struct coap_s * | handle ) |
Get configured CoAP payload blockwise size.
- Parameters:
-
*handle Pointer to CoAP library handle
Definition at line 1053 of file sn_coap_protocol.c.
int8_t sn_coap_protocol_handle_block2_response_internally | ( | struct coap_s * | handle, |
uint8_t | handle_response | ||
) |
This function change the state whether CoAP library sends the block 2 response automatically or not.
- Parameters:
-
*handle Pointer to CoAP library handle handle_response 1 if CoAP library handles the response sending otherwise 0.
- Returns:
- 0 = success, -1 = failure
Definition at line 185 of file sn_coap_protocol.c.
void sn_coap_protocol_linked_list_duplication_info_remove | ( | struct coap_s * | handle, |
const uint8_t * | src_addr_ptr, | ||
const uint16_t | port, | ||
const uint16_t | msg_id | ||
) |
Removes stored Duplication info from Linked list.
- Parameters:
-
*handle Pointer to CoAP library handle *addr_ptr is pointer to Address key to be removed port is Port key to be removed msg_id is Message ID key to be removed
Definition at line 1167 of file sn_coap_protocol.c.
void sn_coap_protocol_send_rst | ( | struct coap_s * | handle, |
uint16_t | msg_id, | ||
sn_nsdl_addr_s * | addr_ptr, | ||
void * | param | ||
) |
This function sends a RESET message.
- Parameters:
-
*handle Pointer to CoAP library handle msg_id Message id. addr_ptr Pointer to destination address where CoAP message will be sent param Pointer that will be passed to tx function callback
Definition at line 1033 of file sn_coap_protocol.c.
Generated on Tue Jul 12 2022 13:55:18 by
