Wirepas SDK
provisioning.h
Go to the documentation of this file.
1/* Copyright 2019 Wirepas Ltd. All Rights Reserved.
2 *
3 * See file LICENSE.txt for full license details.
4 *
5 */
6#ifndef _PROVISIONING_H_
7#define _PROVISIONING_H_
8
9#include <stdint.h>
10#include "api.h"
11#include "wms_joining.h"
12#include "wms_settings.h"
13#if !defined(CBOR_H)
14# include "cbor.h"
15#endif
16
27
28
33#define PROV_UUID_SIZE_BYTES 16
34
38#define PROV_KEY_SIZE_BYTES 16
39
43#define PROV_UID_MAX_SIZE_BYTES 79
44
48#define PROV_AUTH_UID_SIZE_BYTES 16
49
67
93
94typedef union
95{
97 struct
98 {
100 uint8_t authenticator_uid_type;
102 uint8_t authenticator_uid[PROV_AUTH_UID_SIZE_BYTES];
104 uint8_t node_uid_type;
106 uint8_t node_uid[PROV_UUID_SIZE_BYTES];
107 };
109
110
115typedef struct
116{
120 uint8_t nb_retry;
122 uint16_t timeout_s;
127
132 struct
133 {
134 uint8_t auth_key[PROV_KEY_SIZE_BYTES];
135 uint8_t enc_key[PROV_KEY_SIZE_BYTES];
136 } prov_keys;
138
139
143#define PROV_METHOD_IS_UNSECURED(x) ((x) == PROV_METHOD_UNSECURED)
144
148#define PROV_METHOD_IS_SECURED(x) ((x) != PROV_METHOD_UNSECURED)
149
153#define PROV_METHOD_IS_EXTENDED_UID(x) ((x) == PROV_METHOD_EXTENDED_UID || x == PROV_METHOD_EXTENDED_UID_KEY_MGMT)
154
158#define PROV_METHOD_IS_KEY_MGMT(x) ((x) == PROV_METHOD_EXTENDED_UID_KEY_MGMT)
159
169
181typedef void (*provisioning_user_data_cb_f)(uint32_t id,
182 CborType type,
183 uint8_t * data,
184 uint8_t len);
185
196typedef const app_lib_joining_received_beacon_t *
197 (*provisioning_joining_beacon_cb_f)
198 (const app_lib_joining_received_beacon_t * beacons);
199
215
235 const uint8_t * uid,
236 uint8_t uid_len,
239
262
292
314
321
330
344
353
361
371
381
391
401
402#endif //_PROVISIONING_H_
CborType
Definition cbor.h:82
provisioning_ret_e
Return codes of provisioning functions.
@ PROV_RET_OK
@ PROV_RET_INVALID_DATA
@ PROV_RET_JOINING_LIB_ERROR
@ PROV_RET_INVALID_STATE
@ PROV_RET_INTERNAL_ERROR
@ PROV_RET_INVALID_PARAM
const app_lib_joining_received_beacon_t *(* provisioning_joining_beacon_cb_f)(const app_lib_joining_received_beacon_t *beacons)
Selects which joining beacon to connect to at the end of a scan.
provisioning_ret_e Provisioning_settings_read(provisioning_settings_t *settings)
Reads provisioning settings from the secure storage.
provisioning_ret_e Provisioning_Proxy_init(provisioning_proxy_conf_t *conf)
Initialize the provisioning proxy.
#define PROV_KEY_SIZE_BYTES
All security keys are 16 bytes long.
provisioning_joining_beacon_cb_f beacon_joining_cb
provisioning_ret_e Provisioning_init(provisioning_conf_t *conf)
Initialize the provisioning process.
provisioning_method_e method
provisioning_proxy_start_cb_f start_cb
provisioning_settings_t settings
provisioning_res_e
Provisioning result.
@ PROV_RES_ERROR_FAILSAFE
@ PROV_RES_INVALID_DATA
@ PROV_RES_SUCCESS
@ PROV_RES_ERROR_JOINING
@ PROV_RES_INVALID_PACKET
@ PROV_RES_STOPPED
@ PROV_RES_ERROR_NO_ROUTE
@ PROV_RES_ERROR_SCANNING_BEACONS
@ PROV_RES_TIMEOUT
@ PROV_RES_ERROR_INTERNAL
@ PROV_RES_ERROR_SENDING_DATA
@ PROV_RES_NACK
#define PROV_AUTH_UID_SIZE_BYTES
Authenticator UID size.
provisioning_ret_e Provisioning_settings_write(const provisioning_settings_t *settings)
Writes provisioning settings to the secure storage.
void(* provisioning_user_data_cb_f)(uint32_t id, CborType type, uint8_t *data, uint8_t len)
Received User provisioning data callback. Provisioning data is received as a map of id:data....
#define PROV_UID_MAX_SIZE_BYTES
Maximum size of provisioning UID.
provisioning_user_data_cb_f user_data_cb
app_lib_settings_net_channel_t net_chan
provisioning_ret_e Provisioning_Proxy_start(void)
Start sending joining beacons. Provisioning packets will be forwarded to provisioning server or treat...
provisioning_ret_e Provisioning_start(void)
Start the provisioning process.
bool(* provisioning_proxy_start_cb_f)(const uint8_t *uid, uint8_t uid_len, provisioning_method_e method, provisioning_proxy_net_param_t *net_param)
The proxy received START packet callback. This function is called when the proxy receives a valid STA...
bool(* provisioning_end_cb_f)(provisioning_res_e result)
The end provisioning callback. This function is called at the end of the provisioning process.
provisioning_uid_t prov_uid
void Provisioning_register_csap_handlers(void)
Register the Remote API CSAP handlers for the provisioning_config attribute (0xC001) without initiali...
#define PROV_UUID_SIZE_BYTES
provisioning_method_e
Provisioning methods.
@ PROV_METHOD_UNSECURED
@ PROV_METHOD_EXTENDED_UID
@ PROV_METHOD_EXTENDED_UID_KEY_MGMT
@ PROV_METHOD_SECURED
provisioning_ret_e Provisioning_stop(void)
Stops the provisioning process.
provisioning_end_cb_f end_cb
provisioning_ret_e Provisioning_Proxy_stop(void)
Stops the provisioning proxy.
app_lib_settings_net_addr_t net_addr
provisioning_ret_e Provisioning_init_from_storage(provisioning_conf_t *conf)
Initialize the provisioning process with provisioning settings from the secure storage.
This structure contains the network parameters sent by the provisioning proxy to the new node.
This structure contains all provisioning related parameters.
This structure contains the provisioning settings stored in the secure storage.
This structure holds the joining proxy parameters.
uint32_t app_lib_settings_net_addr_t
Network address type definition.
#define APP_LIB_SETTINGS_AES_KEY_NUM_BYTES
AES key size in bytes.
uint8_t app_lib_settings_net_channel_t
Channel type definition.