35#define DPP_TIMEOUT_MS (200 * 1000)
38#define DPP_URI_MAX_LEN 256
57 return "Session Overlap";
59 return "Unknown Result";
103 return "Response Error";
107 return "Result Timeout";
120 struct mmosal_semb *semb)
154 struct mmosal_semb *semb = (
struct mmosal_semb *)arg;
156 switch (dpp_event->
event)
197 "DPP: auth failed (%s)\n",
217 "DPP: config failed (%s)\n",
233 printf(
"\n\nSTA DPP Connect Example (Built " __DATE__
" " __TIME__
")\n\n");
247 if (strcasecmp(
mode,
"qr") == 0)
259 sizeof(bootstrap_key_buf),
268 mmosal_printf(
"DPP QR: no bootstrap key configured, generating ephemeral key\n");
#define DPP_TIMEOUT_MS
Timeout in milliseconds to wait for DPP provisioning to complete.
static const char * mmwlan_dpp_conf_failure_reason_to_string(enum mmwlan_dpp_conf_failure_reason reason)
Convert a DPP configuration failure reason to its string representation.
static const char * mmwlan_dpp_pb_result_to_string(enum mmwlan_dpp_pb_result result)
Convert a DPP push button result code to its string representation.
#define DPP_URI_MAX_LEN
Maximum length of the DPP URI string.
static void dpp_event_handler(const struct mmwlan_dpp_cb_args *dpp_event, void *arg)
DPP event handler.
static const char * mmwlan_dpp_auth_failure_reason_to_string(enum mmwlan_dpp_auth_failure_reason reason)
Convert a DPP authentication failure reason to its string representation.
void app_init(void)
Main entry point to the application.
static void dpp_store_credentials(const struct mmwlan_dpp_cb_args *dpp_event, struct mmosal_semb *semb)
Store received DPP credentials to mmconfig and signal completion.
int mmconfig_read_string(const char *key, char *buffer, int bufsize)
Returns the persistent store string value identified by the key.
int mmconfig_read_bytes(const char *key, void *buffer, uint32_t buffsize, uint32_t offset)
Returns the persistent store data identified by the key.
int mmconfig_write_string(const char *key, const char *value)
Writes the null terminated string to persistent store location identified by key.
#define MMOSAL_ASSERT(expr)
Assert that the given expression evaluates to true and abort execution if not.
#define MMOSAL_DEV_ASSERT(x)
Assertions that are only enabled for debug builds.
int mmosal_printf(const char *format,...)
OS abstracted version of printf used by morselib.
bool mmosal_semb_wait(struct mmosal_semb *semb, uint32_t timeout_ms)
Wait for a counting semaphore.
struct mmosal_semb * mmosal_semb_create(const char *name)
Create a new binary semaphore.
bool mmosal_semb_give(struct mmosal_semb *semb)
Give a binary semaphore.
mmwlan_dpp_auth_failure_reason
Reason codes for MMWLAN_DPP_EVT_AUTH_FAILURE.
enum mmwlan_status mmwlan_dpp_get_uri(char *uri_buf, size_t buf_len)
Retrieve the DPP bootstrap URI for the current QR enrollee session.
#define MMWLAN_DPP_BOOTSTRAP_KEY_MAX_LEN
Maximum length (in bytes) of a DER-encoded bootstrap private key.
mmwlan_dpp_conf_failure_reason
Reason codes for MMWLAN_DPP_EVT_CONF_FAILED.
#define MMWLAN_DPP_ARGS_INIT
Initializer for mmwlan_dpp_args.
enum mmwlan_status mmwlan_dpp_stop(void)
Function to stop the DPP process.
mmwlan_dpp_pb_result
Enumeration of results for MMWLAN_DPP_EVT_PB_RESULT.
enum mmwlan_status mmwlan_dpp_start(const struct mmwlan_dpp_args *args)
Function to start the Device Provisioning Protocol (DPP) process.
@ MMWLAN_DPP_AUTH_FAILURE_INIT_FAILED
Exhausted all retry attempts without a response.
@ MMWLAN_DPP_AUTH_FAILURE_NO_CONFIRM
Authentication confirmation was not received in time.
@ MMWLAN_DPP_AUTH_FAILURE_NO_RESPONSE
Responder never replied to the Authentication Request.
@ MMWLAN_DPP_MODE_QR_ENROLLEE
DPP QR Code Enrollee mode.
@ MMWLAN_DPP_CONF_FAILURE_RESPONSE_ERROR
Config response contained an error status.
@ MMWLAN_DPP_CONF_FAILURE_RESULT_TIMEOUT
Timed out waiting for the DPP2 Configuration Result.
@ MMWLAN_DPP_CONF_FAILURE_TIMEOUT
Timed out waiting for the config response.
@ MMWLAN_DPP_PB_RESULT_SUCCESS
DPP push button process was successful.
@ MMWLAN_DPP_PB_RESULT_SESSION_OVERLAP
A session overlap occurred during the DPP push button process.
@ MMWLAN_DPP_PB_RESULT_ERROR
An error occurred during the DPP push button process.
@ MMWLAN_DPP_EVT_CONF_FAILED
Configuration exchange failed after authentication succeeded.
@ MMWLAN_DPP_EVT_AUTH_FAILURE
DPP authentication could not complete.
@ MMWLAN_DPP_EVT_AUTH_REQ_RX
Enrollee received and validated a DPP Authentication Request.
@ MMWLAN_DPP_EVT_CHIRP_STARTED
QR enrollee began broadcasting presence announcements.
@ MMWLAN_DPP_EVT_CONF_REQ_TX
Enrollee sent a DPP Configuration Request.
@ MMWLAN_DPP_EVT_AUTH_SUCCESS
DPP authentication phase succeeded (both PB and QR flows).
@ MMWLAN_DPP_EVT_CONF_RESULT_TX
Enrollee sent a DPP Configuration Result (DPP2+).
@ MMWLAN_DPP_EVT_PB_DISCOVERY
Push Button configurator discovered.
@ MMWLAN_DPP_EVT_AUTH_RESP_TX
Enrollee sent a DPP Authentication Response.
@ MMWLAN_DPP_EVT_CONF_RECEIVED
DPP configuration received (any DPP mode).
@ MMWLAN_DPP_EVT_CHIRP_STOPPED
QR enrollee presence announcement process has stopped.
@ MMWLAN_DPP_EVT_PB_STARTED
Push Button enrollment started (enrollee).
@ MMWLAN_DPP_EVT_PB_RESULT
DPP push button result.
mmwlan_status
Enumeration of status return codes.
#define MMWLAN_SSID_MAXLEN
Maximum allowable length of an SSID.
@ MMWLAN_SUCCESS
The operation was successful.
Morse Micro application helper routines for initializing/de-initializing the Wireless LAN interface a...
void app_wlan_init(void)
Initializes the WLAN interface (and dependencies) using settings specified in the config store.
void app_wlan_start(void)
Starts the WLAN interface and connects to Wi-Fi using settings specified in the config store.
Structure to hold the arguments used for the DPP process.
void(* dpp_event_cb)(const struct mmwlan_dpp_cb_args *dpp_event, void *arg)
DPP event callback prototype.
void * dpp_event_cb_arg
Optional user argument that will be passed back to the DPP event callback.
enum mmwlan_dpp_mode mode
DPP mode to use.
struct mmwlan_dpp_qr_args qr
QR enrollee specific arguments.
Structure passed back when a DPP event occurs.
union mmwlan_dpp_cb_args::@2 args
Union of arguments for DPP events.
const uint8_t * ssid
SSID of the AP to connect to.
struct mmwlan_dpp_cb_args::@2::@4 conf_received
Argument for MMWLAN_DPP_EVT_CONF_RECEIVED event.
struct mmwlan_dpp_cb_args::@2::@8 auth_failure
Argument for MMWLAN_DPP_EVT_AUTH_FAILURE event.
struct mmwlan_dpp_cb_args::@2::@9 conf_failed
Argument for MMWLAN_DPP_EVT_CONF_FAILED event.
uint16_t ssid_len
Length of the SSID.
enum mmwlan_dpp_auth_failure_reason reason
Reason for the authentication failure.
const char * passphrase
Passphrase, NULL terminated.
enum mmwlan_dpp_pb_result result
Result of DPP push button.
struct mmwlan_dpp_cb_args::@2::@3 pb_result
Argument for MMWLAN_DPP_EVT_PB_RESULT event.
enum mmwlan_dpp_event event
The DPP event that has occurred.
uint16_t bootstrap_private_key_len
Length of bootstrap_private_key in bytes.
const uint8_t * bootstrap_private_key
DER-encoded EC private key for the DPP bootstrap identity (P-256 / prime256v1).
uint16_t chirp_iterations
Number of chirp iterations (0 = default of 1).