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_header.h File Reference
CoAP C-library User header interface header file. More...
Go to the source code of this file.
Data Structures | |
struct | sn_coap_options_list_ |
Structure for CoAP Options. More... | |
struct | sn_coap_hdr_ |
Main CoAP message struct. More... | |
Typedefs | |
typedef enum coap_version_ | coap_version_e |
Enumeration for CoAP Version. | |
typedef enum sn_coap_msg_type_ | sn_coap_msg_type_e |
Enumeration for CoAP Message type, used in CoAP Header. | |
typedef enum sn_coap_msg_code_ | sn_coap_msg_code_e |
Enumeration for CoAP Message code, used in CoAP Header. | |
typedef enum sn_coap_option_numbers_ | sn_coap_option_numbers_e |
Enumeration for CoAP Option number, used in CoAP Header. | |
typedef enum sn_coap_content_format_ | sn_coap_content_format_e |
Enumeration for CoAP Content Format codes. | |
typedef enum sn_coap_status_ | sn_coap_status_e |
Enumeration for CoAP status, used in CoAP Header. | |
typedef struct sn_coap_options_list_ | sn_coap_options_list_s |
Structure for CoAP Options. | |
typedef struct sn_coap_hdr_ | sn_coap_hdr_s |
Main CoAP message struct. | |
Enumerations | |
enum | coap_version_ |
Enumeration for CoAP Version. More... | |
enum | sn_coap_msg_type_ { COAP_MSG_TYPE_CONFIRMABLE = 0x00, COAP_MSG_TYPE_NON_CONFIRMABLE = 0x10, COAP_MSG_TYPE_ACKNOWLEDGEMENT = 0x20, COAP_MSG_TYPE_RESET = 0x30 } |
Enumeration for CoAP Message type, used in CoAP Header. More... | |
enum | sn_coap_msg_code_ |
Enumeration for CoAP Message code, used in CoAP Header. More... | |
enum | sn_coap_option_numbers_ |
Enumeration for CoAP Option number, used in CoAP Header. More... | |
enum | sn_coap_content_format_ |
Enumeration for CoAP Content Format codes. More... | |
enum | sn_coap_status_ { COAP_STATUS_OK = 0, COAP_STATUS_PARSER_ERROR_IN_HEADER = 1, COAP_STATUS_PARSER_DUPLICATED_MSG = 2, COAP_STATUS_PARSER_BLOCKWISE_MSG_RECEIVING = 3, COAP_STATUS_PARSER_BLOCKWISE_ACK = 4, COAP_STATUS_PARSER_BLOCKWISE_MSG_REJECTED = 5, COAP_STATUS_PARSER_BLOCKWISE_MSG_RECEIVED = 6, COAP_STATUS_BUILDER_MESSAGE_SENDING_FAILED = 7 } |
Enumeration for CoAP status, used in CoAP Header. More... | |
Functions | |
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. | |
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. | |
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. | |
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_2 (sn_coap_hdr_s *src_coap_msg_ptr, uint16_t blockwise_payload_size) |
Calculates needed Packet data memory size for given CoAP message. | |
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. |
Detailed Description
CoAP C-library User header interface header file.
Definition in file sn_coap_header.h.
Typedef Documentation
typedef enum coap_version_ coap_version_e |
Enumeration for CoAP Version.
typedef enum sn_coap_content_format_ sn_coap_content_format_e |
Enumeration for CoAP Content Format codes.
typedef struct sn_coap_hdr_ sn_coap_hdr_s |
Main CoAP message struct.
typedef enum sn_coap_msg_code_ sn_coap_msg_code_e |
Enumeration for CoAP Message code, used in CoAP Header.
typedef enum sn_coap_msg_type_ sn_coap_msg_type_e |
Enumeration for CoAP Message type, used in CoAP Header.
typedef enum sn_coap_option_numbers_ sn_coap_option_numbers_e |
Enumeration for CoAP Option number, used in CoAP Header.
typedef struct sn_coap_options_list_ sn_coap_options_list_s |
Structure for CoAP Options.
typedef enum sn_coap_status_ sn_coap_status_e |
Enumeration for CoAP status, used in CoAP Header.
Enumeration Type Documentation
enum coap_version_ |
Enumeration for CoAP Version.
Definition at line 40 of file sn_coap_header.h.
Enumeration for CoAP Content Format codes.
Definition at line 119 of file sn_coap_header.h.
enum sn_coap_msg_code_ |
Enumeration for CoAP Message code, used in CoAP Header.
Definition at line 58 of file sn_coap_header.h.
enum sn_coap_msg_type_ |
Enumeration for CoAP Message type, used in CoAP Header.
- Enumerator:
Definition at line 48 of file sn_coap_header.h.
Enumeration for CoAP Option number, used in CoAP Header.
Definition at line 92 of file sn_coap_header.h.
enum sn_coap_status_ |
Enumeration for CoAP status, used in CoAP Header.
- Enumerator:
Definition at line 132 of file sn_coap_header.h.
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_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.
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 50 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 89 of file sn_coap_parser.c.
Generated on Wed Jul 13 2022 17:43:56 by
