NSDL C library

Dependents:   NSDL_HelloWorld_WiFi UbloxModemNanoServiceClient IOT-NSDL_HelloWorld LWM2M_NanoService_Ethernet ... more

Fork of nsdl_lib by Tero Heinonen

Note that use of this software requires acceptance of the Sensinode EULA: http://mbed.org/teams/Sensinode/code/nsdl_lib/wiki/EULA

Committer:
screamer
Date:
Mon Oct 14 14:28:21 2013 +0300
Revision:
6:1caf76131c9a
Parent:
5:da1db64e7fb9
Parent:
3:d8cb1afd7285
Child:
9:9db1daa49115
Merge

Who changed what in which revision?

UserRevisionLine numberNew contents of line
terohoo 0:58c4f13c4b9a 1 /**
terohoo 0:58c4f13c4b9a 2 * \file sn_coap_protocol.h
terohoo 0:58c4f13c4b9a 3 *
terohoo 0:58c4f13c4b9a 4 * \brief CoAP C-library User protocol interface header file
terohoo 0:58c4f13c4b9a 5 *
terohoo 0:58c4f13c4b9a 6 * Created on: Jun 30, 2011
terohoo 0:58c4f13c4b9a 7 * Author: tero
terohoo 0:58c4f13c4b9a 8 *
terohoo 0:58c4f13c4b9a 9 */
terohoo 0:58c4f13c4b9a 10
terohoo 0:58c4f13c4b9a 11 #ifdef __cplusplus
terohoo 0:58c4f13c4b9a 12 extern "C" {
terohoo 0:58c4f13c4b9a 13 #endif
terohoo 0:58c4f13c4b9a 14
terohoo 0:58c4f13c4b9a 15 #ifndef SN_COAP_PROTOCOL_H_
terohoo 0:58c4f13c4b9a 16 #define SN_COAP_PROTOCOL_H_
terohoo 0:58c4f13c4b9a 17
terohoo 0:58c4f13c4b9a 18
terohoo 0:58c4f13c4b9a 19 /* * * * * * * * * * * * * * * * * * * * * * */
terohoo 0:58c4f13c4b9a 20 /* * * * EXTERNAL FUNCTION PROTOTYPES * * * */
terohoo 0:58c4f13c4b9a 21 /* * * * * * * * * * * * * * * * * * * * * * */
terohoo 0:58c4f13c4b9a 22
screamer 2:ab50a2ab6ec9 23 /**
terohoo 5:da1db64e7fb9 24 * \brief This function sets the memory allocation and deallocation functions and used TX callback function pointer the library will use, and must be called first.
screamer 2:ab50a2ab6ec9 25 */
terohoo 0:58c4f13c4b9a 26 extern int8_t sn_coap_protocol_init(void* (*used_malloc_func_ptr)(uint16_t), void (*used_free_func_ptr)(void*),
terohoo 0:58c4f13c4b9a 27 uint8_t (*used_tx_callback_ptr)(sn_nsdl_capab_e , uint8_t *, uint16_t, sn_nsdl_addr_s *));
screamer 2:ab50a2ab6ec9 28
screamer 2:ab50a2ab6ec9 29 /**
screamer 3:d8cb1afd7285 30 * \brief Frees all allocated memory in libCoap protocol part.
screamer 2:ab50a2ab6ec9 31 */
terohoo 0:58c4f13c4b9a 32 extern int8_t sn_coap_protocol_destroy(void);
screamer 2:ab50a2ab6ec9 33
screamer 2:ab50a2ab6ec9 34 /**
screamer 3:d8cb1afd7285 35 * \brief Use to build an outgoing message buffer from a CoAP header structure.
screamer 2:ab50a2ab6ec9 36 */
terohoo 0:58c4f13c4b9a 37 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);
screamer 2:ab50a2ab6ec9 38
screamer 2:ab50a2ab6ec9 39 /**
screamer 3:d8cb1afd7285 40 * \brief Use to parse an incoming message buffer to a CoAP header structure.
screamer 2:ab50a2ab6ec9 41 */
terohoo 0:58c4f13c4b9a 42 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);
screamer 2:ab50a2ab6ec9 43
screamer 2:ab50a2ab6ec9 44 /**
screamer 3:d8cb1afd7285 45 * \brief Called periodically to allow the protocol to update retransmission timers and destroy unneeded data.
screamer 2:ab50a2ab6ec9 46 */
terohoo 0:58c4f13c4b9a 47 extern int8_t sn_coap_protocol_exec(uint32_t current_time);
screamer 2:ab50a2ab6ec9 48
screamer 2:ab50a2ab6ec9 49 /**
screamer 3:d8cb1afd7285 50 * \brief If block transfer is enabled, this function changes the block size.
screamer 2:ab50a2ab6ec9 51 */
terohoo 0:58c4f13c4b9a 52 extern int8_t sn_coap_protocol_set_block_size(uint16_t block_size);
screamer 2:ab50a2ab6ec9 53
screamer 2:ab50a2ab6ec9 54 /**
screamer 3:d8cb1afd7285 55 * \brief If dublicate message detection is enabled, this function changes buffer size.
screamer 2:ab50a2ab6ec9 56 */
terohoo 0:58c4f13c4b9a 57 extern int8_t sn_coap_protocol_set_duplicate_buffer_size(uint8_t message_count);
screamer 2:ab50a2ab6ec9 58
screamer 2:ab50a2ab6ec9 59 /**
screamer 3:d8cb1afd7285 60 * \brief If re-transmissions are enabled, this function changes resending count and buffer size.
screamer 2:ab50a2ab6ec9 61 */
terohoo 0:58c4f13c4b9a 62 extern int8_t sn_coap_protocol_set_retransmission(uint8_t resending_count, uint8_t buffer_size);
terohoo 0:58c4f13c4b9a 63
terohoo 5:da1db64e7fb9 64 /* NSP manual registration functions */
screamer 3:d8cb1afd7285 65
screamer 2:ab50a2ab6ec9 66 /**
screamer 3:d8cb1afd7285 67 * \brief Create an NSP registration message.
screamer 2:ab50a2ab6ec9 68 */
terohoo 0:58c4f13c4b9a 69 extern int8_t sn_coap_register(sn_coap_hdr_s *coap_hdr_ptr, registration_info_t *endpoint_info_ptr);
screamer 2:ab50a2ab6ec9 70
screamer 2:ab50a2ab6ec9 71 /**
screamer 3:d8cb1afd7285 72 * \brief Create an NSP update message.
screamer 2:ab50a2ab6ec9 73 */
terohoo 0:58c4f13c4b9a 74 extern int8_t sn_coap_register_update(sn_coap_hdr_s *coap_hdr_ptr, uint8_t *location, uint8_t length);
screamer 2:ab50a2ab6ec9 75
screamer 2:ab50a2ab6ec9 76 /**
screamer 3:d8cb1afd7285 77 * \brief Create an NSP de-registration message.
screamer 2:ab50a2ab6ec9 78 */
terohoo 0:58c4f13c4b9a 79 extern int8_t sn_coap_deregister(sn_coap_hdr_s *coap_hdr_ptr, uint8_t *location, uint8_t length);
terohoo 0:58c4f13c4b9a 80
terohoo 0:58c4f13c4b9a 81 #endif /* SN_COAP_PROTOCOL_H_ */
terohoo 0:58c4f13c4b9a 82
terohoo 0:58c4f13c4b9a 83 #ifdef __cplusplus
terohoo 0:58c4f13c4b9a 84 }
terohoo 0:58c4f13c4b9a 85 #endif