NSDL library for Cortex M0 platforms
sn_coap_protocol.h@2:ba12e13c569a, 2015-02-22 (annotated)
- Committer:
- ansond
- Date:
- Sun Feb 22 04:50:04 2015 +0000
- Revision:
- 2:ba12e13c569a
- Parent:
- 0:cbf069c4db24
updates to archive file
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ansond | 0:cbf069c4db24 | 1 | /** |
ansond | 0:cbf069c4db24 | 2 | * \file sn_coap_protocol.h |
ansond | 0:cbf069c4db24 | 3 | * |
ansond | 0:cbf069c4db24 | 4 | * \brief CoAP C-library User protocol interface header file |
ansond | 0:cbf069c4db24 | 5 | * |
ansond | 0:cbf069c4db24 | 6 | * Created on: Jun 30, 2011 |
ansond | 0:cbf069c4db24 | 7 | * Author: tero |
ansond | 0:cbf069c4db24 | 8 | * |
ansond | 0:cbf069c4db24 | 9 | */ |
ansond | 0:cbf069c4db24 | 10 | |
ansond | 0:cbf069c4db24 | 11 | #ifdef __cplusplus |
ansond | 0:cbf069c4db24 | 12 | extern "C" { |
ansond | 0:cbf069c4db24 | 13 | #endif |
ansond | 0:cbf069c4db24 | 14 | |
ansond | 0:cbf069c4db24 | 15 | #ifndef SN_COAP_PROTOCOL_H_ |
ansond | 0:cbf069c4db24 | 16 | #define SN_COAP_PROTOCOL_H_ |
ansond | 0:cbf069c4db24 | 17 | |
ansond | 0:cbf069c4db24 | 18 | |
ansond | 0:cbf069c4db24 | 19 | /* * * * * * * * * * * * * * * * * * * * * * */ |
ansond | 0:cbf069c4db24 | 20 | /* * * * EXTERNAL FUNCTION PROTOTYPES * * * */ |
ansond | 0:cbf069c4db24 | 21 | /* * * * * * * * * * * * * * * * * * * * * * */ |
ansond | 0:cbf069c4db24 | 22 | |
ansond | 0:cbf069c4db24 | 23 | /** |
ansond | 0:cbf069c4db24 | 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. |
ansond | 0:cbf069c4db24 | 25 | */ |
ansond | 0:cbf069c4db24 | 26 | extern int8_t sn_coap_protocol_init(void* (*used_malloc_func_ptr)(uint16_t), void (*used_free_func_ptr)(void*), |
ansond | 0:cbf069c4db24 | 27 | uint8_t (*used_tx_callback_ptr)(sn_nsdl_capab_e , uint8_t *, uint16_t, sn_nsdl_addr_s *)); |
ansond | 0:cbf069c4db24 | 28 | |
ansond | 0:cbf069c4db24 | 29 | /** |
ansond | 0:cbf069c4db24 | 30 | * \brief Frees all allocated memory in libCoap protocol part. |
ansond | 0:cbf069c4db24 | 31 | */ |
ansond | 0:cbf069c4db24 | 32 | extern int8_t sn_coap_protocol_destroy(void); |
ansond | 0:cbf069c4db24 | 33 | |
ansond | 0:cbf069c4db24 | 34 | /** |
ansond | 0:cbf069c4db24 | 35 | * \brief Use to build an outgoing message buffer from a CoAP header structure. |
ansond | 0:cbf069c4db24 | 36 | */ |
ansond | 0:cbf069c4db24 | 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); |
ansond | 0:cbf069c4db24 | 38 | |
ansond | 0:cbf069c4db24 | 39 | /** |
ansond | 0:cbf069c4db24 | 40 | * \brief Use to parse an incoming message buffer to a CoAP header structure. |
ansond | 0:cbf069c4db24 | 41 | */ |
ansond | 0:cbf069c4db24 | 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); |
ansond | 0:cbf069c4db24 | 43 | |
ansond | 0:cbf069c4db24 | 44 | /** |
ansond | 0:cbf069c4db24 | 45 | * \brief Called periodically to allow the protocol to update retransmission timers and destroy unneeded data. |
ansond | 0:cbf069c4db24 | 46 | */ |
ansond | 0:cbf069c4db24 | 47 | extern int8_t sn_coap_protocol_exec(uint32_t current_time); |
ansond | 0:cbf069c4db24 | 48 | |
ansond | 0:cbf069c4db24 | 49 | /** |
ansond | 0:cbf069c4db24 | 50 | * \brief If block transfer is enabled, this function changes the block size. |
ansond | 0:cbf069c4db24 | 51 | */ |
ansond | 0:cbf069c4db24 | 52 | extern int8_t sn_coap_protocol_set_block_size(uint16_t block_size); |
ansond | 0:cbf069c4db24 | 53 | |
ansond | 0:cbf069c4db24 | 54 | /** |
ansond | 0:cbf069c4db24 | 55 | * \brief If dublicate message detection is enabled, this function changes buffer size. |
ansond | 0:cbf069c4db24 | 56 | */ |
ansond | 0:cbf069c4db24 | 57 | extern int8_t sn_coap_protocol_set_duplicate_buffer_size(uint8_t message_count); |
ansond | 0:cbf069c4db24 | 58 | |
ansond | 0:cbf069c4db24 | 59 | /** |
ansond | 0:cbf069c4db24 | 60 | * \brief If re-transmissions are enabled, this function changes resending count and interval. |
ansond | 0:cbf069c4db24 | 61 | */ |
ansond | 0:cbf069c4db24 | 62 | extern int8_t sn_coap_protocol_set_retransmission_parameters(uint8_t resending_count, uint8_t resending_interval); |
ansond | 0:cbf069c4db24 | 63 | |
ansond | 0:cbf069c4db24 | 64 | /** |
ansond | 0:cbf069c4db24 | 65 | * \brief If re-transmissions are enabled, this function changes resending buffer size. |
ansond | 0:cbf069c4db24 | 66 | */ |
ansond | 0:cbf069c4db24 | 67 | extern int8_t sn_coap_protocol_set_retransmission_buffer(uint8_t buffer_size_messages, uint16_t buffer_size_bytes); |
ansond | 0:cbf069c4db24 | 68 | |
ansond | 0:cbf069c4db24 | 69 | |
ansond | 0:cbf069c4db24 | 70 | /* NSP manual registration functions */ |
ansond | 0:cbf069c4db24 | 71 | |
ansond | 0:cbf069c4db24 | 72 | |
ansond | 0:cbf069c4db24 | 73 | /** |
ansond | 0:cbf069c4db24 | 74 | * \brief Create an NSP registration message. |
ansond | 0:cbf069c4db24 | 75 | */ |
ansond | 0:cbf069c4db24 | 76 | extern int8_t sn_coap_register(sn_coap_hdr_s *coap_hdr_ptr, registration_info_t *endpoint_info_ptr); |
ansond | 0:cbf069c4db24 | 77 | |
ansond | 0:cbf069c4db24 | 78 | /** |
ansond | 0:cbf069c4db24 | 79 | * \brief Create an NSP update message. |
ansond | 0:cbf069c4db24 | 80 | */ |
ansond | 0:cbf069c4db24 | 81 | extern int8_t sn_coap_register_update(sn_coap_hdr_s *coap_hdr_ptr, uint8_t *location, uint8_t length); |
ansond | 0:cbf069c4db24 | 82 | |
ansond | 0:cbf069c4db24 | 83 | /** |
ansond | 0:cbf069c4db24 | 84 | * \brief Create an NSP de-registration message. |
ansond | 0:cbf069c4db24 | 85 | */ |
ansond | 0:cbf069c4db24 | 86 | extern int8_t sn_coap_deregister(sn_coap_hdr_s *coap_hdr_ptr, uint8_t *location, uint8_t length); |
ansond | 0:cbf069c4db24 | 87 | |
ansond | 0:cbf069c4db24 | 88 | #endif /* SN_COAP_PROTOCOL_H_ */ |
ansond | 0:cbf069c4db24 | 89 | |
ansond | 0:cbf069c4db24 | 90 | #ifdef __cplusplus |
ansond | 0:cbf069c4db24 | 91 | } |
ansond | 0:cbf069c4db24 | 92 | #endif |
ansond | 0:cbf069c4db24 | 93 |