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:
terohoo
Date:
Wed Oct 09 09:20:29 2013 +0000
Revision:
0:58c4f13c4b9a
Child:
1:01d723824294
Child:
5:da1db64e7fb9
Adding nsdl_lib

Who changed what in which revision?

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