NSDL library for Cortex M0 platforms

Committer:
ansond
Date:
Sun Feb 22 04:39:16 2015 +0000
Revision:
0:cbf069c4db24
initial checkin;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ansond 0:cbf069c4db24 1 /**
ansond 0:cbf069c4db24 2 * \file sn_nsdl.h
ansond 0:cbf069c4db24 3 *
ansond 0:cbf069c4db24 4 * \brief NanoService Devices Library generic header file
ansond 0:cbf069c4db24 5 *
ansond 0:cbf069c4db24 6 * Created on: Aug 23, 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_NSDL_H_
ansond 0:cbf069c4db24 16 #define SN_NSDL_H_
ansond 0:cbf069c4db24 17
ansond 0:cbf069c4db24 18 #include <stdint.h>
ansond 0:cbf069c4db24 19
ansond 0:cbf069c4db24 20 /* * * * * * * * * * * */
ansond 0:cbf069c4db24 21 /* * * * DEFINES * * * */
ansond 0:cbf069c4db24 22 /* * * * * * * * * * * */
ansond 0:cbf069c4db24 23
ansond 0:cbf069c4db24 24 #define SN_GRS_VERSION 0x0101
ansond 0:cbf069c4db24 25
ansond 0:cbf069c4db24 26 #ifndef SN_NSDL_HAVE_HTTP_CAPABILITY
ansond 0:cbf069c4db24 27 #define SN_NSDL_HAVE_HTTP_CAPABILITY 0
ansond 0:cbf069c4db24 28 #endif
ansond 0:cbf069c4db24 29
ansond 0:cbf069c4db24 30 #ifndef SN_NSDL_HAVE_HTTPS_CAPABILITY
ansond 0:cbf069c4db24 31 #define SN_NSDL_HAVE_HTTPS_CAPABILITY 0
ansond 0:cbf069c4db24 32 #endif
ansond 0:cbf069c4db24 33
ansond 0:cbf069c4db24 34 #ifndef SN_NSDL_HAVE_COAP_CAPABILITY
ansond 0:cbf069c4db24 35 #define SN_NSDL_HAVE_COAP_CAPABILITY 1
ansond 0:cbf069c4db24 36 #endif
ansond 0:cbf069c4db24 37
ansond 0:cbf069c4db24 38 /* * * Common * * */
ansond 0:cbf069c4db24 39
ansond 0:cbf069c4db24 40 #define SN_NSDL_SUCCESS 0
ansond 0:cbf069c4db24 41 #define SN_NSDL_FAILURE (-1)
ansond 0:cbf069c4db24 42
ansond 0:cbf069c4db24 43 /* * * * * * * * * * * * * * */
ansond 0:cbf069c4db24 44 /* * * * ENUMERATIONS * * * */
ansond 0:cbf069c4db24 45 /* * * * * * * * * * * * * * */
ansond 0:cbf069c4db24 46
ansond 0:cbf069c4db24 47
ansond 0:cbf069c4db24 48 /**
ansond 0:cbf069c4db24 49 * \brief Used protocol
ansond 0:cbf069c4db24 50 */
ansond 0:cbf069c4db24 51 typedef enum sn_nsdl_capab_
ansond 0:cbf069c4db24 52 {
ansond 0:cbf069c4db24 53 SN_NSDL_PROTOCOL_HTTP = 0x01, /**< Unsupported */
ansond 0:cbf069c4db24 54 SN_NSDL_PROTOCOL_HTTPS = 0x02, /**< Unsupported */
ansond 0:cbf069c4db24 55 SN_NSDL_PROTOCOL_COAP = 0x04 /**< Supported */
ansond 0:cbf069c4db24 56 } sn_nsdl_capab_e;
ansond 0:cbf069c4db24 57
ansond 0:cbf069c4db24 58 /**
ansond 0:cbf069c4db24 59 * \brief Address type of given address
ansond 0:cbf069c4db24 60 */
ansond 0:cbf069c4db24 61 typedef enum sn_nsdl_addr_type_
ansond 0:cbf069c4db24 62 {
ansond 0:cbf069c4db24 63 SN_NSDL_ADDRESS_TYPE_IPV6 = 0x01, /**< Supported */
ansond 0:cbf069c4db24 64 SN_NSDL_ADDRESS_TYPE_IPV4 = 0x02, /**< Supported */
ansond 0:cbf069c4db24 65 SN_NSDL_ADDRESS_TYPE_HOSTNAME = 0x03, /**< Unsupported */
ansond 0:cbf069c4db24 66 SN_NSDL_ADDRESS_TYPE_NONE = 0xFF
ansond 0:cbf069c4db24 67 } sn_nsdl_addr_type_e;
ansond 0:cbf069c4db24 68
ansond 0:cbf069c4db24 69
ansond 0:cbf069c4db24 70 #define SN_NDSL_RESOURCE_NOT_REGISTERED 0
ansond 0:cbf069c4db24 71 #define SN_NDSL_RESOURCE_REGISTERING 1
ansond 0:cbf069c4db24 72 #define SN_NDSL_RESOURCE_REGISTERED 2
ansond 0:cbf069c4db24 73
ansond 0:cbf069c4db24 74
ansond 0:cbf069c4db24 75 /* * * * * * * * * * * * * */
ansond 0:cbf069c4db24 76 /* * * * STRUCTURES * * * */
ansond 0:cbf069c4db24 77 /* * * * * * * * * * * * * */
ansond 0:cbf069c4db24 78
ansond 0:cbf069c4db24 79 /**
ansond 0:cbf069c4db24 80 * \brief Address structure of Packet data
ansond 0:cbf069c4db24 81 */
ansond 0:cbf069c4db24 82 typedef struct sn_nsdl_addr_
ansond 0:cbf069c4db24 83 {
ansond 0:cbf069c4db24 84 sn_nsdl_addr_type_e type;
ansond 0:cbf069c4db24 85
ansond 0:cbf069c4db24 86 uint8_t addr_len;
ansond 0:cbf069c4db24 87 uint8_t *addr_ptr;
ansond 0:cbf069c4db24 88
ansond 0:cbf069c4db24 89 uint16_t port;
ansond 0:cbf069c4db24 90
ansond 0:cbf069c4db24 91 void *socket_information;
ansond 0:cbf069c4db24 92
ansond 0:cbf069c4db24 93 } sn_nsdl_addr_s;
ansond 0:cbf069c4db24 94
ansond 0:cbf069c4db24 95 /**
ansond 0:cbf069c4db24 96 * \brief Used for creating manually nsdl registration message with sn_coap_register()
ansond 0:cbf069c4db24 97 */
ansond 0:cbf069c4db24 98 typedef struct registration_info_
ansond 0:cbf069c4db24 99 {
ansond 0:cbf069c4db24 100 uint8_t *endpoint_ptr; /**< Endpoint name */
ansond 0:cbf069c4db24 101 uint8_t endpoint_len;
ansond 0:cbf069c4db24 102
ansond 0:cbf069c4db24 103 uint8_t *domain_name_ptr; /**< Domain name */
ansond 0:cbf069c4db24 104 uint8_t domain_name_len;
ansond 0:cbf069c4db24 105
ansond 0:cbf069c4db24 106 uint8_t *endpoint_type_ptr; /**< Endpoint type */
ansond 0:cbf069c4db24 107 uint8_t endpoint_type_len;
ansond 0:cbf069c4db24 108
ansond 0:cbf069c4db24 109 uint8_t *links_ptr; /**< Resource registration string */
ansond 0:cbf069c4db24 110 uint16_t links_len;
ansond 0:cbf069c4db24 111
ansond 0:cbf069c4db24 112 } registration_info_t;
ansond 0:cbf069c4db24 113
ansond 0:cbf069c4db24 114 #endif /* SN_NSDL_H_ */
ansond 0:cbf069c4db24 115
ansond 0:cbf069c4db24 116 #ifdef __cplusplus
ansond 0:cbf069c4db24 117 }
ansond 0:cbf069c4db24 118 #endif
ansond 0:cbf069c4db24 119