This is a fork due to permission issues

Dependencies:   mbed Socket lwip-eth lwip-sys lwip

Fork of 6_songs-from-the-cloud by MakingMusicWorkshop

Committer:
timbeight
Date:
Thu May 19 16:02:10 2016 +0000
Revision:
1:0ddbe2d3319c
Parent:
0:f7c60d3e7b8a
This is my first commit while in the class.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
maclobdell 0:f7c60d3e7b8a 1 /*
maclobdell 0:f7c60d3e7b8a 2 * Copyright (c) 2011-2015 ARM Limited. All rights reserved.
maclobdell 0:f7c60d3e7b8a 3 * SPDX-License-Identifier: Apache-2.0
maclobdell 0:f7c60d3e7b8a 4 * Licensed under the Apache License, Version 2.0 (the License); you may
maclobdell 0:f7c60d3e7b8a 5 * not use this file except in compliance with the License.
maclobdell 0:f7c60d3e7b8a 6 * You may obtain a copy of the License at
maclobdell 0:f7c60d3e7b8a 7 *
maclobdell 0:f7c60d3e7b8a 8 * http://www.apache.org/licenses/LICENSE-2.0
maclobdell 0:f7c60d3e7b8a 9 *
maclobdell 0:f7c60d3e7b8a 10 * Unless required by applicable law or agreed to in writing, software
maclobdell 0:f7c60d3e7b8a 11 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
maclobdell 0:f7c60d3e7b8a 12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
maclobdell 0:f7c60d3e7b8a 13 * See the License for the specific language governing permissions and
maclobdell 0:f7c60d3e7b8a 14 * limitations under the License.
maclobdell 0:f7c60d3e7b8a 15 */
maclobdell 0:f7c60d3e7b8a 16
maclobdell 0:f7c60d3e7b8a 17 /**
maclobdell 0:f7c60d3e7b8a 18 * \file sn_nsdl_lib.h
maclobdell 0:f7c60d3e7b8a 19 *
maclobdell 0:f7c60d3e7b8a 20 * \brief NanoService Devices Library header file
maclobdell 0:f7c60d3e7b8a 21 *
maclobdell 0:f7c60d3e7b8a 22 *
maclobdell 0:f7c60d3e7b8a 23 */
maclobdell 0:f7c60d3e7b8a 24
maclobdell 0:f7c60d3e7b8a 25 #ifndef SN_NSDL_LIB_H_
maclobdell 0:f7c60d3e7b8a 26 #define SN_NSDL_LIB_H_
maclobdell 0:f7c60d3e7b8a 27
maclobdell 0:f7c60d3e7b8a 28 #include "ns_list.h"
maclobdell 0:f7c60d3e7b8a 29
maclobdell 0:f7c60d3e7b8a 30 #ifdef __cplusplus
maclobdell 0:f7c60d3e7b8a 31 extern "C" {
maclobdell 0:f7c60d3e7b8a 32 #endif
maclobdell 0:f7c60d3e7b8a 33
maclobdell 0:f7c60d3e7b8a 34 #define SN_NSDL_ENDPOINT_NOT_REGISTERED 0
maclobdell 0:f7c60d3e7b8a 35 #define SN_NSDL_ENDPOINT_IS_REGISTERED 1
maclobdell 0:f7c60d3e7b8a 36
maclobdell 0:f7c60d3e7b8a 37 /* Handle structure */
maclobdell 0:f7c60d3e7b8a 38 struct nsdl_s;
maclobdell 0:f7c60d3e7b8a 39
maclobdell 0:f7c60d3e7b8a 40 /**
maclobdell 0:f7c60d3e7b8a 41 * \brief Received device server security
maclobdell 0:f7c60d3e7b8a 42 */
maclobdell 0:f7c60d3e7b8a 43 typedef enum omalw_server_security_ {
maclobdell 0:f7c60d3e7b8a 44 SEC_NOT_SET = -1,
maclobdell 0:f7c60d3e7b8a 45 PSK = 0,
maclobdell 0:f7c60d3e7b8a 46 RPK = 1,
maclobdell 0:f7c60d3e7b8a 47 CERTIFICATE = 2,
maclobdell 0:f7c60d3e7b8a 48 NO_SEC = 3
maclobdell 0:f7c60d3e7b8a 49 } omalw_server_security_t;
maclobdell 0:f7c60d3e7b8a 50
maclobdell 0:f7c60d3e7b8a 51 /**
maclobdell 0:f7c60d3e7b8a 52 * \brief Endpoint binding and mode
maclobdell 0:f7c60d3e7b8a 53 */
maclobdell 0:f7c60d3e7b8a 54 typedef enum sn_nsdl_oma_binding_and_mode_ {
maclobdell 0:f7c60d3e7b8a 55 BINDING_MODE_NOT_SET = 0,
maclobdell 0:f7c60d3e7b8a 56 BINDING_MODE_U = 0x01,
maclobdell 0:f7c60d3e7b8a 57 BINDING_MODE_Q = 0x02,
maclobdell 0:f7c60d3e7b8a 58 BINDING_MODE_S = 0x04
maclobdell 0:f7c60d3e7b8a 59 } sn_nsdl_oma_binding_and_mode_t;
maclobdell 0:f7c60d3e7b8a 60
maclobdell 0:f7c60d3e7b8a 61 /**
maclobdell 0:f7c60d3e7b8a 62 * \brief Endpoint registration mode.
maclobdell 0:f7c60d3e7b8a 63 * If REGISTER_WITH_RESOURCES, endpoint sends list of all resources during registration.
maclobdell 0:f7c60d3e7b8a 64 * If REGISTER_WITH_TEMPLATE, endpoint sends registration without resource list. Device server must have
maclobdell 0:f7c60d3e7b8a 65 * correctly configured template.
maclobdell 0:f7c60d3e7b8a 66 */
maclobdell 0:f7c60d3e7b8a 67 typedef enum sn_nsdl_registration_mode_ {
maclobdell 0:f7c60d3e7b8a 68 REGISTER_WITH_RESOURCES = 0,
maclobdell 0:f7c60d3e7b8a 69 REGISTER_WITH_TEMPLATE
maclobdell 0:f7c60d3e7b8a 70 } sn_nsdl_registration_mode_t;
maclobdell 0:f7c60d3e7b8a 71
maclobdell 0:f7c60d3e7b8a 72
maclobdell 0:f7c60d3e7b8a 73 typedef struct omalw_certificate_list_ {
maclobdell 0:f7c60d3e7b8a 74 uint8_t certificate_chain_len;
maclobdell 0:f7c60d3e7b8a 75 uint8_t *certificate_ptr[2];
maclobdell 0:f7c60d3e7b8a 76 uint16_t certificate_len[2];
maclobdell 0:f7c60d3e7b8a 77 uint8_t *own_private_key_ptr;
maclobdell 0:f7c60d3e7b8a 78 uint16_t own_private_key_len;
maclobdell 0:f7c60d3e7b8a 79 } omalw_certificate_list_t;
maclobdell 0:f7c60d3e7b8a 80
maclobdell 0:f7c60d3e7b8a 81 /**
maclobdell 0:f7c60d3e7b8a 82 * \brief Endpoint registration parameters
maclobdell 0:f7c60d3e7b8a 83 */
maclobdell 0:f7c60d3e7b8a 84 typedef struct sn_nsdl_ep_parameters_ {
maclobdell 0:f7c60d3e7b8a 85 uint8_t *endpoint_name_ptr; /**< Endpoint name */
maclobdell 0:f7c60d3e7b8a 86 uint8_t endpoint_name_len;
maclobdell 0:f7c60d3e7b8a 87
maclobdell 0:f7c60d3e7b8a 88 uint8_t *domain_name_ptr; /**< Domain to register. If null, NSP uses default domain */
maclobdell 0:f7c60d3e7b8a 89 uint8_t domain_name_len;
maclobdell 0:f7c60d3e7b8a 90
maclobdell 0:f7c60d3e7b8a 91 uint8_t *type_ptr; /**< Endpoint type */
maclobdell 0:f7c60d3e7b8a 92 uint8_t type_len;
maclobdell 0:f7c60d3e7b8a 93
maclobdell 0:f7c60d3e7b8a 94 uint8_t *lifetime_ptr; /**< Endpoint lifetime in seconds. eg. "1200" = 1200 seconds */
maclobdell 0:f7c60d3e7b8a 95 uint8_t lifetime_len;
maclobdell 0:f7c60d3e7b8a 96
maclobdell 0:f7c60d3e7b8a 97 sn_nsdl_registration_mode_t ds_register_mode; /**< Defines registration mode */
maclobdell 0:f7c60d3e7b8a 98 sn_nsdl_oma_binding_and_mode_t binding_and_mode; /**< Defines endpoints binding and mode */
maclobdell 0:f7c60d3e7b8a 99
maclobdell 0:f7c60d3e7b8a 100 uint8_t *location_ptr; /**< Endpoint location in server, optional parameter,default is NULL */
maclobdell 0:f7c60d3e7b8a 101 uint8_t location_len;
maclobdell 0:f7c60d3e7b8a 102
maclobdell 0:f7c60d3e7b8a 103 } sn_nsdl_ep_parameters_s;
maclobdell 0:f7c60d3e7b8a 104
maclobdell 0:f7c60d3e7b8a 105 /**
maclobdell 0:f7c60d3e7b8a 106 * \brief For internal use
maclobdell 0:f7c60d3e7b8a 107 */
maclobdell 0:f7c60d3e7b8a 108 typedef struct sn_nsdl_sent_messages_ {
maclobdell 0:f7c60d3e7b8a 109 uint16_t msg_id_number;
maclobdell 0:f7c60d3e7b8a 110 uint8_t message_type;
maclobdell 0:f7c60d3e7b8a 111 ns_list_link_t link;
maclobdell 0:f7c60d3e7b8a 112 } sn_nsdl_sent_messages_s;
maclobdell 0:f7c60d3e7b8a 113
maclobdell 0:f7c60d3e7b8a 114 /**
maclobdell 0:f7c60d3e7b8a 115 * \brief Includes resource path
maclobdell 0:f7c60d3e7b8a 116 */
maclobdell 0:f7c60d3e7b8a 117 typedef struct sn_grs_resource_ {
maclobdell 0:f7c60d3e7b8a 118 uint8_t pathlen;
maclobdell 0:f7c60d3e7b8a 119 uint8_t *path;
maclobdell 0:f7c60d3e7b8a 120 } sn_grs_resource_s;
maclobdell 0:f7c60d3e7b8a 121
maclobdell 0:f7c60d3e7b8a 122 /**
maclobdell 0:f7c60d3e7b8a 123 * \brief Table of created resources
maclobdell 0:f7c60d3e7b8a 124 */
maclobdell 0:f7c60d3e7b8a 125 typedef struct sn_grs_resource_list_ {
maclobdell 0:f7c60d3e7b8a 126 uint8_t res_count; /**< Number of resources */
maclobdell 0:f7c60d3e7b8a 127 sn_grs_resource_s *res;
maclobdell 0:f7c60d3e7b8a 128 } sn_grs_resource_list_s;
maclobdell 0:f7c60d3e7b8a 129
maclobdell 0:f7c60d3e7b8a 130 /**
maclobdell 0:f7c60d3e7b8a 131 * \brief Resource access rights
maclobdell 0:f7c60d3e7b8a 132 */
maclobdell 0:f7c60d3e7b8a 133 typedef enum sn_grs_resource_acl_ {
maclobdell 0:f7c60d3e7b8a 134 SN_GRS_GET_ALLOWED = 0x01 ,
maclobdell 0:f7c60d3e7b8a 135 SN_GRS_PUT_ALLOWED = 0x02,
maclobdell 0:f7c60d3e7b8a 136 SN_GRS_POST_ALLOWED = 0x04,
maclobdell 0:f7c60d3e7b8a 137 SN_GRS_DELETE_ALLOWED = 0x08
maclobdell 0:f7c60d3e7b8a 138 } sn_grs_resource_acl_e;
maclobdell 0:f7c60d3e7b8a 139
maclobdell 0:f7c60d3e7b8a 140
maclobdell 0:f7c60d3e7b8a 141 typedef enum sn_nsdl_oma_device_error_ {
maclobdell 0:f7c60d3e7b8a 142 NO_ERROR = 0,
maclobdell 0:f7c60d3e7b8a 143 LOW_BATTERY_POWER = 1,
maclobdell 0:f7c60d3e7b8a 144 EXTERNAL_POWER_SUPPLY_OFF = 2,
maclobdell 0:f7c60d3e7b8a 145 GPS_MODULE_FAILURE = 3,
maclobdell 0:f7c60d3e7b8a 146 LOW_RECEIVED_SIGNAL_STRENGTH = 4,
maclobdell 0:f7c60d3e7b8a 147 OUT_OF_MEMORY = 5,
maclobdell 0:f7c60d3e7b8a 148 SMS_FAILURE = 6,
maclobdell 0:f7c60d3e7b8a 149 IP_CONN_FAILURE = 7,
maclobdell 0:f7c60d3e7b8a 150 PERIPHERAL_MALFUNCTION = 8
maclobdell 0:f7c60d3e7b8a 151 } sn_nsdl_oma_device_error_t;
maclobdell 0:f7c60d3e7b8a 152
maclobdell 0:f7c60d3e7b8a 153 /**
maclobdell 0:f7c60d3e7b8a 154 * \brief Defines the resource mode
maclobdell 0:f7c60d3e7b8a 155 */
maclobdell 0:f7c60d3e7b8a 156 typedef enum sn_nsdl_resource_mode_ {
maclobdell 0:f7c60d3e7b8a 157 SN_GRS_STATIC, /**< Static resources have some value that doesn't change */
maclobdell 0:f7c60d3e7b8a 158 SN_GRS_DYNAMIC, /**< Dynamic resources are handled in application. Therefore one must give function callback pointer to them */
maclobdell 0:f7c60d3e7b8a 159 SN_GRS_DIRECTORY /**< Directory resources are unused and unsupported */
maclobdell 0:f7c60d3e7b8a 160 } sn_nsdl_resource_mode_e;
maclobdell 0:f7c60d3e7b8a 161
maclobdell 0:f7c60d3e7b8a 162 /**
maclobdell 0:f7c60d3e7b8a 163 * \brief Resource registration parameters
maclobdell 0:f7c60d3e7b8a 164 */
maclobdell 0:f7c60d3e7b8a 165 typedef struct sn_nsdl_resource_parameters_ {
maclobdell 0:f7c60d3e7b8a 166 uint8_t *resource_type_ptr;
maclobdell 0:f7c60d3e7b8a 167 uint16_t resource_type_len;
maclobdell 0:f7c60d3e7b8a 168
maclobdell 0:f7c60d3e7b8a 169 uint8_t *interface_description_ptr;
maclobdell 0:f7c60d3e7b8a 170 uint16_t interface_description_len;
maclobdell 0:f7c60d3e7b8a 171
maclobdell 0:f7c60d3e7b8a 172 uint8_t coap_content_type;
maclobdell 0:f7c60d3e7b8a 173
maclobdell 0:f7c60d3e7b8a 174 uint8_t mime_content_type;
maclobdell 0:f7c60d3e7b8a 175
maclobdell 0:f7c60d3e7b8a 176 uint8_t observable;
maclobdell 0:f7c60d3e7b8a 177
maclobdell 0:f7c60d3e7b8a 178 uint8_t registered;
maclobdell 0:f7c60d3e7b8a 179
maclobdell 0:f7c60d3e7b8a 180 } sn_nsdl_resource_parameters_s;
maclobdell 0:f7c60d3e7b8a 181
maclobdell 0:f7c60d3e7b8a 182 /**
maclobdell 0:f7c60d3e7b8a 183 * \brief Defines parameters for the resource.
maclobdell 0:f7c60d3e7b8a 184 */
maclobdell 0:f7c60d3e7b8a 185 typedef struct sn_nsdl_resource_info_ {
maclobdell 0:f7c60d3e7b8a 186 sn_nsdl_resource_parameters_s *resource_parameters_ptr;
maclobdell 0:f7c60d3e7b8a 187
maclobdell 0:f7c60d3e7b8a 188 sn_nsdl_resource_mode_e mode; /**< STATIC etc.. */
maclobdell 0:f7c60d3e7b8a 189
maclobdell 0:f7c60d3e7b8a 190 uint16_t pathlen; /**< Address */
maclobdell 0:f7c60d3e7b8a 191 uint8_t *path;
maclobdell 0:f7c60d3e7b8a 192
maclobdell 0:f7c60d3e7b8a 193 uint16_t resourcelen; /**< 0 if dynamic resource, resource information in static resource */
maclobdell 0:f7c60d3e7b8a 194 uint8_t *resource; /**< NULL if dynamic resource */
maclobdell 0:f7c60d3e7b8a 195
maclobdell 0:f7c60d3e7b8a 196 sn_grs_resource_acl_e access;
maclobdell 0:f7c60d3e7b8a 197
maclobdell 0:f7c60d3e7b8a 198 uint8_t (*sn_grs_dyn_res_callback)(struct nsdl_s *, sn_coap_hdr_s *, sn_nsdl_addr_s *, sn_nsdl_capab_e);
maclobdell 0:f7c60d3e7b8a 199
maclobdell 0:f7c60d3e7b8a 200 ns_list_link_t link;
maclobdell 0:f7c60d3e7b8a 201
maclobdell 0:f7c60d3e7b8a 202 } sn_nsdl_resource_info_s;
maclobdell 0:f7c60d3e7b8a 203
maclobdell 0:f7c60d3e7b8a 204 /**
maclobdell 0:f7c60d3e7b8a 205 * \brief Defines OMA device object parameters.
maclobdell 0:f7c60d3e7b8a 206 */
maclobdell 0:f7c60d3e7b8a 207 typedef struct sn_nsdl_oma_device_ {
maclobdell 0:f7c60d3e7b8a 208 sn_nsdl_oma_device_error_t error_code; /**< Error code. Mandatory. Can be more than one */
maclobdell 0:f7c60d3e7b8a 209 uint8_t (*sn_oma_device_boot_callback)(struct nsdl_s *, sn_coap_hdr_s *, sn_nsdl_addr_s *, sn_nsdl_capab_e); /**< Device boot callback function. If defined, this is called when reset request is received */
maclobdell 0:f7c60d3e7b8a 210
maclobdell 0:f7c60d3e7b8a 211 } sn_nsdl_oma_device_t;
maclobdell 0:f7c60d3e7b8a 212
maclobdell 0:f7c60d3e7b8a 213 /**
maclobdell 0:f7c60d3e7b8a 214 * \brief Defines OMAlw server information
maclobdell 0:f7c60d3e7b8a 215 */
maclobdell 0:f7c60d3e7b8a 216 typedef struct sn_nsdl_oma_server_info_ {
maclobdell 0:f7c60d3e7b8a 217 sn_nsdl_addr_s *omalw_address_ptr;
maclobdell 0:f7c60d3e7b8a 218 omalw_server_security_t omalw_server_security;
maclobdell 0:f7c60d3e7b8a 219
maclobdell 0:f7c60d3e7b8a 220 } sn_nsdl_oma_server_info_t;
maclobdell 0:f7c60d3e7b8a 221
maclobdell 0:f7c60d3e7b8a 222 /**
maclobdell 0:f7c60d3e7b8a 223 * \brief Defines endpoint parameters to OMA bootstrap.
maclobdell 0:f7c60d3e7b8a 224 */
maclobdell 0:f7c60d3e7b8a 225 typedef struct sn_nsdl_bs_ep_info_ {
maclobdell 0:f7c60d3e7b8a 226 void (*oma_bs_status_cb)(sn_nsdl_oma_server_info_t *); /**< Callback for OMA bootstrap status */
maclobdell 0:f7c60d3e7b8a 227 sn_nsdl_oma_device_t *device_object; /**< OMA LWM2M mandatory device resources */
maclobdell 0:f7c60d3e7b8a 228 } sn_nsdl_bs_ep_info_t;
maclobdell 0:f7c60d3e7b8a 229
maclobdell 0:f7c60d3e7b8a 230
maclobdell 0:f7c60d3e7b8a 231
maclobdell 0:f7c60d3e7b8a 232
maclobdell 0:f7c60d3e7b8a 233 /**
maclobdell 0:f7c60d3e7b8a 234 * \fn struct nsdl_s *sn_nsdl_init (uint8_t (*sn_nsdl_tx_cb)(sn_nsdl_capab_e , uint8_t *, uint16_t, sn_nsdl_addr_s *),
maclobdell 0:f7c60d3e7b8a 235 * uint8_t (*sn_nsdl_rx_cb)(sn_coap_hdr_s *, sn_nsdl_addr_s *),
maclobdell 0:f7c60d3e7b8a 236 * sn_nsdl_mem_s *sn_memory)
maclobdell 0:f7c60d3e7b8a 237 *
maclobdell 0:f7c60d3e7b8a 238 * \brief Initialization function for NSDL library. Initializes NSDL, GRS, HTTP and CoAP.
maclobdell 0:f7c60d3e7b8a 239 *
maclobdell 0:f7c60d3e7b8a 240 * \param *sn_nsdl_tx_callback A callback function for sending messages.
maclobdell 0:f7c60d3e7b8a 241 *
maclobdell 0:f7c60d3e7b8a 242 * \param *sn_nsdl_rx_callback A callback function for parsed messages. If received message is not CoAP protocol message (eg. ACK), message for GRS (GET, PUT, POST, DELETE) or
maclobdell 0:f7c60d3e7b8a 243 * reply for some DS messages (register message etc.), rx callback will be called.
maclobdell 0:f7c60d3e7b8a 244 *
maclobdell 0:f7c60d3e7b8a 245 * \param *sn_memory Memory structure which includes function pointers to the allocation and free functions.
maclobdell 0:f7c60d3e7b8a 246 *
maclobdell 0:f7c60d3e7b8a 247 * \return pointer to created handle structure. NULL if failed
maclobdell 0:f7c60d3e7b8a 248 */
maclobdell 0:f7c60d3e7b8a 249 struct nsdl_s *sn_nsdl_init(uint8_t (*sn_nsdl_tx_cb)(struct nsdl_s *, sn_nsdl_capab_e , uint8_t *, uint16_t, sn_nsdl_addr_s *),
maclobdell 0:f7c60d3e7b8a 250 uint8_t (*sn_nsdl_rx_cb)(struct nsdl_s *, sn_coap_hdr_s *, sn_nsdl_addr_s *),
maclobdell 0:f7c60d3e7b8a 251 void *(*sn_nsdl_alloc)(uint16_t), void (*sn_nsdl_free)(void *));
maclobdell 0:f7c60d3e7b8a 252
maclobdell 0:f7c60d3e7b8a 253 /**
maclobdell 0:f7c60d3e7b8a 254 * \fn extern uint16_t sn_nsdl_register_endpoint(struct nsdl_s *handle, sn_nsdl_ep_parameters_s *endpoint_info_ptr);
maclobdell 0:f7c60d3e7b8a 255 *
maclobdell 0:f7c60d3e7b8a 256 * \brief Registers endpoint to mbed Device Server.
maclobdell 0:f7c60d3e7b8a 257 * \param *handle Pointer to nsdl-library handle
maclobdell 0:f7c60d3e7b8a 258 * \param *endpoint_info_ptr Contains endpoint information.
maclobdell 0:f7c60d3e7b8a 259 *
maclobdell 0:f7c60d3e7b8a 260 * \return registration message ID, 0 if failed
maclobdell 0:f7c60d3e7b8a 261 */
maclobdell 0:f7c60d3e7b8a 262 extern uint16_t sn_nsdl_register_endpoint(struct nsdl_s *handle, sn_nsdl_ep_parameters_s *endpoint_info_ptr);
maclobdell 0:f7c60d3e7b8a 263
maclobdell 0:f7c60d3e7b8a 264 /**
maclobdell 0:f7c60d3e7b8a 265 * \fn extern uint16_t sn_nsdl_unregister_endpoint(struct nsdl_s *handle)
maclobdell 0:f7c60d3e7b8a 266 *
maclobdell 0:f7c60d3e7b8a 267 * \brief Sends unregister-message to mbed Device Server.
maclobdell 0:f7c60d3e7b8a 268 *
maclobdell 0:f7c60d3e7b8a 269 * \param *handle Pointer to nsdl-library handle
maclobdell 0:f7c60d3e7b8a 270 *
maclobdell 0:f7c60d3e7b8a 271 * \return unregistration message ID, 0 if failed
maclobdell 0:f7c60d3e7b8a 272 */
maclobdell 0:f7c60d3e7b8a 273 extern uint16_t sn_nsdl_unregister_endpoint(struct nsdl_s *handle);
maclobdell 0:f7c60d3e7b8a 274
maclobdell 0:f7c60d3e7b8a 275 /**
maclobdell 0:f7c60d3e7b8a 276 * \fn extern uint16_t sn_nsdl_update_registration(struct nsdl_s *handle, uint8_t *lt_ptr, uint8_t lt_len);
maclobdell 0:f7c60d3e7b8a 277 *
maclobdell 0:f7c60d3e7b8a 278 * \brief Update the registration with mbed Device Server.
maclobdell 0:f7c60d3e7b8a 279 *
maclobdell 0:f7c60d3e7b8a 280 * \param *handle Pointer to nsdl-library handle
maclobdell 0:f7c60d3e7b8a 281 * \param *lt_ptr Pointer to lifetime value string in ascii form, eg. "1200"
maclobdell 0:f7c60d3e7b8a 282 * \param lt_len Length of the lifetime string
maclobdell 0:f7c60d3e7b8a 283 *
maclobdell 0:f7c60d3e7b8a 284 * \return registration update message ID, 0 if failed
maclobdell 0:f7c60d3e7b8a 285 */
maclobdell 0:f7c60d3e7b8a 286 extern uint16_t sn_nsdl_update_registration(struct nsdl_s *handle, uint8_t *lt_ptr, uint8_t lt_len);
maclobdell 0:f7c60d3e7b8a 287
maclobdell 0:f7c60d3e7b8a 288 /**
maclobdell 0:f7c60d3e7b8a 289 * \fn extern int8_t sn_nsdl_set_endpoint_location(struct nsdl_s *handle, uint8_t *location_ptr, uint8_t location_len);
maclobdell 0:f7c60d3e7b8a 290 *
maclobdell 0:f7c60d3e7b8a 291 * \brief Sets the location receievd from Device Server.
maclobdell 0:f7c60d3e7b8a 292 *
maclobdell 0:f7c60d3e7b8a 293 * \param *handle Pointer to nsdl-library handle
maclobdell 0:f7c60d3e7b8a 294 * \param *lt_ptr Pointer to location value string , eg. "s322j4k"
maclobdell 0:f7c60d3e7b8a 295 * \param lt_len Length of the location string
maclobdell 0:f7c60d3e7b8a 296 *
maclobdell 0:f7c60d3e7b8a 297 * \return success, 0 if failed -1
maclobdell 0:f7c60d3e7b8a 298 */
maclobdell 0:f7c60d3e7b8a 299 extern int8_t sn_nsdl_set_endpoint_location(struct nsdl_s *handle, uint8_t *location_ptr, uint8_t location_len);
maclobdell 0:f7c60d3e7b8a 300
maclobdell 0:f7c60d3e7b8a 301
maclobdell 0:f7c60d3e7b8a 302 /**
maclobdell 0:f7c60d3e7b8a 303 * \fn extern int8_t sn_nsdl_is_ep_registered(struct nsdl_s *handle)
maclobdell 0:f7c60d3e7b8a 304 *
maclobdell 0:f7c60d3e7b8a 305 * \brief Checks if endpoint is registered.
maclobdell 0:f7c60d3e7b8a 306 *
maclobdell 0:f7c60d3e7b8a 307 * \param *handle Pointer to nsdl-library handle
maclobdell 0:f7c60d3e7b8a 308 *
maclobdell 0:f7c60d3e7b8a 309 * \return 1 Endpoint registration is done successfully
maclobdell 0:f7c60d3e7b8a 310 * \return 0 Endpoint is not registered
maclobdell 0:f7c60d3e7b8a 311 */
maclobdell 0:f7c60d3e7b8a 312 extern int8_t sn_nsdl_is_ep_registered(struct nsdl_s *handle);
maclobdell 0:f7c60d3e7b8a 313
maclobdell 0:f7c60d3e7b8a 314 /**
maclobdell 0:f7c60d3e7b8a 315 * \fn extern void sn_nsdl_nsp_lost(struct nsdl_s *handle);
maclobdell 0:f7c60d3e7b8a 316 *
maclobdell 0:f7c60d3e7b8a 317 * \brief A function to inform mbed Device C client library if application detects a fault in mbed Device Server registration.
maclobdell 0:f7c60d3e7b8a 318 *
maclobdell 0:f7c60d3e7b8a 319 * \param *handle Pointer to nsdl-library handle
maclobdell 0:f7c60d3e7b8a 320 *
maclobdell 0:f7c60d3e7b8a 321 * After calling this function sn_nsdl_is_ep_registered() will return "not registered".
maclobdell 0:f7c60d3e7b8a 322 */
maclobdell 0:f7c60d3e7b8a 323 extern void sn_nsdl_nsp_lost(struct nsdl_s *handle);
maclobdell 0:f7c60d3e7b8a 324
maclobdell 0:f7c60d3e7b8a 325 /**
maclobdell 0:f7c60d3e7b8a 326 * \fn extern uint16_t sn_nsdl_send_observation_notification(struct nsdl_s *handle, uint8_t *token_ptr, uint8_t token_len,
maclobdell 0:f7c60d3e7b8a 327 * uint8_t *payload_ptr, uint16_t payload_len,
maclobdell 0:f7c60d3e7b8a 328 * uint8_t *observe_ptr, uint8_t observe_len,
maclobdell 0:f7c60d3e7b8a 329 * sn_coap_msg_type_e message_type, uint8_t content_type)
maclobdell 0:f7c60d3e7b8a 330 *
maclobdell 0:f7c60d3e7b8a 331 *
maclobdell 0:f7c60d3e7b8a 332 * \brief Sends observation message to mbed Device Server
maclobdell 0:f7c60d3e7b8a 333 *
maclobdell 0:f7c60d3e7b8a 334 * \param *handle Pointer to nsdl-library handle
maclobdell 0:f7c60d3e7b8a 335 * \param *token_ptr Pointer to token to be used
maclobdell 0:f7c60d3e7b8a 336 * \param token_len Token length
maclobdell 0:f7c60d3e7b8a 337 * \param *payload_ptr Pointer to payload to be sent
maclobdell 0:f7c60d3e7b8a 338 * \param payload_len Payload length
maclobdell 0:f7c60d3e7b8a 339 * \param *observe_ptr Pointer to observe number to be sent
maclobdell 0:f7c60d3e7b8a 340 * \param observe_len Observe number len
maclobdell 0:f7c60d3e7b8a 341 * \param message_type Observation message type (confirmable or non-confirmable)
maclobdell 0:f7c60d3e7b8a 342 * \param contetnt_type Observation message payload contetnt type
maclobdell 0:f7c60d3e7b8a 343 *
maclobdell 0:f7c60d3e7b8a 344 * \return !0 Success, observation messages message ID
maclobdell 0:f7c60d3e7b8a 345 * \return 0 Failure
maclobdell 0:f7c60d3e7b8a 346 */
maclobdell 0:f7c60d3e7b8a 347 extern uint16_t sn_nsdl_send_observation_notification(struct nsdl_s *handle, uint8_t *token_ptr, uint8_t token_len,
maclobdell 0:f7c60d3e7b8a 348 uint8_t *payload_ptr, uint16_t payload_len,
maclobdell 0:f7c60d3e7b8a 349 uint8_t *observe_ptr, uint8_t observe_len,
maclobdell 0:f7c60d3e7b8a 350 sn_coap_msg_type_e message_type, uint8_t content_type);
maclobdell 0:f7c60d3e7b8a 351
maclobdell 0:f7c60d3e7b8a 352 /**
maclobdell 0:f7c60d3e7b8a 353 * \fn extern uint32_t sn_nsdl_get_version(void)
maclobdell 0:f7c60d3e7b8a 354 *
maclobdell 0:f7c60d3e7b8a 355 * \brief Version query function.
maclobdell 0:f7c60d3e7b8a 356 *
maclobdell 0:f7c60d3e7b8a 357 * Used to retrieve the version information from the mbed Device C Client library.
maclobdell 0:f7c60d3e7b8a 358 *
maclobdell 0:f7c60d3e7b8a 359 * \return Pointer to library version string
maclobdell 0:f7c60d3e7b8a 360 */
maclobdell 0:f7c60d3e7b8a 361 extern char *sn_nsdl_get_version(void);
maclobdell 0:f7c60d3e7b8a 362
maclobdell 0:f7c60d3e7b8a 363 /**
maclobdell 0:f7c60d3e7b8a 364 * \fn extern int8_t sn_nsdl_process_coap(struct nsdl_s *handle, uint8_t *packet, uint16_t packet_len, sn_nsdl_addr_s *src)
maclobdell 0:f7c60d3e7b8a 365 *
maclobdell 0:f7c60d3e7b8a 366 * \brief To push CoAP packet to mbed Device C Client library
maclobdell 0:f7c60d3e7b8a 367 *
maclobdell 0:f7c60d3e7b8a 368 * Used to push an CoAP packet to mbed Device C Client library for processing.
maclobdell 0:f7c60d3e7b8a 369 *
maclobdell 0:f7c60d3e7b8a 370 * \param *handle Pointer to nsdl-library handle
maclobdell 0:f7c60d3e7b8a 371 *
maclobdell 0:f7c60d3e7b8a 372 * \param *packet Pointer to a uint8_t array containing the packet (including the CoAP headers).
maclobdell 0:f7c60d3e7b8a 373 * After successful execution this array may contain the response packet.
maclobdell 0:f7c60d3e7b8a 374 *
maclobdell 0:f7c60d3e7b8a 375 * \param *packet_len Pointer to length of the packet. After successful execution this array may contain the length
maclobdell 0:f7c60d3e7b8a 376 * of the response packet.
maclobdell 0:f7c60d3e7b8a 377 *
maclobdell 0:f7c60d3e7b8a 378 * \param *src Pointer to packet source address information. After successful execution this array may contain
maclobdell 0:f7c60d3e7b8a 379 * the destination address of the response packet.
maclobdell 0:f7c60d3e7b8a 380 *
maclobdell 0:f7c60d3e7b8a 381 * \return 0 Success
maclobdell 0:f7c60d3e7b8a 382 * \return -1 Failure
maclobdell 0:f7c60d3e7b8a 383 */
maclobdell 0:f7c60d3e7b8a 384 extern int8_t sn_nsdl_process_coap(struct nsdl_s *handle, uint8_t *packet, uint16_t packet_len, sn_nsdl_addr_s *src);
maclobdell 0:f7c60d3e7b8a 385
maclobdell 0:f7c60d3e7b8a 386 /**
maclobdell 0:f7c60d3e7b8a 387 * \fn extern int8_t sn_nsdl_exec(struct nsdl_s *handle, uint32_t time);
maclobdell 0:f7c60d3e7b8a 388 *
maclobdell 0:f7c60d3e7b8a 389 * \brief CoAP retransmission function.
maclobdell 0:f7c60d3e7b8a 390 *
maclobdell 0:f7c60d3e7b8a 391 * Used to give execution time for the mbed Device C Client library for retransmissions.
maclobdell 0:f7c60d3e7b8a 392 *
maclobdell 0:f7c60d3e7b8a 393 * \param *handle Pointer to nsdl-library handle
maclobdell 0:f7c60d3e7b8a 394 *
maclobdell 0:f7c60d3e7b8a 395 * \param time Time in seconds.
maclobdell 0:f7c60d3e7b8a 396 *
maclobdell 0:f7c60d3e7b8a 397 * \return 0 Success
maclobdell 0:f7c60d3e7b8a 398 * \return -1 Failure
maclobdell 0:f7c60d3e7b8a 399 */
maclobdell 0:f7c60d3e7b8a 400 extern int8_t sn_nsdl_exec(struct nsdl_s *handle, uint32_t time);
maclobdell 0:f7c60d3e7b8a 401
maclobdell 0:f7c60d3e7b8a 402 /**
maclobdell 0:f7c60d3e7b8a 403 * \fn extern int8_t sn_nsdl_create_resource(struct nsdl_s *handle, sn_nsdl_resource_info_s *res);
maclobdell 0:f7c60d3e7b8a 404 *
maclobdell 0:f7c60d3e7b8a 405 * \brief Resource creating function.
maclobdell 0:f7c60d3e7b8a 406 *
maclobdell 0:f7c60d3e7b8a 407 * Used to create a static or dynamic CoAP resource.
maclobdell 0:f7c60d3e7b8a 408 *
maclobdell 0:f7c60d3e7b8a 409 * \param *res Pointer to a structure of type sn_nsdl_resource_info_t that contains the information
maclobdell 0:f7c60d3e7b8a 410 * about the resource.
maclobdell 0:f7c60d3e7b8a 411 *
maclobdell 0:f7c60d3e7b8a 412 * \return 0 Success
maclobdell 0:f7c60d3e7b8a 413 * \return -1 Failure
maclobdell 0:f7c60d3e7b8a 414 * \return -2 Resource already exists
maclobdell 0:f7c60d3e7b8a 415 * \return -3 Invalid path
maclobdell 0:f7c60d3e7b8a 416 * \return -4 List adding failure
maclobdell 0:f7c60d3e7b8a 417 */
maclobdell 0:f7c60d3e7b8a 418 extern int8_t sn_nsdl_create_resource(struct nsdl_s *handle, sn_nsdl_resource_info_s *res);
maclobdell 0:f7c60d3e7b8a 419
maclobdell 0:f7c60d3e7b8a 420 /**
maclobdell 0:f7c60d3e7b8a 421 * \fn extern int8_t sn_nsdl_update_resource(sn_nsdl_resource_info_s *res)
maclobdell 0:f7c60d3e7b8a 422 *
maclobdell 0:f7c60d3e7b8a 423 * \brief Resource updating function.
maclobdell 0:f7c60d3e7b8a 424 *
maclobdell 0:f7c60d3e7b8a 425 * Used to update the direct value of a static resource, the callback function pointer of a dynamic resource
maclobdell 0:f7c60d3e7b8a 426 * and access rights of the recource.
maclobdell 0:f7c60d3e7b8a 427 *
maclobdell 0:f7c60d3e7b8a 428 * \param *handle Pointer to nsdl-library handle
maclobdell 0:f7c60d3e7b8a 429 * \param *res Pointer to a structure of type sn_nsdl_resource_info_t that contains the information
maclobdell 0:f7c60d3e7b8a 430 * about the resource. Only the pathlen and path elements are evaluated along with
maclobdell 0:f7c60d3e7b8a 431 * either resourcelen and resource or the function pointer.
maclobdell 0:f7c60d3e7b8a 432 *
maclobdell 0:f7c60d3e7b8a 433 * \return 0 Success
maclobdell 0:f7c60d3e7b8a 434 * \return -1 Failure
maclobdell 0:f7c60d3e7b8a 435 */
maclobdell 0:f7c60d3e7b8a 436 extern int8_t sn_nsdl_update_resource(struct nsdl_s *handle, sn_nsdl_resource_info_s *res);
maclobdell 0:f7c60d3e7b8a 437
maclobdell 0:f7c60d3e7b8a 438 /**
maclobdell 0:f7c60d3e7b8a 439 * \fn extern int8_t sn_nsdl_delete_resource(struct nsdl_s *handle, uint8_t pathlen, uint8_t *path)
maclobdell 0:f7c60d3e7b8a 440 *
maclobdell 0:f7c60d3e7b8a 441 * \brief Resource delete function.
maclobdell 0:f7c60d3e7b8a 442 *
maclobdell 0:f7c60d3e7b8a 443 * Used to delete a resource. If resource has a subresources, these all must also be removed.
maclobdell 0:f7c60d3e7b8a 444 *
maclobdell 0:f7c60d3e7b8a 445 * \param *handle Pointer to nsdl-library handle
maclobdell 0:f7c60d3e7b8a 446 * \param pathlen Contains the length of the path that is to be deleted (excluding possible trailing "\0").
maclobdell 0:f7c60d3e7b8a 447 * \param *path_ptr A pointer to an array containing the path.
maclobdell 0:f7c60d3e7b8a 448 *
maclobdell 0:f7c60d3e7b8a 449 * \return 0 Success
maclobdell 0:f7c60d3e7b8a 450 * \return -1 Failure (No such resource)
maclobdell 0:f7c60d3e7b8a 451 */
maclobdell 0:f7c60d3e7b8a 452 extern int8_t sn_nsdl_delete_resource(struct nsdl_s *handle, uint16_t pathlen, uint8_t *path);
maclobdell 0:f7c60d3e7b8a 453
maclobdell 0:f7c60d3e7b8a 454 /**
maclobdell 0:f7c60d3e7b8a 455 * \fn extern sn_nsdl_resource_info_s *sn_nsdl_get_resource(struct nsdl_s *handle, uint16_t pathlen, uint8_t *path)
maclobdell 0:f7c60d3e7b8a 456 *
maclobdell 0:f7c60d3e7b8a 457 * \brief Resource get function.
maclobdell 0:f7c60d3e7b8a 458 *
maclobdell 0:f7c60d3e7b8a 459 * Used to get a resource.
maclobdell 0:f7c60d3e7b8a 460 *
maclobdell 0:f7c60d3e7b8a 461 * \param *handle Pointer to nsdl-library handle
maclobdell 0:f7c60d3e7b8a 462 * \param pathlen Contains the length of the path that is to be returned (excluding possible trailing '\0').
maclobdell 0:f7c60d3e7b8a 463 * \param *path A pointer to an array containing the path.
maclobdell 0:f7c60d3e7b8a 464 *
maclobdell 0:f7c60d3e7b8a 465 * \return !NULL Success, pointer to a sn_nsdl_resource_info_s that contains the resource information\n
maclobdell 0:f7c60d3e7b8a 466 * \return NULL Failure
maclobdell 0:f7c60d3e7b8a 467 */
maclobdell 0:f7c60d3e7b8a 468 extern sn_nsdl_resource_info_s *sn_nsdl_get_resource(struct nsdl_s *handle, uint16_t pathlen, uint8_t *path);
maclobdell 0:f7c60d3e7b8a 469
maclobdell 0:f7c60d3e7b8a 470 /**
maclobdell 0:f7c60d3e7b8a 471 * \fn extern sn_grs_resource_list_s *sn_nsdl_list_resource(struct nsdl_s *handle, uint16_t pathlen, uint8_t *path)
maclobdell 0:f7c60d3e7b8a 472 *
maclobdell 0:f7c60d3e7b8a 473 * \brief Resource list function.
maclobdell 0:f7c60d3e7b8a 474 *
maclobdell 0:f7c60d3e7b8a 475 * \param *handle Pointer to nsdl-library handle
maclobdell 0:f7c60d3e7b8a 476 * \param pathlen Contains the length of the target path (excluding possible trailing '\0').
maclobdell 0:f7c60d3e7b8a 477 * The length value is not examined if the path itself is a NULL pointer.
maclobdell 0:f7c60d3e7b8a 478 * \param *path A pointer to an array containing the path or a NULL pointer.
maclobdell 0:f7c60d3e7b8a 479 *
maclobdell 0:f7c60d3e7b8a 480 * \return !NULL A pointer to a sn_grs_resource_list_s structure containing the resource listing.
maclobdell 0:f7c60d3e7b8a 481 * \return NULL Failure with an unspecified error
maclobdell 0:f7c60d3e7b8a 482 */
maclobdell 0:f7c60d3e7b8a 483 sn_grs_resource_list_s *sn_nsdl_list_resource(struct nsdl_s *handle, uint16_t pathlen, uint8_t *path);
maclobdell 0:f7c60d3e7b8a 484
maclobdell 0:f7c60d3e7b8a 485 /**
maclobdell 0:f7c60d3e7b8a 486 * \fn extern void sn_nsdl_free_resource_list(struct nsdl_s *handle, sn_grs_resource_list_s *list)
maclobdell 0:f7c60d3e7b8a 487 *
maclobdell 0:f7c60d3e7b8a 488 * \brief Free a resource list obtained from sn_nsdl_list_resource()
maclobdell 0:f7c60d3e7b8a 489 *
maclobdell 0:f7c60d3e7b8a 490 * \param list The list to free, or NULL.
maclobdell 0:f7c60d3e7b8a 491 */
maclobdell 0:f7c60d3e7b8a 492 void sn_nsdl_free_resource_list(struct nsdl_s *handle, sn_grs_resource_list_s *list);
maclobdell 0:f7c60d3e7b8a 493
maclobdell 0:f7c60d3e7b8a 494 /**
maclobdell 0:f7c60d3e7b8a 495 * \fn extern int8_t sn_nsdl_send_coap_message(struct nsdl_s *handle, sn_nsdl_addr_s *address_ptr, sn_coap_hdr_s *coap_hdr_ptr);
maclobdell 0:f7c60d3e7b8a 496 *
maclobdell 0:f7c60d3e7b8a 497 * \brief Send an outgoing CoAP request.
maclobdell 0:f7c60d3e7b8a 498 *
maclobdell 0:f7c60d3e7b8a 499 * \param *handle Pointer to nsdl-library handle
maclobdell 0:f7c60d3e7b8a 500 * \param *address_ptr Pointer to source address struct
maclobdell 0:f7c60d3e7b8a 501 * \param *coap_hdr_ptr Pointer to CoAP message to be sent
maclobdell 0:f7c60d3e7b8a 502 *
maclobdell 0:f7c60d3e7b8a 503 * \return 0 Success
maclobdell 0:f7c60d3e7b8a 504 * \return -1 Failure
maclobdell 0:f7c60d3e7b8a 505 */
maclobdell 0:f7c60d3e7b8a 506 extern int8_t sn_nsdl_send_coap_message(struct nsdl_s *handle, sn_nsdl_addr_s *address_ptr, sn_coap_hdr_s *coap_hdr_ptr);
maclobdell 0:f7c60d3e7b8a 507
maclobdell 0:f7c60d3e7b8a 508 /**
maclobdell 0:f7c60d3e7b8a 509 * \fn extern int8_t set_NSP_address(struct nsdl_s *handle, uint8_t *NSP_address, uint16_t port, sn_nsdl_addr_type_e address_type);
maclobdell 0:f7c60d3e7b8a 510 *
maclobdell 0:f7c60d3e7b8a 511 * \brief This function is used to set the mbed Device Server address given by an application.
maclobdell 0:f7c60d3e7b8a 512 *
maclobdell 0:f7c60d3e7b8a 513 * \param *handle Pointer to nsdl-library handle
maclobdell 0:f7c60d3e7b8a 514 * \return 0 Success
maclobdell 0:f7c60d3e7b8a 515 * \return -1 Failed to indicate that internal address pointer is not allocated (call nsdl_init() first).
maclobdell 0:f7c60d3e7b8a 516 */
maclobdell 0:f7c60d3e7b8a 517 extern int8_t set_NSP_address(struct nsdl_s *handle, uint8_t *NSP_address, uint16_t port, sn_nsdl_addr_type_e address_type);
maclobdell 0:f7c60d3e7b8a 518
maclobdell 0:f7c60d3e7b8a 519 /**
maclobdell 0:f7c60d3e7b8a 520 * \fn extern int8_t sn_nsdl_destroy(struct nsdl_s *handle);
maclobdell 0:f7c60d3e7b8a 521 *
maclobdell 0:f7c60d3e7b8a 522 * \param *handle Pointer to nsdl-library handle
maclobdell 0:f7c60d3e7b8a 523 * \brief This function releases all allocated memory in mbed Device C Client library.
maclobdell 0:f7c60d3e7b8a 524 */
maclobdell 0:f7c60d3e7b8a 525 extern int8_t sn_nsdl_destroy(struct nsdl_s *handle);
maclobdell 0:f7c60d3e7b8a 526
maclobdell 0:f7c60d3e7b8a 527 /**
maclobdell 0:f7c60d3e7b8a 528 * \fn extern uint16_t sn_nsdl_oma_bootstrap(struct nsdl_s *handle, sn_nsdl_addr_s *bootstrap_address_ptr, sn_nsdl_ep_parameters_s *endpoint_info_ptr, sn_nsdl_bs_ep_info_t *bootstrap_endpoint_info_ptr);
maclobdell 0:f7c60d3e7b8a 529 *
maclobdell 0:f7c60d3e7b8a 530 * \brief Starts OMA bootstrap process
maclobdell 0:f7c60d3e7b8a 531 *
maclobdell 0:f7c60d3e7b8a 532 * \param *handle Pointer to nsdl-library handle
maclobdell 0:f7c60d3e7b8a 533 *
maclobdell 0:f7c60d3e7b8a 534 * \return bootstrap message ID, 0 if failed
maclobdell 0:f7c60d3e7b8a 535 */
maclobdell 0:f7c60d3e7b8a 536 extern uint16_t sn_nsdl_oma_bootstrap(struct nsdl_s *handle, sn_nsdl_addr_s *bootstrap_address_ptr, sn_nsdl_ep_parameters_s *endpoint_info_ptr, sn_nsdl_bs_ep_info_t *bootstrap_endpoint_info_ptr);
maclobdell 0:f7c60d3e7b8a 537
maclobdell 0:f7c60d3e7b8a 538 /**
maclobdell 0:f7c60d3e7b8a 539 * \fn extern omalw_certificate_list_t *sn_nsdl_get_certificates(struct nsdl_s *handle);
maclobdell 0:f7c60d3e7b8a 540 *
maclobdell 0:f7c60d3e7b8a 541 * \brief Get pointer to received device server certificates
maclobdell 0:f7c60d3e7b8a 542 *
maclobdell 0:f7c60d3e7b8a 543 * \param *handle Pointer to nsdl-library handle
maclobdell 0:f7c60d3e7b8a 544 */
maclobdell 0:f7c60d3e7b8a 545 extern omalw_certificate_list_t *sn_nsdl_get_certificates(struct nsdl_s *handle);
maclobdell 0:f7c60d3e7b8a 546
maclobdell 0:f7c60d3e7b8a 547 /**
maclobdell 0:f7c60d3e7b8a 548 * \fn extern int8_t sn_nsdl_update_certificates(struct nsdl_s *handle, omalw_certificate_list_t* certificate_ptr, uint8_t certificate_chain);
maclobdell 0:f7c60d3e7b8a 549 *
maclobdell 0:f7c60d3e7b8a 550 * \brief Updates certificate pointers to resource server.
maclobdell 0:f7c60d3e7b8a 551 *
maclobdell 0:f7c60d3e7b8a 552 * \param *handle Pointer to nsdl-library handle
maclobdell 0:f7c60d3e7b8a 553 */
maclobdell 0:f7c60d3e7b8a 554 extern int8_t sn_nsdl_update_certificates(struct nsdl_s *handle, omalw_certificate_list_t *certificate_ptr, uint8_t certificate_chain);
maclobdell 0:f7c60d3e7b8a 555
maclobdell 0:f7c60d3e7b8a 556 /**
maclobdell 0:f7c60d3e7b8a 557 * \fn extern int8_t sn_nsdl_create_oma_device_object(struct nsdl_s *handle, sn_nsdl_oma_device_t *device_object_ptr);
maclobdell 0:f7c60d3e7b8a 558 *
maclobdell 0:f7c60d3e7b8a 559 * \brief Creates new device object resource
maclobdell 0:f7c60d3e7b8a 560 *
maclobdell 0:f7c60d3e7b8a 561 * \param *handle Pointer to nsdl-library handle
maclobdell 0:f7c60d3e7b8a 562 */
maclobdell 0:f7c60d3e7b8a 563 extern int8_t sn_nsdl_create_oma_device_object(struct nsdl_s *handle, sn_nsdl_oma_device_t *device_object_ptr);
maclobdell 0:f7c60d3e7b8a 564
maclobdell 0:f7c60d3e7b8a 565 /**
maclobdell 0:f7c60d3e7b8a 566 * \fn sn_coap_hdr_s *sn_nsdl_build_response(struct nsdl_s *handle, sn_coap_hdr_s *coap_packet_ptr, uint8_t msg_code)
maclobdell 0:f7c60d3e7b8a 567 *
maclobdell 0:f7c60d3e7b8a 568 * \brief Prepares generic response packet from a request packet. This function allocates memory for the resulting sn_coap_hdr_s
maclobdell 0:f7c60d3e7b8a 569 *
maclobdell 0:f7c60d3e7b8a 570 * \param *handle Pointer to library handle
maclobdell 0:f7c60d3e7b8a 571 * \param *coap_packet_ptr The request packet pointer
maclobdell 0:f7c60d3e7b8a 572 * \param msg_code response messages code
maclobdell 0:f7c60d3e7b8a 573 *
maclobdell 0:f7c60d3e7b8a 574 * \return *coap_packet_ptr The allocated and pre-filled response packet pointer
maclobdell 0:f7c60d3e7b8a 575 * NULL Error in parsing the request
maclobdell 0:f7c60d3e7b8a 576 *
maclobdell 0:f7c60d3e7b8a 577 */
maclobdell 0:f7c60d3e7b8a 578 extern sn_coap_hdr_s *sn_nsdl_build_response(struct nsdl_s *handle, sn_coap_hdr_s *coap_packet_ptr, uint8_t msg_code);
maclobdell 0:f7c60d3e7b8a 579
maclobdell 0:f7c60d3e7b8a 580 /**
maclobdell 0:f7c60d3e7b8a 581 * \fn void sn_nsdl_release_allocated_coap_msg_mem(struct nsdl_s *handle, sn_coap_hdr_s *freed_coap_msg_ptr)
maclobdell 0:f7c60d3e7b8a 582 *
maclobdell 0:f7c60d3e7b8a 583 * \brief Releases memory of given CoAP message
maclobdell 0:f7c60d3e7b8a 584 *
maclobdell 0:f7c60d3e7b8a 585 * Note!!! Does not release Payload part
maclobdell 0:f7c60d3e7b8a 586 *
maclobdell 0:f7c60d3e7b8a 587 * \param *handle Pointer to CoAP library handle
maclobdell 0:f7c60d3e7b8a 588 *
maclobdell 0:f7c60d3e7b8a 589 * \param *freed_coap_msg_ptr is pointer to released CoAP message
maclobdell 0:f7c60d3e7b8a 590 */
maclobdell 0:f7c60d3e7b8a 591 extern void sn_nsdl_release_allocated_coap_msg_mem(struct nsdl_s *handle, sn_coap_hdr_s *freed_coap_msg_ptr);
maclobdell 0:f7c60d3e7b8a 592
maclobdell 0:f7c60d3e7b8a 593 #ifdef __cplusplus
maclobdell 0:f7c60d3e7b8a 594 }
maclobdell 0:f7c60d3e7b8a 595 #endif
maclobdell 0:f7c60d3e7b8a 596
maclobdell 0:f7c60d3e7b8a 597 #endif /* SN_NSDL_LIB_H_ */
maclobdell 0:f7c60d3e7b8a 598