Wirepas SDK
provisioning_int.h File Reference

Go to the source code of this file.

Typedefs

typedef void(* provisioning_joining_end_cb_f) (provisioning_res_e result)
 The end joining callback. This function is called at the end of the joining process. More...
 

Functions

provisioning_ret_e Provisioning_Data_decode (provisioning_data_conf_t *conf, bool dry_run)
 Decode (and apply if valid) the received provisioning data. More...
 
provisioning_ret_e Provisioning_Joining_init (provisioning_joining_conf_t *conf)
 Initialize the Joining module. More...
 
provisioning_ret_e Provisioning_Joining_start (void)
 Start the joining process (listen to joining beacon and select a network to join). More...
 
provisioning_ret_e Provisioning_Joining_stop (void)
 Stops the joining process. More...
 

Data Structures

struct  pdu_prov_hdr_t
 
struct  pdu_prov_start_t
 
struct  pdu_prov_data_t
 
struct  pdu_prov_data_ack_t
 
struct  pdu_prov_nack_t
 
union  pdu_prov_t
 
struct  provisioning_data_conf_t
 This structure holds the provisioning data parameters. More...
 
struct  provisioning_joining_conf_t
 This structure holds the joining node parameters. More...
 
union  pdu_prov_t.__unnamed__
 

Enumerations

enum  provisioning_data_ids_e {
  PROV_DATA_ID_ENC_KEY = 0, PROV_DATA_ID_AUTH_KEY = 1, PROV_DATA_ID_NET_ADDR = 2, PROV_DATA_ID_NET_CHAN = 3,
  PROV_DATA_ID_NODE_ADDR = 4, PROV_DATA_ID_NODE_ROLE = 5
}
 List of Wirepas Ids for CBOR encoded provisioning data. More...
 
enum  prov_packet_type_e { PROV_PACKET_TYPE_START = 1, PROV_PACKET_TYPE_DATA = 2, PROV_PACKET_TYPE_DATA_ACK = 3, PROV_PACKET_TYPE_NACK = 4 }
 
enum  prov_nack_type_e { PROV_NACK_TYPE_NOT_AUTHORIZED = 0, PROV_NACK_TYPE_METHOD_NOT_SUPPORTED = 1, PROV_NACK_TYPE_INVALID_DATA = 2, PROV_NACK_TYPE_INVALID_KEY_IDX = 3 }
 

Macros

#define PROV_DOWNLINK_EP   255
 
#define PROV_UPLINK_EP   246
 
#define PROV_PDU_SIZE   102
 
#define PROV_CTR_SIZE   2
 
#define PROV_MIC_SIZE   5
 
#define ENC_KEY_OFFSET   16
 
#define PROV_DATA_OFFSET   (sizeof(pdu_prov_hdr_t) + 1 + PROV_CTR_SIZE)
 
#define PROV_DATA_MIN_USER_ID   128
 
#define PROV_DATA_MAX_USER_ID   255
 
#define JOINING_NETWORK_ADDRESS   0x9E4ADC
 
#define JOINING_NETWORK_CHANNEL   4
 
#define JOINING_RX_TIMEOUT   600
 
#define JOINING_TX_INTERVAL   500
 
#define JOINING_BEACON_TYPE   0x647650fb
 

Typedef Documentation

◆ provisioning_joining_end_cb_f

typedef void(* provisioning_joining_end_cb_f) (provisioning_res_e result)

The end joining callback. This function is called at the end of the joining process.

Parameters
resultResult of the joining process.

Definition at line 170 of file provisioning_int.h.

Function Documentation

◆ Provisioning_Data_decode()

provisioning_ret_e Provisioning_Data_decode ( provisioning_data_conf_t conf,
bool  dry_run 
)

Decode (and apply if valid) the received provisioning data.

Parameters
confConfiguration for the provisioning data decoder.
dry_runIf true, only check data validity and don't apply it.
Returns
Result code, PROV_RET_OK if config is valid. See provisioning_ret_e for other return codes.

◆ Provisioning_Joining_init()

provisioning_ret_e Provisioning_Joining_init ( provisioning_joining_conf_t conf)

Initialize the Joining module.

Note
If Joining is used, App_scheduler MUST BE initialized in App_Init of the application. Also startJoiningBeaconRx function offered by Joining library and setRouteCb function offered by State library MUST NOT be used outside of this module.
Joining module needs 2 tasks from App_scheduler.
Parameters
confConfiguration for the Joining module.
Returns
Result code, PROV_RET_OK if ok. See provisioning_ret_e for other return codes.

◆ Provisioning_Joining_start()

provisioning_ret_e Provisioning_Joining_start ( void  )

Start the joining process (listen to joining beacon and select a network to join).

Returns
Result code, PROV_RET_OK if joining has started. See provisioning_ret_e for other return codes.

◆ Provisioning_Joining_stop()

provisioning_ret_e Provisioning_Joining_stop ( void  )

Stops the joining process.

Note
All taken callback and tasks are freed.
Stop is not immediate, run_state_machine function must be scheduled first (typ. 100ms).
Returns
Result code, PROV_RET_OK if joining has stopped. See provisioning_ret_e for other return codes.

Data Structure Documentation

◆ pdu_prov_hdr_t

struct pdu_prov_hdr_t

Definition at line 98 of file provisioning_int.h.

Data Fields
app_addr_t address
uint8_t session_id
uint8_t type

◆ pdu_prov_start_t

struct pdu_prov_start_t

Definition at line 105 of file provisioning_int.h.

Data Fields
uint8_t iv[AES_128_KEY_BLOCK_SIZE]
uint8_t method
pdu_prov_hdr_t pdu_header
uint8_t uid[102 - sizeof(pdu_prov_hdr_t) - 1 - AES_128_KEY_BLOCK_SIZE]

◆ pdu_prov_data_t

struct pdu_prov_data_t

Definition at line 114 of file provisioning_int.h.

Data Fields
uint16_t counter
uint8_t data[102 -(sizeof(pdu_prov_hdr_t)+1+2) - 5]
uint8_t key_index
pdu_prov_hdr_t pdu_header

◆ pdu_prov_data_ack_t

struct pdu_prov_data_ack_t

Definition at line 125 of file provisioning_int.h.

Data Fields
pdu_prov_hdr_t pdu_header

◆ pdu_prov_nack_t

struct pdu_prov_nack_t

Definition at line 130 of file provisioning_int.h.

Data Fields
uint8_t nack_type
pdu_prov_hdr_t pdu_header

◆ pdu_prov_t

union pdu_prov_t

Definition at line 136 of file provisioning_int.h.

Data Fields
union pdu_prov_t __unnamed__
pdu_prov_data_t data
pdu_prov_data_ack_t data_ack
pdu_prov_nack_t nack
pdu_prov_start_t start

◆ provisioning_data_conf_t

struct provisioning_data_conf_t

This structure holds the provisioning data parameters.

Definition at line 152 of file provisioning_int.h.

Data Fields
uint8_t * buffer

buffer containing provisioning data.

provisioning_end_cb_f end_cb

End provisioning callback.

uint8_t length

length of provisioning buffer.

provisioning_user_data_cb_f user_data_cb

Data provisioning callback.

◆ provisioning_joining_conf_t

struct provisioning_joining_conf_t

This structure holds the joining node parameters.

Definition at line 175 of file provisioning_int.h.

Data Fields
provisioning_joining_end_cb_f end_cb

End joining callback.

provisioning_joining_beacon_cb_f joining_cb

Callback used to select which beacon to connect to.

uint8_t nb_retry

How many retries are allowed to connect to a network.

◆ pdu_prov_t.__unnamed__

union pdu_prov_t.__unnamed__

Definition at line 138 of file provisioning_int.h.

Data Fields
pdu_prov_hdr_t pdu_header
uint8_t pld[102 - sizeof(pdu_prov_hdr_t)]

Enumeration Type Documentation

◆ prov_nack_type_e

Enumerator
PROV_NACK_TYPE_NOT_AUTHORIZED 
PROV_NACK_TYPE_METHOD_NOT_SUPPORTED 
PROV_NACK_TYPE_INVALID_DATA 
PROV_NACK_TYPE_INVALID_KEY_IDX 

Definition at line 90 of file provisioning_int.h.

◆ prov_packet_type_e

Enumerator
PROV_PACKET_TYPE_START 
PROV_PACKET_TYPE_DATA 
PROV_PACKET_TYPE_DATA_ACK 
PROV_PACKET_TYPE_NACK 

Definition at line 82 of file provisioning_int.h.

◆ provisioning_data_ids_e

List of Wirepas Ids for CBOR encoded provisioning data.

Enumerator
PROV_DATA_ID_ENC_KEY 
PROV_DATA_ID_AUTH_KEY 
PROV_DATA_ID_NET_ADDR 
PROV_DATA_ID_NET_CHAN 
PROV_DATA_ID_NODE_ADDR 
PROV_DATA_ID_NODE_ROLE 

Definition at line 72 of file provisioning_int.h.

Macro Definition Documentation

◆ ENC_KEY_OFFSET

#define ENC_KEY_OFFSET   16

Encryption key offset in Key buffer.

Definition at line 32 of file provisioning_int.h.

◆ JOINING_BEACON_TYPE

#define JOINING_BEACON_TYPE   0x647650fb

A value for the joining type field., Allows to identify provisioning proxy nodes.

Definition at line 69 of file provisioning_int.h.

◆ JOINING_NETWORK_ADDRESS

#define JOINING_NETWORK_ADDRESS   0x9E4ADC

Network address for sending and receiving joining beacons

Definition at line 46 of file provisioning_int.h.

◆ JOINING_NETWORK_CHANNEL

#define JOINING_NETWORK_CHANNEL   4

Network channel for sending and receiving joining beacons

Definition at line 54 of file provisioning_int.h.

◆ JOINING_RX_TIMEOUT

#define JOINING_RX_TIMEOUT   600

Time to scan for joining beacons, in milliseconds. JOINING_RX_TIMEOUT and JOINING_TX_INTERVAL needs to be modified accordingly.

Definition at line 61 of file provisioning_int.h.

◆ JOINING_TX_INTERVAL

#define JOINING_TX_INTERVAL   500

Interval to send joining beacons, in milliseconds

Definition at line 64 of file provisioning_int.h.

◆ PROV_CTR_SIZE

#define PROV_CTR_SIZE   2

Size of the counter used in AES CTR mode encryption.

Definition at line 26 of file provisioning_int.h.

◆ PROV_DATA_MAX_USER_ID

#define PROV_DATA_MAX_USER_ID   255

Maximum User Specific Id in Cbor provisioning buffer (range [128:255]).

Definition at line 43 of file provisioning_int.h.

◆ PROV_DATA_MIN_USER_ID

#define PROV_DATA_MIN_USER_ID   128

Minimum User Specific Id in Cbor provisioning buffer (range [128:255]).

Definition at line 40 of file provisioning_int.h.

◆ PROV_DATA_OFFSET

#define PROV_DATA_OFFSET   (sizeof(pdu_prov_hdr_t) + 1 + PROV_CTR_SIZE)

Offset of the data in the provisioning DATA packet. pdu_prov_hdr(6) + key_index(1) + counter(2)

Definition at line 37 of file provisioning_int.h.

◆ PROV_DOWNLINK_EP

#define PROV_DOWNLINK_EP   255

Provisioning downlink endpoint.

Definition at line 18 of file provisioning_int.h.

◆ PROV_MIC_SIZE

#define PROV_MIC_SIZE   5

Size of MIC in DATA packet if secured method is used.

Definition at line 29 of file provisioning_int.h.

◆ PROV_PDU_SIZE

#define PROV_PDU_SIZE   102

Maximum size of a packet payload. Needed for buffer size definitions.

Definition at line 23 of file provisioning_int.h.

◆ PROV_UPLINK_EP

#define PROV_UPLINK_EP   246

Provisioning uplink endpoint.

Definition at line 20 of file provisioning_int.h.

prov_nack_type_e
prov_nack_type_e
Definition: provisioning_int.h:90
PROV_PACKET_TYPE_NACK
@ PROV_PACKET_TYPE_NACK
Definition: provisioning_int.h:87
PROV_DATA_ID_NODE_ROLE
@ PROV_DATA_ID_NODE_ROLE
Definition: provisioning_int.h:79
PROV_NACK_TYPE_INVALID_DATA
@ PROV_NACK_TYPE_INVALID_DATA
Definition: provisioning_int.h:94
PROV_DATA_ID_AUTH_KEY
@ PROV_DATA_ID_AUTH_KEY
Definition: provisioning_int.h:75
provisioning_data_ids_e
provisioning_data_ids_e
List of Wirepas Ids for CBOR encoded provisioning data.
Definition: provisioning_int.h:72
PROV_NACK_TYPE_METHOD_NOT_SUPPORTED
@ PROV_NACK_TYPE_METHOD_NOT_SUPPORTED
Definition: provisioning_int.h:93
prov_packet_type_e
prov_packet_type_e
Definition: provisioning_int.h:82
PROV_DATA_ID_NET_CHAN
@ PROV_DATA_ID_NET_CHAN
Definition: provisioning_int.h:77
PROV_NACK_TYPE_INVALID_KEY_IDX
@ PROV_NACK_TYPE_INVALID_KEY_IDX
Definition: provisioning_int.h:95
PROV_PACKET_TYPE_DATA
@ PROV_PACKET_TYPE_DATA
Definition: provisioning_int.h:85
PROV_NACK_TYPE_NOT_AUTHORIZED
@ PROV_NACK_TYPE_NOT_AUTHORIZED
Definition: provisioning_int.h:92
PROV_PACKET_TYPE_START
@ PROV_PACKET_TYPE_START
Definition: provisioning_int.h:84
PROV_DATA_ID_NET_ADDR
@ PROV_DATA_ID_NET_ADDR
Definition: provisioning_int.h:76
PROV_DATA_ID_ENC_KEY
@ PROV_DATA_ID_ENC_KEY
Definition: provisioning_int.h:74
PROV_DATA_ID_NODE_ADDR
@ PROV_DATA_ID_NODE_ADDR
Definition: provisioning_int.h:78
PROV_PACKET_TYPE_DATA_ACK
@ PROV_PACKET_TYPE_DATA_ACK
Definition: provisioning_int.h:86