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_protocol.h
- Revision:
- 2:ab50a2ab6ec9
- Parent:
- 1:01d723824294
- Child:
- 3:d8cb1afd7285
--- a/sn_coap_protocol.h Wed Oct 09 14:18:21 2013 +0000 +++ b/sn_coap_protocol.h Wed Oct 09 14:57:33 2013 +0000 @@ -69,19 +69,61 @@ /* * * * EXTERNAL FUNCTION PROTOTYPES * * * */ /* * * * * * * * * * * * * * * * * * * * * * */ +/** + * This function sets the memory allocation and deallocation functions the library will use, and must be called first. + */ extern int8_t sn_coap_protocol_init(void* (*used_malloc_func_ptr)(uint16_t), void (*used_free_func_ptr)(void*), uint8_t (*used_tx_callback_ptr)(sn_nsdl_capab_e , uint8_t *, uint16_t, sn_nsdl_addr_s *)); + +/** + * Frees all allocated memory in libCoap protocol part. + */ extern int8_t sn_coap_protocol_destroy(void); + +/** + * Use to build an outgoing message buffer from a CoAP header structure. + */ extern int16_t sn_coap_protocol_build(sn_nsdl_addr_s *dst_addr_ptr, uint8_t *dst_packet_data_ptr, sn_coap_hdr_s *src_coap_msg_ptr); + +/** + * Use to parse an incoming message buffer to a CoAP header structure. + */ extern sn_coap_hdr_s *sn_coap_protocol_parse(sn_nsdl_addr_s *src_addr_ptr, uint16_t packet_data_len, uint8_t *packet_data_ptr); + +/** + * Called periodically to allow the protocol to update retransmission timers and destroy unneeded data. + */ extern int8_t sn_coap_protocol_exec(uint32_t current_time); + +/** + * If block transfer is enabled, this function changes the block size. + */ extern int8_t sn_coap_protocol_set_block_size(uint16_t block_size); + +/** + * If dublicate message detection is enabled, this function changes buffer size. + */ extern int8_t sn_coap_protocol_set_duplicate_buffer_size(uint8_t message_count); + +/** + * If re-transmissions are enabled, this function changes resending count and buffer size. + */ extern int8_t sn_coap_protocol_set_retransmission(uint8_t resending_count, uint8_t buffer_size); /* NSP registration functions */ +/** + * Create an NSP registration message. + */ extern int8_t sn_coap_register(sn_coap_hdr_s *coap_hdr_ptr, registration_info_t *endpoint_info_ptr); + +/** + * Create an NSP update message. + */ extern int8_t sn_coap_register_update(sn_coap_hdr_s *coap_hdr_ptr, uint8_t *location, uint8_t length); + +/** + * Create an NSP de-registration message. + */ extern int8_t sn_coap_deregister(sn_coap_hdr_s *coap_hdr_ptr, uint8_t *location, uint8_t length); #endif /* SN_COAP_PROTOCOL_H_ */