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@4:0f845ba8adff, 2013-10-10 (annotated)
- Committer:
- screamer
- Date:
- Thu Oct 10 11:39:55 2013 +0000
- Revision:
- 4:0f845ba8adff
- Parent:
- 3:d8cb1afd7285
- Child:
- 6:1caf76131c9a
Even more doxygen markup #4
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 | |
screamer | 4:0f845ba8adff | 46 | /** |
screamer | 4:0f845ba8adff | 47 | * \brief Used protocol |
screamer | 4:0f845ba8adff | 48 | */ |
terohoo | 0:58c4f13c4b9a | 49 | typedef enum sn_nsdl_capab_ |
terohoo | 0:58c4f13c4b9a | 50 | { |
screamer | 4:0f845ba8adff | 51 | SN_NSDL_PROTOCOL_HTTP = 0x01, /**< Unsupported */ |
screamer | 4:0f845ba8adff | 52 | SN_NSDL_PROTOCOL_HTTPS = 0x02, /**< Unsupported */ |
screamer | 4:0f845ba8adff | 53 | SN_NSDL_PROTOCOL_COAP = 0x04 /**< Supported */ |
terohoo | 0:58c4f13c4b9a | 54 | } sn_nsdl_capab_e; |
terohoo | 0:58c4f13c4b9a | 55 | |
screamer | 4:0f845ba8adff | 56 | /** |
screamer | 4:0f845ba8adff | 57 | * \brief Address type of given address |
screamer | 4:0f845ba8adff | 58 | */ |
terohoo | 0:58c4f13c4b9a | 59 | typedef enum sn_nsdl_addr_type_ |
terohoo | 0:58c4f13c4b9a | 60 | { |
screamer | 4:0f845ba8adff | 61 | SN_NSDL_ADDRESS_TYPE_IPV6 = 0x01, /**< Supported */ |
screamer | 4:0f845ba8adff | 62 | SN_NSDL_ADDRESS_TYPE_IPV4 = 0x02, /**< Supported */ |
screamer | 4:0f845ba8adff | 63 | SN_NSDL_ADDRESS_TYPE_HOSTNAME = 0x03, /**< Unsupported */ |
terohoo | 0:58c4f13c4b9a | 64 | SN_NSDL_ADDRESS_TYPE_NONE = 0xFF |
terohoo | 0:58c4f13c4b9a | 65 | } sn_nsdl_addr_type_e; |
terohoo | 0:58c4f13c4b9a | 66 | |
terohoo | 0:58c4f13c4b9a | 67 | |
terohoo | 0:58c4f13c4b9a | 68 | #define SN_NDSL_RESOURCE_NOT_REGISTERED 0 |
terohoo | 0:58c4f13c4b9a | 69 | #define SN_NDSL_RESOURCE_REGISTERING 1 |
terohoo | 0:58c4f13c4b9a | 70 | #define SN_NDSL_RESOURCE_REGISTERED 2 |
terohoo | 0:58c4f13c4b9a | 71 | |
terohoo | 0:58c4f13c4b9a | 72 | |
terohoo | 0:58c4f13c4b9a | 73 | /* * * * * * * * * * * * * */ |
terohoo | 0:58c4f13c4b9a | 74 | /* * * * STRUCTURES * * * */ |
terohoo | 0:58c4f13c4b9a | 75 | /* * * * * * * * * * * * * */ |
terohoo | 0:58c4f13c4b9a | 76 | |
screamer | 1:01d723824294 | 77 | /** |
screamer | 3:d8cb1afd7285 | 78 | * \brief Address structure of Packet data |
screamer | 1:01d723824294 | 79 | */ |
terohoo | 0:58c4f13c4b9a | 80 | typedef struct sn_nsdl_addr_ |
terohoo | 0:58c4f13c4b9a | 81 | { |
terohoo | 0:58c4f13c4b9a | 82 | sn_nsdl_addr_type_e type; |
terohoo | 0:58c4f13c4b9a | 83 | |
terohoo | 0:58c4f13c4b9a | 84 | uint8_t addr_len; |
terohoo | 0:58c4f13c4b9a | 85 | uint8_t *addr_ptr; |
terohoo | 0:58c4f13c4b9a | 86 | |
terohoo | 0:58c4f13c4b9a | 87 | uint16_t port; |
terohoo | 0:58c4f13c4b9a | 88 | |
terohoo | 0:58c4f13c4b9a | 89 | void *socket_information; |
terohoo | 0:58c4f13c4b9a | 90 | |
terohoo | 0:58c4f13c4b9a | 91 | } sn_nsdl_addr_s; |
terohoo | 0:58c4f13c4b9a | 92 | |
screamer | 1:01d723824294 | 93 | /** |
screamer | 3:d8cb1afd7285 | 94 | * \brief This structure is returned by sn_coap_exec() for sending |
screamer | 1:01d723824294 | 95 | */ |
terohoo | 0:58c4f13c4b9a | 96 | typedef struct sn_nsdl_transmit_ |
terohoo | 0:58c4f13c4b9a | 97 | { |
terohoo | 0:58c4f13c4b9a | 98 | sn_nsdl_addr_s *dst_addr_ptr; |
terohoo | 0:58c4f13c4b9a | 99 | |
terohoo | 0:58c4f13c4b9a | 100 | sn_nsdl_capab_e protocol; |
terohoo | 0:58c4f13c4b9a | 101 | |
terohoo | 0:58c4f13c4b9a | 102 | uint16_t packet_len; |
terohoo | 0:58c4f13c4b9a | 103 | uint8_t *packet_ptr; |
terohoo | 0:58c4f13c4b9a | 104 | } sn_nsdl_transmit_s; |
terohoo | 0:58c4f13c4b9a | 105 | |
screamer | 3:d8cb1afd7285 | 106 | /** |
screamer | 3:d8cb1afd7285 | 107 | * \brief Used for creating manually nsdl registration message with sn_coap_register() |
screamer | 3:d8cb1afd7285 | 108 | */ |
terohoo | 0:58c4f13c4b9a | 109 | typedef struct registration_info_ |
terohoo | 0:58c4f13c4b9a | 110 | { |
screamer | 3:d8cb1afd7285 | 111 | uint8_t *endpoint_ptr; /**< Endpoint name */ |
terohoo | 0:58c4f13c4b9a | 112 | uint8_t endpoint_len; |
terohoo | 0:58c4f13c4b9a | 113 | |
screamer | 3:d8cb1afd7285 | 114 | uint8_t *endpoint_type_ptr; /**< Endpoint type */ |
terohoo | 0:58c4f13c4b9a | 115 | uint8_t endpoint_type_len; |
terohoo | 0:58c4f13c4b9a | 116 | |
screamer | 3:d8cb1afd7285 | 117 | uint8_t *links_ptr; /**< Resource registration string */ |
terohoo | 0:58c4f13c4b9a | 118 | uint16_t links_len; |
terohoo | 0:58c4f13c4b9a | 119 | |
screamer | 4:0f845ba8adff | 120 | } registration_info_t; |
terohoo | 0:58c4f13c4b9a | 121 | |
terohoo | 0:58c4f13c4b9a | 122 | #endif /* SN_NSDL_H_ */ |
terohoo | 0:58c4f13c4b9a | 123 | |
terohoo | 0:58c4f13c4b9a | 124 | #ifdef __cplusplus |
terohoo | 0:58c4f13c4b9a | 125 | } |
terohoo | 0:58c4f13c4b9a | 126 | #endif |