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
Revision 9:9db1daa49115, committed 2014-06-16
- Comitter:
- sam_grove
- Date:
- Mon Jun 16 14:32:29 2014 -0500
- Parent:
- 8:76bbf3374796
- Child:
- 10:388450b1e776
- Commit message:
- Update headers for version 1.12
Changed in this revision
| sn_coap_protocol.h | Show annotated file Show diff for this revision Revisions of this file |
| sn_nsdl.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/sn_coap_protocol.h Mon Jun 16 17:45:56 2014 +0000
+++ b/sn_coap_protocol.h Mon Jun 16 14:32:29 2014 -0500
@@ -1,85 +1,93 @@
-/**
- * \file sn_coap_protocol.h
- *
- * \brief CoAP C-library User protocol interface header file
- *
- * Created on: Jun 30, 2011
- * Author: tero
- *
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef SN_COAP_PROTOCOL_H_
-#define SN_COAP_PROTOCOL_H_
-
-
-/* * * * * * * * * * * * * * * * * * * * * * */
-/* * * * EXTERNAL FUNCTION PROTOTYPES * * * */
-/* * * * * * * * * * * * * * * * * * * * * * */
-
-/**
- * \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.
- */
-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 *));
-
-/**
- * \brief Frees all allocated memory in libCoap protocol part.
- */
-extern int8_t sn_coap_protocol_destroy(void);
-
-/**
- * \brief 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);
-
-/**
- * \brief 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);
+/**
+ * \file sn_coap_protocol.h
+ *
+ * \brief CoAP C-library User protocol interface header file
+ *
+ * Created on: Jun 30, 2011
+ * Author: tero
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef SN_COAP_PROTOCOL_H_
+#define SN_COAP_PROTOCOL_H_
+
+
+/* * * * * * * * * * * * * * * * * * * * * * */
+/* * * * EXTERNAL FUNCTION PROTOTYPES * * * */
+/* * * * * * * * * * * * * * * * * * * * * * */
+
+/**
+ * \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.
+ */
+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 *));
+
+/**
+ * \brief Frees all allocated memory in libCoap protocol part.
+ */
+extern int8_t sn_coap_protocol_destroy(void);
+
+/**
+ * \brief 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);
+
+/**
+ * \brief 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);
+
+/**
+ * \brief 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);
+
+/**
+ * \brief If block transfer is enabled, this function changes the block size.
+ */
+extern int8_t sn_coap_protocol_set_block_size(uint16_t block_size);
+
+/**
+ * \brief 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);
+
+/**
+ * \brief If re-transmissions are enabled, this function changes resending count and interval.
+ */
+extern int8_t sn_coap_protocol_set_retransmission_parameters(uint8_t resending_count, uint8_t resending_interval);
+
+/**
+ * \brief If re-transmissions are enabled, this function changes resending buffer size.
+ */
+extern int8_t sn_coap_protocol_set_retransmission_buffer(uint8_t buffer_size_messages, uint16_t buffer_size_bytes);
+
+
+/* NSP manual registration functions */
+
+
+/**
+ * \brief Create an NSP registration message.
+ */
+extern int8_t sn_coap_register(sn_coap_hdr_s *coap_hdr_ptr, registration_info_t *endpoint_info_ptr);
+
+/**
+ * \brief 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);
+
+/**
+ * \brief 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_ */
+
+#ifdef __cplusplus
+}
+#endif
-/**
- * \brief 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);
-
-/**
- * \brief If block transfer is enabled, this function changes the block size.
- */
-extern int8_t sn_coap_protocol_set_block_size(uint16_t block_size);
-
-/**
- * \brief 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);
-
-/**
- * \brief 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 manual registration functions */
-
-/**
- * \brief Create an NSP registration message.
- */
-extern int8_t sn_coap_register(sn_coap_hdr_s *coap_hdr_ptr, registration_info_t *endpoint_info_ptr);
-
-/**
- * \brief 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);
-
-/**
- * \brief 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_ */
-
-#ifdef __cplusplus
-}
-#endif
--- a/sn_nsdl.h Mon Jun 16 17:45:56 2014 +0000
+++ b/sn_nsdl.h Mon Jun 16 14:32:29 2014 -0500
@@ -1,108 +1,116 @@
-/**
- * \file sn_nsdl.h
- *
- * \brief NanoService Devices Library generic header file
- *
- * Created on: Aug 23, 2011
- * Author: tero
- *
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#ifndef SN_NSDL_H_
-#define SN_NSDL_H_
-
-/* * * * * * * * * * * */
-/* * * * DEFINES * * * */
-/* * * * * * * * * * * */
-
-#define SN_GRS_VERSION 0x0101
-
-#ifndef SN_NSDL_HAVE_HTTP_CAPABILITY
-#define SN_NSDL_HAVE_HTTP_CAPABILITY 0
-#endif
-
-#ifndef SN_NSDL_HAVE_HTTPS_CAPABILITY
-#define SN_NSDL_HAVE_HTTPS_CAPABILITY 0
-#endif
-
-#ifndef SN_NSDL_HAVE_COAP_CAPABILITY
-#define SN_NSDL_HAVE_COAP_CAPABILITY 1
-#endif
-
-/* * * Common * * */
-
-#define SN_NSDL_SUCCESS 0
-#define SN_NSDL_FAILURE (-1)
-
-/* * * * * * * * * * * * * * */
-/* * * * ENUMERATIONS * * * */
-/* * * * * * * * * * * * * * */
-
-
-/**
- * \brief Used protocol
- */
-typedef enum sn_nsdl_capab_
-{
- SN_NSDL_PROTOCOL_HTTP = 0x01, /**< Unsupported */
- SN_NSDL_PROTOCOL_HTTPS = 0x02, /**< Unsupported */
- SN_NSDL_PROTOCOL_COAP = 0x04 /**< Supported */
-} sn_nsdl_capab_e;
-
-/**
- * \brief Address type of given address
- */
-typedef enum sn_nsdl_addr_type_
-{
- SN_NSDL_ADDRESS_TYPE_IPV6 = 0x01, /**< Supported */
- SN_NSDL_ADDRESS_TYPE_IPV4 = 0x02, /**< Supported */
- SN_NSDL_ADDRESS_TYPE_HOSTNAME = 0x03, /**< Unsupported */
- SN_NSDL_ADDRESS_TYPE_NONE = 0xFF
-} sn_nsdl_addr_type_e;
-
-
-/* * * * * * * * * * * * * */
-/* * * * STRUCTURES * * * */
-/* * * * * * * * * * * * * */
-
-/**
- * \brief Address structure of Packet data
- */
-typedef struct sn_nsdl_addr_
-{
- sn_nsdl_addr_type_e type;
-
- uint8_t addr_len;
- uint8_t *addr_ptr;
-
- uint16_t port;
-
- void *socket_information;
-
-} sn_nsdl_addr_s;
-
-/**
- * \brief Used for creating manually NSP registration message with sn_coap_register()
- */
-typedef struct registration_info_
-{
- uint8_t *endpoint_ptr; /**< Endpoint name */
- uint8_t endpoint_len;
-
- uint8_t *endpoint_type_ptr; /**< Endpoint type */
- uint8_t endpoint_type_len;
-
- uint8_t *links_ptr; /**< Resource registration string */
- uint16_t links_len;
-
-} registration_info_t;
-
-#endif /* SN_NSDL_H_ */
-
-#ifdef __cplusplus
-}
-#endif
+/**
+ * \file sn_nsdl.h
+ *
+ * \brief NanoService Devices Library generic header file
+ *
+ * Created on: Aug 23, 2011
+ * Author: tero
+ *
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef SN_NSDL_H_
+#define SN_NSDL_H_
+
+#include <stdint.h>
+
+/* * * * * * * * * * * */
+/* * * * DEFINES * * * */
+/* * * * * * * * * * * */
+
+#define SN_GRS_VERSION 0x0101
+
+#ifndef SN_NSDL_HAVE_HTTP_CAPABILITY
+#define SN_NSDL_HAVE_HTTP_CAPABILITY 0
+#endif
+
+#ifndef SN_NSDL_HAVE_HTTPS_CAPABILITY
+#define SN_NSDL_HAVE_HTTPS_CAPABILITY 0
+#endif
+
+#ifndef SN_NSDL_HAVE_COAP_CAPABILITY
+#define SN_NSDL_HAVE_COAP_CAPABILITY 1
+#endif
+
+/* * * Common * * */
+
+#define SN_NSDL_SUCCESS 0
+#define SN_NSDL_FAILURE (-1)
+
+/* * * * * * * * * * * * * * */
+/* * * * ENUMERATIONS * * * */
+/* * * * * * * * * * * * * * */
+
+
+/**
+ * \brief Used protocol
+ */
+typedef enum sn_nsdl_capab_
+{
+ SN_NSDL_PROTOCOL_HTTP = 0x01, /**< Unsupported */
+ SN_NSDL_PROTOCOL_HTTPS = 0x02, /**< Unsupported */
+ SN_NSDL_PROTOCOL_COAP = 0x04 /**< Supported */
+} sn_nsdl_capab_e;
+
+/**
+ * \brief Address type of given address
+ */
+typedef enum sn_nsdl_addr_type_
+{
+ SN_NSDL_ADDRESS_TYPE_IPV6 = 0x01, /**< Supported */
+ SN_NSDL_ADDRESS_TYPE_IPV4 = 0x02, /**< Supported */
+ SN_NSDL_ADDRESS_TYPE_HOSTNAME = 0x03, /**< Unsupported */
+ SN_NSDL_ADDRESS_TYPE_NONE = 0xFF
+} sn_nsdl_addr_type_e;
+
+
+#define SN_NDSL_RESOURCE_NOT_REGISTERED 0
+#define SN_NDSL_RESOURCE_REGISTERING 1
+#define SN_NDSL_RESOURCE_REGISTERED 2
+
+
+/* * * * * * * * * * * * * */
+/* * * * STRUCTURES * * * */
+/* * * * * * * * * * * * * */
+
+/**
+ * \brief Address structure of Packet data
+ */
+typedef struct sn_nsdl_addr_
+{
+ sn_nsdl_addr_type_e type;
+
+ uint8_t addr_len;
+ uint8_t *addr_ptr;
+
+ uint16_t port;
+
+ void *socket_information;
+
+} sn_nsdl_addr_s;
+
+/**
+ * \brief Used for creating manually nsdl registration message with sn_coap_register()
+ */
+typedef struct registration_info_
+{
+ uint8_t *endpoint_ptr; /**< Endpoint name */
+ uint8_t endpoint_len;
+
+ uint8_t *endpoint_type_ptr; /**< Endpoint type */
+ uint8_t endpoint_type_len;
+
+ uint8_t *links_ptr; /**< Resource registration string */
+ uint16_t links_len;
+
+} registration_info_t;
+
+#endif /* SN_NSDL_H_ */
+
+#ifdef __cplusplus
+}
+#endif
+
