Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed Socket lwip-eth lwip-sys lwip
sn_nsdl_lib.h
00001 /* 00002 * Copyright (c) 2011-2015 ARM Limited. All rights reserved. 00003 * SPDX-License-Identifier: Apache-2.0 00004 * Licensed under the Apache License, Version 2.0 (the License); you may 00005 * not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an AS IS BASIS, WITHOUT 00012 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 00017 /** 00018 * \file sn_nsdl_lib.h 00019 * 00020 * \brief NanoService Devices Library header file 00021 * 00022 * 00023 */ 00024 00025 #ifndef SN_NSDL_LIB_H_ 00026 #define SN_NSDL_LIB_H_ 00027 00028 #include "ns_list.h" 00029 00030 #ifdef __cplusplus 00031 extern "C" { 00032 #endif 00033 00034 #define SN_NSDL_ENDPOINT_NOT_REGISTERED 0 00035 #define SN_NSDL_ENDPOINT_IS_REGISTERED 1 00036 00037 /* Handle structure */ 00038 struct nsdl_s; 00039 00040 /** 00041 * \brief Received device server security 00042 */ 00043 typedef enum omalw_server_security_ { 00044 SEC_NOT_SET = -1, 00045 PSK = 0, 00046 RPK = 1, 00047 CERTIFICATE = 2, 00048 NO_SEC = 3 00049 } omalw_server_security_t; 00050 00051 /** 00052 * \brief Endpoint binding and mode 00053 */ 00054 typedef enum sn_nsdl_oma_binding_and_mode_ { 00055 BINDING_MODE_NOT_SET = 0, 00056 BINDING_MODE_U = 0x01, 00057 BINDING_MODE_Q = 0x02, 00058 BINDING_MODE_S = 0x04 00059 } sn_nsdl_oma_binding_and_mode_t; 00060 00061 /** 00062 * \brief Endpoint registration mode. 00063 * If REGISTER_WITH_RESOURCES, endpoint sends list of all resources during registration. 00064 * If REGISTER_WITH_TEMPLATE, endpoint sends registration without resource list. Device server must have 00065 * correctly configured template. 00066 */ 00067 typedef enum sn_nsdl_registration_mode_ { 00068 REGISTER_WITH_RESOURCES = 0, 00069 REGISTER_WITH_TEMPLATE 00070 } sn_nsdl_registration_mode_t; 00071 00072 00073 typedef struct omalw_certificate_list_ { 00074 uint8_t certificate_chain_len; 00075 uint8_t *certificate_ptr[2]; 00076 uint16_t certificate_len[2]; 00077 uint8_t *own_private_key_ptr; 00078 uint16_t own_private_key_len; 00079 } omalw_certificate_list_t; 00080 00081 /** 00082 * \brief Endpoint registration parameters 00083 */ 00084 typedef struct sn_nsdl_ep_parameters_ { 00085 uint8_t *endpoint_name_ptr; /**< Endpoint name */ 00086 uint8_t endpoint_name_len; 00087 00088 uint8_t *domain_name_ptr; /**< Domain to register. If null, NSP uses default domain */ 00089 uint8_t domain_name_len; 00090 00091 uint8_t *type_ptr; /**< Endpoint type */ 00092 uint8_t type_len; 00093 00094 uint8_t *lifetime_ptr; /**< Endpoint lifetime in seconds. eg. "1200" = 1200 seconds */ 00095 uint8_t lifetime_len; 00096 00097 sn_nsdl_registration_mode_t ds_register_mode; /**< Defines registration mode */ 00098 sn_nsdl_oma_binding_and_mode_t binding_and_mode; /**< Defines endpoints binding and mode */ 00099 00100 uint8_t *location_ptr; /**< Endpoint location in server, optional parameter,default is NULL */ 00101 uint8_t location_len; 00102 00103 } sn_nsdl_ep_parameters_s; 00104 00105 /** 00106 * \brief For internal use 00107 */ 00108 typedef struct sn_nsdl_sent_messages_ { 00109 uint16_t msg_id_number; 00110 uint8_t message_type; 00111 ns_list_link_t link; 00112 } sn_nsdl_sent_messages_s; 00113 00114 /** 00115 * \brief Includes resource path 00116 */ 00117 typedef struct sn_grs_resource_ { 00118 uint8_t pathlen; 00119 uint8_t *path; 00120 } sn_grs_resource_s; 00121 00122 /** 00123 * \brief Table of created resources 00124 */ 00125 typedef struct sn_grs_resource_list_ { 00126 uint8_t res_count; /**< Number of resources */ 00127 sn_grs_resource_s *res; 00128 } sn_grs_resource_list_s; 00129 00130 /** 00131 * \brief Resource access rights 00132 */ 00133 typedef enum sn_grs_resource_acl_ { 00134 SN_GRS_GET_ALLOWED = 0x01 , 00135 SN_GRS_PUT_ALLOWED = 0x02, 00136 SN_GRS_POST_ALLOWED = 0x04, 00137 SN_GRS_DELETE_ALLOWED = 0x08 00138 } sn_grs_resource_acl_e; 00139 00140 00141 typedef enum sn_nsdl_oma_device_error_ { 00142 NO_ERROR = 0, 00143 LOW_BATTERY_POWER = 1, 00144 EXTERNAL_POWER_SUPPLY_OFF = 2, 00145 GPS_MODULE_FAILURE = 3, 00146 LOW_RECEIVED_SIGNAL_STRENGTH = 4, 00147 OUT_OF_MEMORY = 5, 00148 SMS_FAILURE = 6, 00149 IP_CONN_FAILURE = 7, 00150 PERIPHERAL_MALFUNCTION = 8 00151 } sn_nsdl_oma_device_error_t; 00152 00153 /** 00154 * \brief Defines the resource mode 00155 */ 00156 typedef enum sn_nsdl_resource_mode_ { 00157 SN_GRS_STATIC, /**< Static resources have some value that doesn't change */ 00158 SN_GRS_DYNAMIC, /**< Dynamic resources are handled in application. Therefore one must give function callback pointer to them */ 00159 SN_GRS_DIRECTORY /**< Directory resources are unused and unsupported */ 00160 } sn_nsdl_resource_mode_e; 00161 00162 /** 00163 * \brief Resource registration parameters 00164 */ 00165 typedef struct sn_nsdl_resource_parameters_ { 00166 uint8_t *resource_type_ptr; 00167 uint16_t resource_type_len; 00168 00169 uint8_t *interface_description_ptr; 00170 uint16_t interface_description_len; 00171 00172 uint8_t coap_content_type; 00173 00174 uint8_t mime_content_type; 00175 00176 uint8_t observable; 00177 00178 uint8_t registered; 00179 00180 } sn_nsdl_resource_parameters_s; 00181 00182 /** 00183 * \brief Defines parameters for the resource. 00184 */ 00185 typedef struct sn_nsdl_resource_info_ { 00186 sn_nsdl_resource_parameters_s *resource_parameters_ptr; 00187 00188 sn_nsdl_resource_mode_e mode; /**< STATIC etc.. */ 00189 00190 uint16_t pathlen; /**< Address */ 00191 uint8_t *path; 00192 00193 uint16_t resourcelen; /**< 0 if dynamic resource, resource information in static resource */ 00194 uint8_t *resource; /**< NULL if dynamic resource */ 00195 00196 sn_grs_resource_acl_e access; 00197 00198 uint8_t (*sn_grs_dyn_res_callback)(struct nsdl_s *, sn_coap_hdr_s *, sn_nsdl_addr_s *, sn_nsdl_capab_e); 00199 00200 ns_list_link_t link; 00201 00202 } sn_nsdl_resource_info_s; 00203 00204 /** 00205 * \brief Defines OMA device object parameters. 00206 */ 00207 typedef struct sn_nsdl_oma_device_ { 00208 sn_nsdl_oma_device_error_t error_code; /**< Error code. Mandatory. Can be more than one */ 00209 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 */ 00210 00211 } sn_nsdl_oma_device_t; 00212 00213 /** 00214 * \brief Defines OMAlw server information 00215 */ 00216 typedef struct sn_nsdl_oma_server_info_ { 00217 sn_nsdl_addr_s *omalw_address_ptr; 00218 omalw_server_security_t omalw_server_security; 00219 00220 } sn_nsdl_oma_server_info_t; 00221 00222 /** 00223 * \brief Defines endpoint parameters to OMA bootstrap. 00224 */ 00225 typedef struct sn_nsdl_bs_ep_info_ { 00226 void (*oma_bs_status_cb)(sn_nsdl_oma_server_info_t *); /**< Callback for OMA bootstrap status */ 00227 sn_nsdl_oma_device_t *device_object; /**< OMA LWM2M mandatory device resources */ 00228 } sn_nsdl_bs_ep_info_t; 00229 00230 00231 00232 00233 /** 00234 * \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 *), 00235 * uint8_t (*sn_nsdl_rx_cb)(sn_coap_hdr_s *, sn_nsdl_addr_s *), 00236 * sn_nsdl_mem_s *sn_memory) 00237 * 00238 * \brief Initialization function for NSDL library. Initializes NSDL, GRS, HTTP and CoAP. 00239 * 00240 * \param *sn_nsdl_tx_callback A callback function for sending messages. 00241 * 00242 * \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 00243 * reply for some DS messages (register message etc.), rx callback will be called. 00244 * 00245 * \param *sn_memory Memory structure which includes function pointers to the allocation and free functions. 00246 * 00247 * \return pointer to created handle structure. NULL if failed 00248 */ 00249 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 *), 00250 uint8_t (*sn_nsdl_rx_cb)(struct nsdl_s *, sn_coap_hdr_s *, sn_nsdl_addr_s *), 00251 void *(*sn_nsdl_alloc)(uint16_t), void (*sn_nsdl_free)(void *)); 00252 00253 /** 00254 * \fn extern uint16_t sn_nsdl_register_endpoint(struct nsdl_s *handle, sn_nsdl_ep_parameters_s *endpoint_info_ptr); 00255 * 00256 * \brief Registers endpoint to mbed Device Server. 00257 * \param *handle Pointer to nsdl-library handle 00258 * \param *endpoint_info_ptr Contains endpoint information. 00259 * 00260 * \return registration message ID, 0 if failed 00261 */ 00262 extern uint16_t sn_nsdl_register_endpoint(struct nsdl_s *handle, sn_nsdl_ep_parameters_s *endpoint_info_ptr); 00263 00264 /** 00265 * \fn extern uint16_t sn_nsdl_unregister_endpoint(struct nsdl_s *handle) 00266 * 00267 * \brief Sends unregister-message to mbed Device Server. 00268 * 00269 * \param *handle Pointer to nsdl-library handle 00270 * 00271 * \return unregistration message ID, 0 if failed 00272 */ 00273 extern uint16_t sn_nsdl_unregister_endpoint(struct nsdl_s *handle); 00274 00275 /** 00276 * \fn extern uint16_t sn_nsdl_update_registration(struct nsdl_s *handle, uint8_t *lt_ptr, uint8_t lt_len); 00277 * 00278 * \brief Update the registration with mbed Device Server. 00279 * 00280 * \param *handle Pointer to nsdl-library handle 00281 * \param *lt_ptr Pointer to lifetime value string in ascii form, eg. "1200" 00282 * \param lt_len Length of the lifetime string 00283 * 00284 * \return registration update message ID, 0 if failed 00285 */ 00286 extern uint16_t sn_nsdl_update_registration(struct nsdl_s *handle, uint8_t *lt_ptr, uint8_t lt_len); 00287 00288 /** 00289 * \fn extern int8_t sn_nsdl_set_endpoint_location(struct nsdl_s *handle, uint8_t *location_ptr, uint8_t location_len); 00290 * 00291 * \brief Sets the location receievd from Device Server. 00292 * 00293 * \param *handle Pointer to nsdl-library handle 00294 * \param *lt_ptr Pointer to location value string , eg. "s322j4k" 00295 * \param lt_len Length of the location string 00296 * 00297 * \return success, 0 if failed -1 00298 */ 00299 extern int8_t sn_nsdl_set_endpoint_location(struct nsdl_s *handle, uint8_t *location_ptr, uint8_t location_len); 00300 00301 00302 /** 00303 * \fn extern int8_t sn_nsdl_is_ep_registered(struct nsdl_s *handle) 00304 * 00305 * \brief Checks if endpoint is registered. 00306 * 00307 * \param *handle Pointer to nsdl-library handle 00308 * 00309 * \return 1 Endpoint registration is done successfully 00310 * \return 0 Endpoint is not registered 00311 */ 00312 extern int8_t sn_nsdl_is_ep_registered(struct nsdl_s *handle); 00313 00314 /** 00315 * \fn extern void sn_nsdl_nsp_lost(struct nsdl_s *handle); 00316 * 00317 * \brief A function to inform mbed Device C client library if application detects a fault in mbed Device Server registration. 00318 * 00319 * \param *handle Pointer to nsdl-library handle 00320 * 00321 * After calling this function sn_nsdl_is_ep_registered() will return "not registered". 00322 */ 00323 extern void sn_nsdl_nsp_lost(struct nsdl_s *handle); 00324 00325 /** 00326 * \fn extern uint16_t sn_nsdl_send_observation_notification(struct nsdl_s *handle, uint8_t *token_ptr, uint8_t token_len, 00327 * uint8_t *payload_ptr, uint16_t payload_len, 00328 * uint8_t *observe_ptr, uint8_t observe_len, 00329 * sn_coap_msg_type_e message_type, uint8_t content_type) 00330 * 00331 * 00332 * \brief Sends observation message to mbed Device Server 00333 * 00334 * \param *handle Pointer to nsdl-library handle 00335 * \param *token_ptr Pointer to token to be used 00336 * \param token_len Token length 00337 * \param *payload_ptr Pointer to payload to be sent 00338 * \param payload_len Payload length 00339 * \param *observe_ptr Pointer to observe number to be sent 00340 * \param observe_len Observe number len 00341 * \param message_type Observation message type (confirmable or non-confirmable) 00342 * \param contetnt_type Observation message payload contetnt type 00343 * 00344 * \return !0 Success, observation messages message ID 00345 * \return 0 Failure 00346 */ 00347 extern uint16_t sn_nsdl_send_observation_notification(struct nsdl_s *handle, uint8_t *token_ptr, uint8_t token_len, 00348 uint8_t *payload_ptr, uint16_t payload_len, 00349 uint8_t *observe_ptr, uint8_t observe_len, 00350 sn_coap_msg_type_e message_type, uint8_t content_type); 00351 00352 /** 00353 * \fn extern uint32_t sn_nsdl_get_version(void) 00354 * 00355 * \brief Version query function. 00356 * 00357 * Used to retrieve the version information from the mbed Device C Client library. 00358 * 00359 * \return Pointer to library version string 00360 */ 00361 extern char *sn_nsdl_get_version(void); 00362 00363 /** 00364 * \fn extern int8_t sn_nsdl_process_coap(struct nsdl_s *handle, uint8_t *packet, uint16_t packet_len, sn_nsdl_addr_s *src) 00365 * 00366 * \brief To push CoAP packet to mbed Device C Client library 00367 * 00368 * Used to push an CoAP packet to mbed Device C Client library for processing. 00369 * 00370 * \param *handle Pointer to nsdl-library handle 00371 * 00372 * \param *packet Pointer to a uint8_t array containing the packet (including the CoAP headers). 00373 * After successful execution this array may contain the response packet. 00374 * 00375 * \param *packet_len Pointer to length of the packet. After successful execution this array may contain the length 00376 * of the response packet. 00377 * 00378 * \param *src Pointer to packet source address information. After successful execution this array may contain 00379 * the destination address of the response packet. 00380 * 00381 * \return 0 Success 00382 * \return -1 Failure 00383 */ 00384 extern int8_t sn_nsdl_process_coap(struct nsdl_s *handle, uint8_t *packet, uint16_t packet_len, sn_nsdl_addr_s *src); 00385 00386 /** 00387 * \fn extern int8_t sn_nsdl_exec(struct nsdl_s *handle, uint32_t time); 00388 * 00389 * \brief CoAP retransmission function. 00390 * 00391 * Used to give execution time for the mbed Device C Client library for retransmissions. 00392 * 00393 * \param *handle Pointer to nsdl-library handle 00394 * 00395 * \param time Time in seconds. 00396 * 00397 * \return 0 Success 00398 * \return -1 Failure 00399 */ 00400 extern int8_t sn_nsdl_exec(struct nsdl_s *handle, uint32_t time); 00401 00402 /** 00403 * \fn extern int8_t sn_nsdl_create_resource(struct nsdl_s *handle, sn_nsdl_resource_info_s *res); 00404 * 00405 * \brief Resource creating function. 00406 * 00407 * Used to create a static or dynamic CoAP resource. 00408 * 00409 * \param *res Pointer to a structure of type sn_nsdl_resource_info_t that contains the information 00410 * about the resource. 00411 * 00412 * \return 0 Success 00413 * \return -1 Failure 00414 * \return -2 Resource already exists 00415 * \return -3 Invalid path 00416 * \return -4 List adding failure 00417 */ 00418 extern int8_t sn_nsdl_create_resource(struct nsdl_s *handle, sn_nsdl_resource_info_s *res); 00419 00420 /** 00421 * \fn extern int8_t sn_nsdl_update_resource(sn_nsdl_resource_info_s *res) 00422 * 00423 * \brief Resource updating function. 00424 * 00425 * Used to update the direct value of a static resource, the callback function pointer of a dynamic resource 00426 * and access rights of the recource. 00427 * 00428 * \param *handle Pointer to nsdl-library handle 00429 * \param *res Pointer to a structure of type sn_nsdl_resource_info_t that contains the information 00430 * about the resource. Only the pathlen and path elements are evaluated along with 00431 * either resourcelen and resource or the function pointer. 00432 * 00433 * \return 0 Success 00434 * \return -1 Failure 00435 */ 00436 extern int8_t sn_nsdl_update_resource(struct nsdl_s *handle, sn_nsdl_resource_info_s *res); 00437 00438 /** 00439 * \fn extern int8_t sn_nsdl_delete_resource(struct nsdl_s *handle, uint8_t pathlen, uint8_t *path) 00440 * 00441 * \brief Resource delete function. 00442 * 00443 * Used to delete a resource. If resource has a subresources, these all must also be removed. 00444 * 00445 * \param *handle Pointer to nsdl-library handle 00446 * \param pathlen Contains the length of the path that is to be deleted (excluding possible trailing "\0"). 00447 * \param *path_ptr A pointer to an array containing the path. 00448 * 00449 * \return 0 Success 00450 * \return -1 Failure (No such resource) 00451 */ 00452 extern int8_t sn_nsdl_delete_resource(struct nsdl_s *handle, uint16_t pathlen, uint8_t *path); 00453 00454 /** 00455 * \fn extern sn_nsdl_resource_info_s *sn_nsdl_get_resource(struct nsdl_s *handle, uint16_t pathlen, uint8_t *path) 00456 * 00457 * \brief Resource get function. 00458 * 00459 * Used to get a resource. 00460 * 00461 * \param *handle Pointer to nsdl-library handle 00462 * \param pathlen Contains the length of the path that is to be returned (excluding possible trailing '\0'). 00463 * \param *path A pointer to an array containing the path. 00464 * 00465 * \return !NULL Success, pointer to a sn_nsdl_resource_info_s that contains the resource information\n 00466 * \return NULL Failure 00467 */ 00468 extern sn_nsdl_resource_info_s *sn_nsdl_get_resource(struct nsdl_s *handle, uint16_t pathlen, uint8_t *path); 00469 00470 /** 00471 * \fn extern sn_grs_resource_list_s *sn_nsdl_list_resource(struct nsdl_s *handle, uint16_t pathlen, uint8_t *path) 00472 * 00473 * \brief Resource list function. 00474 * 00475 * \param *handle Pointer to nsdl-library handle 00476 * \param pathlen Contains the length of the target path (excluding possible trailing '\0'). 00477 * The length value is not examined if the path itself is a NULL pointer. 00478 * \param *path A pointer to an array containing the path or a NULL pointer. 00479 * 00480 * \return !NULL A pointer to a sn_grs_resource_list_s structure containing the resource listing. 00481 * \return NULL Failure with an unspecified error 00482 */ 00483 sn_grs_resource_list_s *sn_nsdl_list_resource(struct nsdl_s *handle, uint16_t pathlen, uint8_t *path); 00484 00485 /** 00486 * \fn extern void sn_nsdl_free_resource_list(struct nsdl_s *handle, sn_grs_resource_list_s *list) 00487 * 00488 * \brief Free a resource list obtained from sn_nsdl_list_resource() 00489 * 00490 * \param list The list to free, or NULL. 00491 */ 00492 void sn_nsdl_free_resource_list(struct nsdl_s *handle, sn_grs_resource_list_s *list); 00493 00494 /** 00495 * \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); 00496 * 00497 * \brief Send an outgoing CoAP request. 00498 * 00499 * \param *handle Pointer to nsdl-library handle 00500 * \param *address_ptr Pointer to source address struct 00501 * \param *coap_hdr_ptr Pointer to CoAP message to be sent 00502 * 00503 * \return 0 Success 00504 * \return -1 Failure 00505 */ 00506 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); 00507 00508 /** 00509 * \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); 00510 * 00511 * \brief This function is used to set the mbed Device Server address given by an application. 00512 * 00513 * \param *handle Pointer to nsdl-library handle 00514 * \return 0 Success 00515 * \return -1 Failed to indicate that internal address pointer is not allocated (call nsdl_init() first). 00516 */ 00517 extern int8_t set_NSP_address(struct nsdl_s *handle, uint8_t *NSP_address, uint16_t port, sn_nsdl_addr_type_e address_type); 00518 00519 /** 00520 * \fn extern int8_t sn_nsdl_destroy(struct nsdl_s *handle); 00521 * 00522 * \param *handle Pointer to nsdl-library handle 00523 * \brief This function releases all allocated memory in mbed Device C Client library. 00524 */ 00525 extern int8_t sn_nsdl_destroy(struct nsdl_s *handle); 00526 00527 /** 00528 * \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); 00529 * 00530 * \brief Starts OMA bootstrap process 00531 * 00532 * \param *handle Pointer to nsdl-library handle 00533 * 00534 * \return bootstrap message ID, 0 if failed 00535 */ 00536 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); 00537 00538 /** 00539 * \fn extern omalw_certificate_list_t *sn_nsdl_get_certificates(struct nsdl_s *handle); 00540 * 00541 * \brief Get pointer to received device server certificates 00542 * 00543 * \param *handle Pointer to nsdl-library handle 00544 */ 00545 extern omalw_certificate_list_t *sn_nsdl_get_certificates(struct nsdl_s *handle); 00546 00547 /** 00548 * \fn extern int8_t sn_nsdl_update_certificates(struct nsdl_s *handle, omalw_certificate_list_t* certificate_ptr, uint8_t certificate_chain); 00549 * 00550 * \brief Updates certificate pointers to resource server. 00551 * 00552 * \param *handle Pointer to nsdl-library handle 00553 */ 00554 extern int8_t sn_nsdl_update_certificates(struct nsdl_s *handle, omalw_certificate_list_t *certificate_ptr, uint8_t certificate_chain); 00555 00556 /** 00557 * \fn extern int8_t sn_nsdl_create_oma_device_object(struct nsdl_s *handle, sn_nsdl_oma_device_t *device_object_ptr); 00558 * 00559 * \brief Creates new device object resource 00560 * 00561 * \param *handle Pointer to nsdl-library handle 00562 */ 00563 extern int8_t sn_nsdl_create_oma_device_object(struct nsdl_s *handle, sn_nsdl_oma_device_t *device_object_ptr); 00564 00565 /** 00566 * \fn sn_coap_hdr_s *sn_nsdl_build_response(struct nsdl_s *handle, sn_coap_hdr_s *coap_packet_ptr, uint8_t msg_code) 00567 * 00568 * \brief Prepares generic response packet from a request packet. This function allocates memory for the resulting sn_coap_hdr_s 00569 * 00570 * \param *handle Pointer to library handle 00571 * \param *coap_packet_ptr The request packet pointer 00572 * \param msg_code response messages code 00573 * 00574 * \return *coap_packet_ptr The allocated and pre-filled response packet pointer 00575 * NULL Error in parsing the request 00576 * 00577 */ 00578 extern sn_coap_hdr_s *sn_nsdl_build_response(struct nsdl_s *handle, sn_coap_hdr_s *coap_packet_ptr, uint8_t msg_code); 00579 00580 /** 00581 * \fn void sn_nsdl_release_allocated_coap_msg_mem(struct nsdl_s *handle, sn_coap_hdr_s *freed_coap_msg_ptr) 00582 * 00583 * \brief Releases memory of given CoAP message 00584 * 00585 * Note!!! Does not release Payload part 00586 * 00587 * \param *handle Pointer to CoAP library handle 00588 * 00589 * \param *freed_coap_msg_ptr is pointer to released CoAP message 00590 */ 00591 extern void sn_nsdl_release_allocated_coap_msg_mem(struct nsdl_s *handle, sn_coap_hdr_s *freed_coap_msg_ptr); 00592 00593 #ifdef __cplusplus 00594 } 00595 #endif 00596 00597 #endif /* SN_NSDL_LIB_H_ */ 00598
Generated on Tue Jul 12 2022 19:08:13 by
