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-os 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_build_add_uint_option (uint8_t **dst_packet_data_pptr, uint32_t option_value, sn_coap_option_numbers_e option_number, uint16_t *previous_option_number) |
Constructs a uint Options part of Packet data. | |
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. | |
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 53 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 487 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 529 of file sn_coap_builder.c.
static uint8_t sn_coap_builder_options_build_add_uint_option | ( | uint8_t ** | dst_packet_data_pptr, |
uint32_t | option_value, | ||
sn_coap_option_numbers_e | option_number, | ||
uint16_t * | previous_option_number | ||
) | [static] |
Constructs a uint Options part of Packet data.
- Parameters:
-
**dst_packet_data_pptr is destination for built Packet data; NULL to compute size only. option_value is Option value to be added option_number is Option number to be added
- Returns:
- Return value is total option size, or -1 in write failure case
Definition at line 749 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 832 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 913 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 953 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 1011 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 1066 of file sn_coap_builder.c.
Generated on Tue Jul 12 2022 13:16:24 by
