NSDL C library

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

Fork of nsdl_lib by Tero Heinonen

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers sn_coap_protocol.h Source File

sn_coap_protocol.h

Go to the documentation of this file.
00001 /**
00002  * \file sn_coap_protocol.h
00003  *
00004  * \brief CoAP C-library User protocol interface header file
00005  *
00006  *  Created on: Jun 30, 2011
00007  *      Author: tero
00008  *
00009  */
00010 
00011 #ifdef __cplusplus
00012 extern "C" {
00013 #endif
00014 
00015 #ifndef SN_COAP_PROTOCOL_H_
00016 #define SN_COAP_PROTOCOL_H_
00017 
00018 
00019 /* * * * * * * * * * * * * * * * * * * * * * */
00020 /* * * * EXTERNAL FUNCTION PROTOTYPES  * * * */
00021 /* * * * * * * * * * * * * * * * * * * * * * */
00022 
00023 /**
00024  * \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.
00025  */
00026 extern int8_t              sn_coap_protocol_init(void* (*used_malloc_func_ptr)(uint16_t), void (*used_free_func_ptr)(void*),
00027                                         uint8_t (*used_tx_callback_ptr)(sn_nsdl_capab_e , uint8_t *, uint16_t, sn_nsdl_addr_s *));
00028 
00029 /**
00030  * \brief Frees all allocated memory in libCoap protocol part.
00031  */
00032 extern int8_t              sn_coap_protocol_destroy(void);
00033 
00034 /**
00035  * \brief Use to build an outgoing message buffer from a CoAP header structure.
00036  */
00037 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);
00038 
00039 /**
00040  * \brief Use to parse an incoming message buffer to a CoAP header structure.
00041  */
00042 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);
00043 
00044 /**
00045  * \brief Called periodically to allow the protocol to update retransmission timers and destroy unneeded data.
00046  */
00047 extern int8_t              sn_coap_protocol_exec(uint32_t current_time);
00048 
00049 /**
00050  * \brief If block transfer is enabled, this function changes the block size.
00051  */
00052 extern int8_t              sn_coap_protocol_set_block_size(uint16_t block_size);
00053 
00054 /**
00055  * \brief If dublicate message detection is enabled, this function changes buffer size.
00056  */
00057 extern int8_t              sn_coap_protocol_set_duplicate_buffer_size(uint8_t message_count);
00058 
00059 /**
00060  * \brief If re-transmissions are enabled, this function changes resending count and interval.
00061  */
00062 extern int8_t              sn_coap_protocol_set_retransmission_parameters(uint8_t resending_count, uint8_t resending_interval);
00063 
00064 /**
00065  * \brief If re-transmissions are enabled, this function changes resending buffer size.
00066  */
00067 extern int8_t              sn_coap_protocol_set_retransmission_buffer(uint8_t buffer_size_messages, uint16_t buffer_size_bytes);
00068 
00069 
00070 /* NSP manual registration functions */
00071 
00072 
00073 /**
00074  * \brief Create an NSP registration message.
00075  */
00076 extern int8_t              sn_coap_register(sn_coap_hdr_s *coap_hdr_ptr, registration_info_t *endpoint_info_ptr);
00077 
00078 /**
00079  * \brief Create an NSP update message.
00080  */
00081 extern int8_t              sn_coap_register_update(sn_coap_hdr_s *coap_hdr_ptr, uint8_t *location, uint8_t length);
00082 
00083 /**
00084  * \brief Create an NSP de-registration message.
00085  */
00086 extern int8_t              sn_coap_deregister(sn_coap_hdr_s *coap_hdr_ptr, uint8_t *location, uint8_t length);
00087 
00088 #endif /* SN_COAP_PROTOCOL_H_ */
00089 
00090 #ifdef __cplusplus
00091 }
00092 #endif
00093