Doug Anson / libnsdl
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers sn_nsdl.h Source File

sn_nsdl.h

Go to the documentation of this file.
00001 /**
00002  * \file sn_nsdl.h
00003  *
00004  * \brief NanoService Devices Library generic header file
00005  *
00006  *  Created on: Aug 23, 2011
00007  *      Author: tero
00008  *
00009  */
00010 
00011 #ifdef __cplusplus
00012 extern "C" {
00013 #endif
00014 
00015 #ifndef SN_NSDL_H_
00016 #define SN_NSDL_H_
00017 
00018 #include <stdint.h>
00019 
00020 /* * * * * * * * * * * */
00021 /* * * * DEFINES * * * */
00022 /* * * * * * * * * * * */
00023 
00024 #define SN_GRS_VERSION                  0x0101
00025 
00026 #ifndef SN_NSDL_HAVE_HTTP_CAPABILITY
00027 #define SN_NSDL_HAVE_HTTP_CAPABILITY        0
00028 #endif
00029 
00030 #ifndef SN_NSDL_HAVE_HTTPS_CAPABILITY
00031 #define SN_NSDL_HAVE_HTTPS_CAPABILITY       0
00032 #endif
00033 
00034 #ifndef SN_NSDL_HAVE_COAP_CAPABILITY
00035 #define SN_NSDL_HAVE_COAP_CAPABILITY        1
00036 #endif
00037 
00038 /* * * Common * * */
00039 
00040 #define SN_NSDL_SUCCESS  0
00041 #define SN_NSDL_FAILURE (-1)
00042 
00043 /* * * * * * * * * * * * * * */
00044 /* * * * ENUMERATIONS  * * * */
00045 /* * * * * * * * * * * * * * */
00046 
00047 
00048 /**
00049  * \brief Used protocol
00050  */
00051 typedef enum sn_nsdl_capab_
00052 {
00053     SN_NSDL_PROTOCOL_HTTP           = 0x01,         /**< Unsupported */
00054     SN_NSDL_PROTOCOL_HTTPS          = 0x02,         /**< Unsupported */
00055     SN_NSDL_PROTOCOL_COAP           = 0x04          /**< Supported */
00056 } sn_nsdl_capab_e;
00057 
00058 /**
00059  * \brief Address type of given address
00060  */
00061 typedef enum sn_nsdl_addr_type_
00062 {
00063     SN_NSDL_ADDRESS_TYPE_IPV6       = 0x01,         /**< Supported */
00064     SN_NSDL_ADDRESS_TYPE_IPV4       = 0x02,         /**< Supported */
00065     SN_NSDL_ADDRESS_TYPE_HOSTNAME   = 0x03,         /**< Unsupported */
00066     SN_NSDL_ADDRESS_TYPE_NONE       = 0xFF
00067 } sn_nsdl_addr_type_e;
00068 
00069 
00070 #define SN_NDSL_RESOURCE_NOT_REGISTERED 0
00071 #define SN_NDSL_RESOURCE_REGISTERING    1
00072 #define SN_NDSL_RESOURCE_REGISTERED     2
00073 
00074 
00075 /* * * * * * * * * * * * * */
00076 /* * * * STRUCTURES  * * * */
00077 /* * * * * * * * * * * * * */
00078 
00079 /**
00080  * \brief Address structure of Packet data
00081  */
00082 typedef struct sn_nsdl_addr_
00083 {
00084     sn_nsdl_addr_type_e     type;
00085 
00086     uint8_t                 addr_len;
00087     uint8_t                *addr_ptr;
00088 
00089     uint16_t                port;
00090 
00091     void                    *socket_information;
00092 
00093 } sn_nsdl_addr_s;
00094 
00095 /**
00096  * \brief Used for creating manually nsdl registration message with sn_coap_register()
00097  */
00098 typedef struct registration_info_
00099 {
00100     uint8_t *endpoint_ptr;          /**< Endpoint name */
00101     uint8_t endpoint_len;
00102     
00103     uint8_t *domain_name_ptr;       /**< Domain name */
00104     uint8_t domain_name_len;        
00105 
00106     uint8_t *endpoint_type_ptr;     /**< Endpoint type */
00107     uint8_t endpoint_type_len;
00108 
00109     uint8_t *links_ptr;             /**< Resource registration string */
00110     uint16_t links_len;
00111 
00112 } registration_info_t;
00113 
00114 #endif /* SN_NSDL_H_ */
00115 
00116 #ifdef __cplusplus
00117 }
00118 #endif
00119