IoTivity-Lite
|
Device provisioning. More...
#include "oc_config.h"
#include "oc_export.h"
#include "oc_client_state.h"
#include "oc_cloud.h"
#include "oc_ri.h"
#include "oc_session_events.h"
#include "util/oc_compiler.h"
#include "mbedtls/md.h"
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
Macros | |
#define | PLGD_DPS_URI "/plgd/dps" |
Configuration resource. More... | |
Typedefs | |
typedef struct plgd_dps_context_t | plgd_dps_context_t |
typedef void(* | plgd_dps_on_status_change_cb_t) (plgd_dps_context_t *ctx, plgd_dps_status_t status, void *data) |
A function pointer for handling the dps status. More... | |
typedef void(* | plgd_dps_print_log_fn_t) (oc_log_level_t level, const char *file, int line, const char *func_name, const char *format,...) |
Custom logging function. More... | |
typedef bool(* | plgd_dps_schedule_action_cb_t) (plgd_dps_context_t *ctx, plgd_dps_status_t action, uint8_t retry_count, uint64_t *delay, uint16_t *timeout, void *user_data) |
Callback invoked by the dps manager when the dps wants to schedule an action. More... | |
Enumerations | |
enum | { PLGD_DPS_MAX_RETRY_VALUES_SIZE = 8 } |
enum | plgd_dps_dhcp_set_values_t { PLGD_DPS_DHCP_SET_VALUES_ERROR = -1 , PLGD_DPS_DHCP_SET_VALUES_NOT_CHANGED = 0 , PLGD_DPS_DHCP_SET_VALUES_UPDATED = 1 , PLGD_DPS_DHCP_SET_VALUES_NEED_REPROVISION } |
DPS dhcp plgd_dps_dhcp_set_values_from_vendor_encapsulated_options return values. More... | |
enum | plgd_dps_error_t { PLGD_DPS_OK = 0 , PLGD_DPS_ERROR_RESPONSE = 1 , PLGD_DPS_ERROR_CONNECT = 2 , PLGD_DPS_ERROR_GET_CREDENTIALS = 3 , PLGD_DPS_ERROR_GET_ACLS = 4 , PLGD_DPS_ERROR_SET_CLOUD = 5 , PLGD_DPS_ERROR_START_CLOUD = 6 , PLGD_DPS_ERROR_GET_OWNER = 7 , PLGD_DPS_ERROR_GET_TIME = 8 } |
DPS errors. More... | |
enum | plgd_dps_status_t { PLGD_DPS_INITIALIZED = 1 << 0 , PLGD_DPS_GET_CREDENTIALS = 1 << 1 , PLGD_DPS_HAS_CREDENTIALS = 1 << 2 , PLGD_DPS_GET_ACLS = 1 << 3 , PLGD_DPS_HAS_ACLS = 1 << 4 , PLGD_DPS_GET_CLOUD = 1 << 6 , PLGD_DPS_HAS_CLOUD = 1 << 7 , PLGD_DPS_CLOUD_STARTED = 1 << 8 , PLGD_DPS_RENEW_CREDENTIALS = 1 << 9 , PLGD_DPS_GET_OWNER = 1 << 10 , PLGD_DPS_HAS_OWNER = 1 << 11 , PLGD_DPS_GET_TIME = 1 << 12 , PLGD_DPS_HAS_TIME = 1 << 13 , PLGD_DPS_TRANSIENT_FAILURE = 1 << 29 , PLGD_DPS_FAILURE = 1 << 30 } |
DPS provisioning status flags. More... | |
Functions | |
bool | plgd_cloud_manager_start (const plgd_dps_context_t *ctx) |
Start cloud manager with previously set server and callbacks. More... | |
oc_endpoint_address_t * | plgd_dps_add_endpoint_address (plgd_dps_context_t *ctx, const char *uri, size_t uri_len, const char *name, size_t name_len) |
Allocate and add an address to the list of DPS endpoint addresses. More... | |
uint8_t | plgd_dps_dhcp_get_vendor_encapsulated_option_code_dps_certificate_fingerprint (const plgd_dps_context_t *ctx) |
Get the vendor encapsulated option code for the DPS certificate fingerprint. More... | |
uint8_t | plgd_dps_dhcp_get_vendor_encapsulated_option_code_dps_endpoint (const plgd_dps_context_t *ctx) |
Get the vendor encapsulated option code for the DPS endpoint. More... | |
plgd_dps_dhcp_set_values_t | plgd_dps_dhcp_set_values_from_vendor_encapsulated_options (plgd_dps_context_t *ctx, const uint8_t *vendor_encapsulated_options, size_t vendor_encapsulated_options_size) |
Set DPS endpoint and certificate fingerprint that will be used in establishment of secure connection. More... | |
void | plgd_dps_dhcp_set_vendor_encapsulated_option_code_dps_certificate_fingerprint (plgd_dps_context_t *ctx, uint8_t code) |
Set the vendor encapsulated option code for the DPS certificate fingerprint. More... | |
void | plgd_dps_dhcp_set_vendor_encapsulated_option_code_dps_endpoint (plgd_dps_context_t *ctx, uint8_t code) |
Set the vendor encapsulated option code for the DPS endpoint. More... | |
bool | plgd_dps_endpoint_is_empty (const plgd_dps_context_t *ctx) |
Check if no DPS service endpoint is set. More... | |
void | plgd_dps_force_reprovision (plgd_dps_context_t *ctx) |
Force all steps of the provisioning process to be executed. More... | |
int | plgd_dps_get_certificate_fingerprint (const plgd_dps_context_t *ctx, mbedtls_md_type_t *md_type, uint8_t *buffer, size_t buffer_size) |
Copy certificate fingerprint of the DPS service to output buffer. More... | |
plgd_cloud_status_observer_configuration_t | plgd_dps_get_cloud_observer_configuration (const plgd_dps_context_t *ctx) |
Get cloud observer configuration. More... | |
plgd_dps_context_t * | plgd_dps_get_context (size_t device) |
Get context for given device. More... | |
size_t | plgd_dps_get_device (const plgd_dps_context_t *ctx) |
Get device from context. More... | |
int | plgd_dps_get_endpoint (const plgd_dps_context_t *ctx, char *buffer, size_t buffer_size) |
Copy the selected endpoint address of the DPS service to output buffer. More... | |
plgd_dps_error_t | plgd_dps_get_last_error (const plgd_dps_context_t *ctx) |
Get last provisioning error. More... | |
plgd_dps_print_log_fn_t | plgd_dps_get_log_fn (void) 1 |
Get global logging function. More... | |
uint32_t | plgd_dps_get_provision_status (const plgd_dps_context_t *ctx) |
Get provision status. More... | |
bool | plgd_dps_get_skip_verify (const plgd_dps_context_t *ctx) |
Get skip verify value from context. More... | |
bool | plgd_dps_has_been_provisioned_since_reset (const plgd_dps_context_t *ctx) |
Check whether the device has been provisioned at least once since the last DPS reset initiated by a factory reset or by setting the endpoint to an empty value in the DPS resource. More... | |
bool | plgd_dps_has_forced_reprovision (const plgd_dps_context_t *ctx) |
Check if force reprovision flag is set. More... | |
ssize_t | plgd_dps_hex_string_to_bytes (const char *hex_string, size_t hex_string_size, uint8_t *buffer, size_t buffer_size) |
Convert isc-dhcp leases file vendor encapsulated options to byte array. More... | |
int | plgd_dps_init (void) |
Allocate and initialize data. More... | |
void | plgd_dps_iterate_server_addresses (const plgd_dps_context_t *ctx, oc_endpoint_addresses_iterate_fn_t iterate_fn, void *iterate_fn_data) |
Iterate over DPS endpoint addresses. More... | |
oc_log_level_t | plgd_dps_log_get_level (void) |
Get log level of the global logger. More... | |
void | plgd_dps_log_set_level (oc_log_level_t level) |
Set log level of the global logger, logs with lower importance will be ignored. More... | |
bool | plgd_dps_manager_is_started (const plgd_dps_context_t *ctx) |
Check whether DPS manager has been started. More... | |
int | plgd_dps_manager_restart (plgd_dps_context_t *ctx) |
Restart DPS manager to provision device by given server. More... | |
int | plgd_dps_manager_start (plgd_dps_context_t *ctx) |
Start DPS manager to provision device. More... | |
void | plgd_dps_manager_stop (plgd_dps_context_t *ctx) |
Stop DPS manager. More... | |
int | plgd_dps_on_factory_reset (plgd_dps_context_t *ctx) |
Clean-up of DPS provisioning on factory reset. More... | |
uint16_t | plgd_dps_pki_get_expiring_limit (const plgd_dps_context_t *ctx) |
Get expiring-in limit of DPS certificates. More... | |
void | plgd_dps_pki_set_expiring_limit (plgd_dps_context_t *ctx, uint16_t expiring_limit) |
Set expiring-in limit of DPS certificates. More... | |
bool | plgd_dps_remove_endpoint_address (plgd_dps_context_t *ctx, const oc_endpoint_address_t *address) |
Remove an address from the list of DPS endpoint addresses. More... | |
bool | plgd_dps_select_endpoint_address (plgd_dps_context_t *ctx, const oc_endpoint_address_t *address) |
Select an address from the list of DPS endpoint addresses. More... | |
const oc_endpoint_address_t * | plgd_dps_selected_endpoint_address (const plgd_dps_context_t *ctx) |
Get the selected DPS endpoint address. More... | |
bool | plgd_dps_set_certificate_fingerprint (plgd_dps_context_t *ctx, mbedtls_md_type_t md_type, const uint8_t *fingerprint, size_t size) |
Set certificate fingerprint of the provisioning server. More... | |
bool | plgd_dps_set_cloud_observer_configuration (plgd_dps_context_t *ctx, uint8_t max_retry_count, uint8_t retry_interval_s) |
Configure cloud observer. More... | |
void | plgd_dps_set_configuration_resource (plgd_dps_context_t *ctx, bool create) |
Controls whether a dps client creates configuration resource for managing dps client via COAPs API. More... | |
void | plgd_dps_set_endpoint (plgd_dps_context_t *ctx, const char *endpoint) |
Set endpoint address of the DPS service. More... | |
void | plgd_dps_set_log_fn (plgd_dps_print_log_fn_t log_fn) |
Set global logging function. More... | |
void | plgd_dps_set_manager_callbacks (plgd_dps_context_t *ctx, plgd_dps_manager_callbacks_t callbacks) |
Set DPS manager callbacks. More... | |
bool | plgd_dps_set_retry_configuration (plgd_dps_context_t *ctx, const uint8_t cfg[], size_t cfg_size) |
Configure retry counter. More... | |
void | plgd_dps_set_schedule_action (plgd_dps_context_t *ctx, plgd_dps_schedule_action_cb_t on_schedule_action, void *user_data) |
Set a custom scheduler for actions in the cloud manager. More... | |
void | plgd_dps_set_skip_verify (plgd_dps_context_t *ctx, bool skip_verify) |
Controls whether a dps client verifies the device provision service's certificate chain against trust anchor in the device. More... | |
void | plgd_dps_shutdown (void) |
Stop all devices and deallocate data. More... | |
int | plgs_dps_get_retry_configuration (const plgd_dps_context_t *ctx, uint8_t *buffer, size_t buffer_size) |
Get retry counter configuration. More... | |
Device provisioning.