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
sn_nsdl.h@3:d8cb1afd7285, 2013-10-10 (annotated)
- Committer:
- screamer
- Date:
- Thu Oct 10 10:24:59 2013 +0000
- Revision:
- 3:d8cb1afd7285
- Parent:
- 1:01d723824294
- Child:
- 4:0f845ba8adff
More doxygen markup #3
Who changed what in which revision?
User | Revision | Line number | New 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 | |
screamer | 1:01d723824294 | 71 | /** |
screamer | 3:d8cb1afd7285 | 72 | * \brief Address structure of Packet data |
screamer | 1:01d723824294 | 73 | */ |
terohoo | 0:58c4f13c4b9a | 74 | typedef struct sn_nsdl_addr_ |
terohoo | 0:58c4f13c4b9a | 75 | { |
terohoo | 0:58c4f13c4b9a | 76 | sn_nsdl_addr_type_e type; |
terohoo | 0:58c4f13c4b9a | 77 | |
terohoo | 0:58c4f13c4b9a | 78 | uint8_t addr_len; |
terohoo | 0:58c4f13c4b9a | 79 | uint8_t *addr_ptr; |
terohoo | 0:58c4f13c4b9a | 80 | |
terohoo | 0:58c4f13c4b9a | 81 | uint16_t port; |
terohoo | 0:58c4f13c4b9a | 82 | |
terohoo | 0:58c4f13c4b9a | 83 | void *socket_information; |
terohoo | 0:58c4f13c4b9a | 84 | |
terohoo | 0:58c4f13c4b9a | 85 | } sn_nsdl_addr_s; |
terohoo | 0:58c4f13c4b9a | 86 | |
screamer | 1:01d723824294 | 87 | /** |
screamer | 3:d8cb1afd7285 | 88 | * \brief This structure is returned by sn_coap_exec() for sending |
screamer | 1:01d723824294 | 89 | */ |
terohoo | 0:58c4f13c4b9a | 90 | typedef struct sn_nsdl_transmit_ |
terohoo | 0:58c4f13c4b9a | 91 | { |
terohoo | 0:58c4f13c4b9a | 92 | sn_nsdl_addr_s *dst_addr_ptr; |
terohoo | 0:58c4f13c4b9a | 93 | |
terohoo | 0:58c4f13c4b9a | 94 | sn_nsdl_capab_e protocol; |
terohoo | 0:58c4f13c4b9a | 95 | |
terohoo | 0:58c4f13c4b9a | 96 | uint16_t packet_len; |
terohoo | 0:58c4f13c4b9a | 97 | uint8_t *packet_ptr; |
terohoo | 0:58c4f13c4b9a | 98 | } sn_nsdl_transmit_s; |
terohoo | 0:58c4f13c4b9a | 99 | |
screamer | 3:d8cb1afd7285 | 100 | /** |
screamer | 3:d8cb1afd7285 | 101 | * \brief Used for creating manually nsdl registration message with sn_coap_register() |
screamer | 3:d8cb1afd7285 | 102 | */ |
terohoo | 0:58c4f13c4b9a | 103 | typedef struct registration_info_ |
terohoo | 0:58c4f13c4b9a | 104 | { |
screamer | 3:d8cb1afd7285 | 105 | uint8_t *endpoint_ptr; /**< Endpoint name */ |
terohoo | 0:58c4f13c4b9a | 106 | uint8_t endpoint_len; |
terohoo | 0:58c4f13c4b9a | 107 | |
screamer | 3:d8cb1afd7285 | 108 | uint8_t *endpoint_type_ptr; /**< Endpoint type */ |
terohoo | 0:58c4f13c4b9a | 109 | uint8_t endpoint_type_len; |
terohoo | 0:58c4f13c4b9a | 110 | |
screamer | 3:d8cb1afd7285 | 111 | uint8_t *links_ptr; /**< Resource registration string */ |
terohoo | 0:58c4f13c4b9a | 112 | uint16_t links_len; |
terohoo | 0:58c4f13c4b9a | 113 | |
terohoo | 0:58c4f13c4b9a | 114 | }registration_info_t; |
terohoo | 0:58c4f13c4b9a | 115 | |
terohoo | 0:58c4f13c4b9a | 116 | #endif /* SN_NSDL_H_ */ |
terohoo | 0:58c4f13c4b9a | 117 | |
terohoo | 0:58c4f13c4b9a | 118 | #ifdef __cplusplus |
terohoo | 0:58c4f13c4b9a | 119 | } |
terohoo | 0:58c4f13c4b9a | 120 | #endif |