NSDL C library
Dependents: NSDL_HelloWorld_WiFi UbloxModemNanoServiceClient IOT-NSDL_HelloWorld LWM2M_NanoService_Ethernet ... more
Fork of nsdl_lib by
Note that use of this software requires acceptance of the Sensinode EULA: http://mbed.org/teams/Sensinode/code/nsdl_lib/wiki/EULA
Diff: sn_coap_header.h
- Revision:
- 2:ab50a2ab6ec9
- Parent:
- 1:01d723824294
- Child:
- 3:d8cb1afd7285
diff -r 01d723824294 -r ab50a2ab6ec9 sn_coap_header.h --- a/sn_coap_header.h Wed Oct 09 14:18:21 2013 +0000 +++ b/sn_coap_header.h Wed Oct 09 14:57:33 2013 +0000 @@ -242,13 +242,44 @@ /* * * * EXTERNAL FUNCTION PROTOTYPES * * * */ /* * * * * * * * * * * * * * * * * * * * * * */ +/** + * This function sets the memory allocation and deallocation functions the library will use, and must be called first. + */ extern void sn_coap_builder_and_parser_init(void* (*used_malloc_func_ptr)(uint16_t), void (*used_free_func_ptr)(void*)); + +/** + * Use to parse an incoming message buffer to a CoAP header structure. + */ extern sn_coap_hdr_s *sn_coap_parser(uint16_t packet_data_len, uint8_t *packet_data_ptr, coap_version_e *coap_version_ptr); + +/** + * This function releases any memory allocated by a CoAP message structure. + */ +extern void sn_coap_parser_release_allocated_coap_msg_mem(sn_coap_hdr_s *freed_coap_msg_ptr); + +/** + * Use to build an outgoing message buffer from a CoAP header structure. + */ extern int16_t sn_coap_builder(uint8_t *dst_packet_data_ptr, sn_coap_hdr_s *src_coap_msg_ptr); + +/** + * Use to calculate the needed message buffer size from a CoAP message structure. + */ extern uint16_t sn_coap_builder_calc_needed_packet_data_size(sn_coap_hdr_s *src_coap_msg_ptr); + +/** + * This function releases any memory allocated in sn_nsdl_transmit_s + */ extern void sn_coap_builder_release_allocated_send_msg_mem(sn_nsdl_transmit_s *freed_send_msg_ptr); + +/** + * Use to automate the building of a response to an incoming request. + */ extern sn_coap_hdr_s *sn_coap_build_response(sn_coap_hdr_s *coap_packet_ptr, uint8_t msg_code); -extern void sn_coap_parser_release_allocated_coap_msg_mem(sn_coap_hdr_s *freed_coap_msg_ptr); + +/** + * CoAP packet debugging. + */ extern void sn_coap_packet_debug(sn_coap_hdr_s *coap_packet_ptr); #endif /* SN_COAP_HEADER_H_ */