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.
Dependencies: MAX44000 PWM_Tone_Library nexpaq_mdk
Fork of LED_Demo by
sn_coap_parser.c File Reference
CoAP Header parser. More...
Go to the source code of this file.
Functions | |
static void | sn_coap_parser_header_parse (uint8_t **packet_data_pptr, sn_coap_hdr_s *dst_coap_msg_ptr, coap_version_e *coap_version_ptr) |
Parses CoAP message's Header part from given Packet data. | |
static int8_t | sn_coap_parser_payload_parse (uint16_t packet_data_len, uint8_t *packet_data_start_ptr, uint8_t **packet_data_pptr, sn_coap_hdr_s *dst_coap_msg_ptr) |
Parses CoAP message's Payload part from given Packet data. | |
sn_coap_hdr_s * | sn_coap_parser_init_message (sn_coap_hdr_s *coap_msg_ptr) |
Initialise a message structure to empty. | |
sn_coap_hdr_s * | sn_coap_parser_alloc_message (struct coap_s *handle) |
Allocate an empty message structure. | |
sn_coap_options_list_s * | sn_coap_parser_alloc_options (struct coap_s *handle, sn_coap_hdr_s *coap_msg_ptr) |
Allocate an empty options structure. | |
sn_coap_hdr_s * | sn_coap_parser (struct coap_s *handle, uint16_t packet_data_len, uint8_t *packet_data_ptr, coap_version_e *coap_version_ptr) |
Parses CoAP message from given Packet data. | |
void | sn_coap_parser_release_allocated_coap_msg_mem (struct coap_s *handle, sn_coap_hdr_s *freed_coap_msg_ptr) |
Releases memory of given CoAP message. |
Detailed Description
CoAP Header parser.
Functionality: Parses CoAP Header
Definition in file sn_coap_parser.c.
Function Documentation
sn_coap_hdr_s* sn_coap_parser | ( | struct coap_s * | handle, |
uint16_t | packet_data_len, | ||
uint8_t * | packet_data_ptr, | ||
coap_version_e * | coap_version_ptr | ||
) |
Parses CoAP message from given Packet data.
- Parameters:
-
*handle Pointer to CoAP library handle packet_data_len is length of given Packet data to be parsed to CoAP message *packet_data_ptr is source for Packet data to be parsed to CoAP message *coap_version_ptr is destination for parsed CoAP specification version
- Returns:
- Return value is pointer to parsed CoAP message.
In following failure cases NULL is returned:
-Failure in given pointer (= NULL)
-Failure in memory allocation (malloc() returns NULL)
Definition at line 103 of file sn_coap_parser.c.
sn_coap_hdr_s* sn_coap_parser_alloc_message | ( | struct coap_s * | handle ) |
Allocate an empty message structure.
- Parameters:
-
*handle Pointer to CoAP library handle
- Returns:
- Return value is pointer to an empty CoAP message.
In following failure cases NULL is returned:
-Failure in given pointer (= NULL)
-Failure in memory allocation (malloc() returns NULL)
Definition at line 63 of file sn_coap_parser.c.
sn_coap_options_list_s* sn_coap_parser_alloc_options | ( | struct coap_s * | handle, |
sn_coap_hdr_s * | coap_msg_ptr | ||
) |
Allocate an empty options structure.
- Parameters:
-
*handle Pointer to CoAP library handle *coap_msg_ptr is pointer to CoAP message that will contain the options
If the message already has a pointer to an option structure, that pointer is returned, rather than a new structure being allocated.
- Returns:
- Return value is pointer to the CoAP options structure.
In following failure cases NULL is returned:
-Failure in given pointer (= NULL)
-Failure in memory allocation (malloc() returns NULL)
Definition at line 78 of file sn_coap_parser.c.
static void sn_coap_parser_header_parse | ( | uint8_t ** | packet_data_pptr, |
sn_coap_hdr_s * | dst_coap_msg_ptr, | ||
coap_version_e * | coap_version_ptr | ||
) | [static] |
Parses CoAP message's Header part from given Packet data.
- Parameters:
-
**packet_data_ptr is source for Packet data to be parsed to CoAP message *dst_coap_msg_ptr is destination for parsed CoAP message *coap_version_ptr is destination for parsed CoAP specification version
Definition at line 232 of file sn_coap_parser.c.
sn_coap_hdr_s* sn_coap_parser_init_message | ( | sn_coap_hdr_s * | coap_msg_ptr ) |
Initialise a message structure to empty.
- Parameters:
-
*coap_msg_ptr is pointer to CoAP message to initialise
- Returns:
- Return value is pointer passed in
Definition at line 50 of file sn_coap_parser.c.
static int8_t sn_coap_parser_payload_parse | ( | uint16_t | packet_data_len, |
uint8_t * | packet_data_ptr, | ||
uint8_t ** | packet_data_pptr, | ||
sn_coap_hdr_s * | dst_coap_msg_ptr | ||
) | [static] |
Parses CoAP message's Payload part from given Packet data.
- Parameters:
-
packet_data_len is length of given Packet data to be parsed to CoAP message *packet_data_ptr is start of source for Packet data to be parsed to CoAP message **packet_data_pptr is source for Packet data to be parsed to CoAP message *dst_coap_msg_ptr is destination for parsed CoAP message
Definition at line 820 of file sn_coap_parser.c.
void sn_coap_parser_release_allocated_coap_msg_mem | ( | struct coap_s * | handle, |
sn_coap_hdr_s * | freed_coap_msg_ptr | ||
) |
Releases memory of given CoAP message.
Note!!! Does not release Payload part
- Parameters:
-
*handle Pointer to CoAP library handle *freed_coap_msg_ptr is pointer to released CoAP message
Definition at line 139 of file sn_coap_parser.c.
Generated on Tue Jul 12 2022 12:29:03 by
