Manual NanoService C Client 1.11-RC2 import

Dependents:   Trenton_Doormat_FRDM-KL25Z_ETH

Committer:
zdshelby
Date:
Tue Feb 18 01:10:07 2014 +0000
Revision:
1:14a9b0f4b9d6
Parent:
0:aafd54b05111
- Added libnsdl import

Who changed what in which revision?

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