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.
Fork of mbed-client-c by
sn_coap_builder.c File Reference
CoAP Message builder. More...
Go to the source code of this file.
Functions | |
static int8_t | sn_coap_builder_header_build (uint8_t **dst_packet_data_pptr, sn_coap_hdr_s *src_coap_msg_ptr) |
Builds Header part of Packet data. | |
static int8_t | sn_coap_builder_options_build (uint8_t **dst_packet_data_pptr, sn_coap_hdr_s *src_coap_msg_ptr) |
Builds Options part of Packet data. | |
static uint16_t | sn_coap_builder_options_calc_option_size (uint16_t query_len, uint8_t *query_ptr, sn_coap_option_numbers_e option) |
Calculates needed Packet data memory size for option. | |
static uint8_t | sn_coap_builder_options_get_option_part_count (uint16_t query_len, uint8_t *query_ptr, sn_coap_option_numbers_e option) |
Gets query part count from whole option string. | |
static uint16_t | sn_coap_builder_options_get_option_part_length_from_whole_option_string (uint16_t query_len, uint8_t *query_ptr, uint8_t query_index, sn_coap_option_numbers_e option) |
Gets one's query part length from whole query string. | |
static int16_t | sn_coap_builder_options_get_option_part_position (uint16_t query_len, uint8_t *query_ptr, uint8_t query_index, sn_coap_option_numbers_e option) |
Gets query part position in whole query. | |
static void | sn_coap_builder_payload_build (uint8_t **dst_packet_data_pptr, sn_coap_hdr_s *src_coap_msg_ptr) |
Builds Options part of Packet data. | |
static uint8_t | sn_coap_builder_options_calculate_jump_need (sn_coap_hdr_s *src_coap_msg_ptr, uint8_t block_option) |
Checks if there is need for option jump. | |
sn_coap_hdr_s * | sn_coap_build_response (struct coap_s *handle, sn_coap_hdr_s *coap_packet_ptr, uint8_t msg_code) |
Prepares generic response packet from a request packet. | |
int16_t | sn_coap_builder (uint8_t *dst_packet_data_ptr, sn_coap_hdr_s *src_coap_msg_ptr) |
Builds an outgoing message buffer from a CoAP header structure. | |
int16_t | sn_coap_builder_2 (uint8_t *dst_packet_data_ptr, sn_coap_hdr_s *src_coap_msg_ptr, uint16_t blockwise_payload_size) |
Builds an outgoing message buffer from a CoAP header structure. | |
uint16_t | sn_coap_builder_calc_needed_packet_data_size (sn_coap_hdr_s *src_coap_msg_ptr) |
Calculates needed Packet data memory size for given CoAP message. | |
uint16_t | sn_coap_builder_calc_needed_packet_data_size_2 (sn_coap_hdr_s *src_coap_msg_ptr, uint16_t blockwise_payload_size) |
Calculates needed Packet data memory size for given CoAP message. |
Detailed Description
CoAP Message builder.
Functionality: Builds CoAP message
Definition in file sn_coap_builder.c.
Function Documentation
sn_coap_hdr_s* sn_coap_build_response | ( | struct coap_s * | handle, |
sn_coap_hdr_s * | coap_packet_ptr, | ||
uint8_t | msg_code | ||
) |
Prepares generic response packet from a request packet.
This function allocates memory for the resulting sn_coap_hdr_s
- Parameters:
-
*handle Pointer to CoAP library handle *coap_packet_ptr The request packet pointer msg_code response messages code
- Returns:
- *coap_packet_ptr The allocated and pre-filled response packet pointer NULL Error in parsing the request
Definition at line 51 of file sn_coap_builder.c.
int16_t sn_coap_builder | ( | uint8_t * | dst_packet_data_ptr, |
sn_coap_hdr_s * | src_coap_msg_ptr | ||
) |
Builds an outgoing message buffer from a CoAP header structure.
- Parameters:
-
*dst_packet_data_ptr is pointer to allocated destination to built CoAP packet *src_coap_msg_ptr is pointer to source structure for building Packet data
- Returns:
- Return value is byte count of built Packet data. In failure cases:
-1 = Failure in given CoAP header structure
-2 = Failure in given pointer (= NULL)
Definition at line 95 of file sn_coap_builder.c.
int16_t sn_coap_builder_2 | ( | uint8_t * | dst_packet_data_ptr, |
sn_coap_hdr_s * | src_coap_msg_ptr, | ||
uint16_t | blockwise_payload_size | ||
) |
Builds an outgoing message buffer from a CoAP header structure.
- Parameters:
-
*dst_packet_data_ptr is pointer to allocated destination to built CoAP packet *src_coap_msg_ptr is pointer to source structure for building Packet data blockwise_payload_size Blockwise message maximum payload size
- Returns:
- Return value is byte count of built Packet data. In failure cases:
-1 = Failure in given CoAP header structure
-2 = Failure in given pointer (= NULL)
Definition at line 100 of file sn_coap_builder.c.
uint16_t sn_coap_builder_calc_needed_packet_data_size | ( | sn_coap_hdr_s * | src_coap_msg_ptr ) |
Calculates needed Packet data memory size for given CoAP message.
- Parameters:
-
*src_coap_msg_ptr is pointer to data which needed Packet data length is calculated
- Returns:
- Return value is count of needed memory as bytes for build Packet data Null if failed
Definition at line 145 of file sn_coap_builder.c.
uint16_t sn_coap_builder_calc_needed_packet_data_size_2 | ( | sn_coap_hdr_s * | src_coap_msg_ptr, |
uint16_t | blockwise_payload_size | ||
) |
Calculates needed Packet data memory size for given CoAP message.
- Parameters:
-
*src_coap_msg_ptr is pointer to data which needed Packet data length is calculated blockwise_payload_size Blockwise message maximum payload size
- Returns:
- Return value is count of needed memory as bytes for build Packet data Null if failed
Definition at line 150 of file sn_coap_builder.c.
static int8_t sn_coap_builder_header_build | ( | uint8_t ** | dst_packet_data_pptr, |
sn_coap_hdr_s * | src_coap_msg_ptr | ||
) | [static] |
Builds Header part of Packet data.
- Parameters:
-
**dst_packet_data_pptr is destination for built Packet data *src_coap_msg_ptr is source for building Packet data
- Returns:
- Return value is 0 in ok case and -1 in failure case
Definition at line 532 of file sn_coap_builder.c.
static int8_t sn_coap_builder_options_build | ( | uint8_t ** | dst_packet_data_pptr, |
sn_coap_hdr_s * | src_coap_msg_ptr | ||
) | [static] |
Builds Options part of Packet data.
- Parameters:
-
**dst_packet_data_pptr is destination for built Packet data *src_coap_msg_ptr is source for building Packet data
- Returns:
- Return value is 0 in every case
Definition at line 574 of file sn_coap_builder.c.
static uint16_t sn_coap_builder_options_calc_option_size | ( | uint16_t | query_len, |
uint8_t * | query_ptr, | ||
sn_coap_option_numbers_e | option | ||
) | [static] |
Calculates needed Packet data memory size for option.
- Parameters:
-
path_len is length of calculated strting(s) *path_ptr is pointer to calculated options
- Returns:
- Return value is count of needed memory as bytes for Uri-query option
Definition at line 869 of file sn_coap_builder.c.
static uint8_t sn_coap_builder_options_calculate_jump_need | ( | sn_coap_hdr_s * | src_coap_msg_ptr, |
uint8_t | block_option | ||
) | [static] |
Checks if there is need for option jump.
- Parameters:
-
*src_coap_msg_ptr is source of checked CoAP message block option marks if block option is to be added to message later. 0 = no block option, 1 = block1 and 2 = block2
- Returns:
- Returns bytes needed for jumping
Definition at line 402 of file sn_coap_builder.c.
static uint8_t sn_coap_builder_options_get_option_part_count | ( | uint16_t | query_len, |
uint8_t * | query_ptr, | ||
sn_coap_option_numbers_e | option | ||
) | [static] |
Gets query part count from whole option string.
- Parameters:
-
query_len is length of whole Path *query_ptr is pointer to the start of whole Path
- Returns:
- Return value is count of query parts
Definition at line 950 of file sn_coap_builder.c.
static uint16_t sn_coap_builder_options_get_option_part_length_from_whole_option_string | ( | uint16_t | query_len, |
uint8_t * | query_ptr, | ||
uint8_t | query_index, | ||
sn_coap_option_numbers_e | option | ||
) | [static] |
Gets one's query part length from whole query string.
- Parameters:
-
query_len is length of whole string *query_ptr is pointer to the start of whole string query_index is query part index to be found sn_coap_option_numbers_e option is option number of the option
- Returns:
- Return value is length of query part
Definition at line 990 of file sn_coap_builder.c.
static int16_t sn_coap_builder_options_get_option_part_position | ( | uint16_t | query_len, |
uint8_t * | query_ptr, | ||
uint8_t | query_index, | ||
sn_coap_option_numbers_e | option | ||
) | [static] |
Gets query part position in whole query.
- Parameters:
-
query_len is length of whole query *query_ptr is pointer to the start of whole query query_index is query part index to be found
- Returns:
- Return value is position (= offset) of query part in whole query. In fail cases -1 is returned.
Definition at line 1048 of file sn_coap_builder.c.
static void sn_coap_builder_payload_build | ( | uint8_t ** | dst_packet_data_pptr, |
sn_coap_hdr_s * | src_coap_msg_ptr | ||
) | [static] |
Builds Options part of Packet data.
- Parameters:
-
**dst_packet_data_pptr is destination for built Packet data *src_coap_msg_ptr is source for building Packet data
Definition at line 1103 of file sn_coap_builder.c.
Generated on Wed Jul 13 2022 17:43:56 by
