34#define AP_SSID MorseMicroIoT
40#define SAE_PASSPHRASE 12345678
46#define SECURITY_TYPE MMWLAN_SAE
52#define PMF_MODE MMWLAN_PMF_REQUIRED
60#define MAX_STAS MMWLAN_DEFAULT_AP_MAX_STAS
64#define _STRINGIFY(x) #x
66#define STRINGIFY(x) _STRINGIFY(x)
83 return "Unknown (disconnected)";
86 return "Authenticated";
95 return "Unrecognized";
110 printf(
"AP STA " MM_MAC_ADDR_FMT " State: %s, AID: %u, Time: %lu ms\n",
148 if (strncmp(
"sae", strval,
sizeof(strval)) == 0)
152 else if (strncmp(
"owe", strval,
sizeof(strval)) == 0)
156 else if (strncmp(
"open", strval,
sizeof(strval)) == 0)
162 printf(
"Invalid value of %s read from config store: %s\n",
"wlan.ap_security", strval);
170 if (strncmp(
"disabled", strval,
sizeof(strval)) == 0)
172 printf(
"PMF disabled\n");
175 else if (strncmp(
"required", strval,
sizeof(strval)) == 0)
181 printf(
"Invalid value of %s read from config store: %s\n",
"wlan.ap_pmf_mode", strval);
191 int ret = sscanf(strval,
201 for (i = 0; i < 6; i++)
203 if (temp[i] > UINT8_MAX || temp[i] < 0)
206 memset(ap_args->
bssid, 0,
sizeof(ap_args->
bssid));
210 ap_args->
bssid[i] = (uint8_t)temp[i];
222 MMLOG_PRINTF(
"\n\nRelay Mode Example (Built " __DATE__
" " __TIME__
")\n\n");
233 MMLOG_ERR(
"Failed to retrieve STA channel info\n", status);
242 MMLOG_ERR(
"Failed to start relay (status %d)\n", status);
273 MMLOG_PRINTF(
"Failed to start AP (status %d)\n", status);
int mmconfig_read_string(const char *key, char *buffer, int bufsize)
Returns the persistent store string value identified by the key.
#define MMLOG_PRINTF(...)
Logging printf definition.
#define MMLOG_ERR(fmt,...)
Display an ERROR level log message.
#define MM_MAC_ADDR_FMT
Macro for format specifier to print MM_MAC_ADDR_VAL.
#define MM_MAC_ADDR_VAL(value)
Macro for printing a MAC address.
#define MMOSAL_ASSERT(expr)
Assert that the given expression evaluates to true and abort execution if not.
static bool mmosal_safer_strcpy(char *dst, const char *src, size_t size)
A safer version of strncpy.
uint32_t mmosal_get_time_ms(void)
Get the system time in milliseconds.
mmwlan_ap_sta_state
Enumeration of STA states.
#define MMWLAN_AP_ARGS_INIT
Initializer for mmwlan_ap_args.
enum mmwlan_status mmwlan_ap_enable(const struct mmwlan_ap_args *args)
Enable AP mode.
@ MMWLAN_AP_STA_AUTHORIZED
The STA is fully connected and authorized for data transmission.
@ MMWLAN_AP_STA_ASSOCIATED
The STA is associated but not yet authorized for data transmission.
@ MMWLAN_AP_STA_UNKNOWN
The STA is not known.
@ MMWLAN_AP_STA_AUTHENTICATED
The STA is authenticated but not associated.
enum mmwlan_status mmwlan_get_vif_channel_info(enum mmwlan_vif vif, struct mmwlan_vif_channel_info *info)
Gets the channel information for the specified VIF.
#define MMWLAN_RELAY_ARGS_INIT
Initializer for mmwlan_relay_args.
enum mmwlan_status mmwlan_relay_enable(const struct mmwlan_relay_args *args)
Enable S1G Relay mode.
enum mmwlan_status mmwlan_set_power_save_mode(enum mmwlan_ps_mode mode)
Sets whether or not the 802.11 power save is enabled.
@ MMWLAN_PS_DISABLED
Power save disabled.
mmwlan_status
Enumeration of status return codes.
@ MMWLAN_SUCCESS
The operation was successful.
@ MMWLAN_PMF_DISABLED
No protected management frames.
@ MMWLAN_PMF_REQUIRED
Protected management frames must be used.
@ MMWLAN_OPEN
Open (no security)
@ MMWLAN_SAE
Simultaneous Authentication of Equals (SAE)
@ MMWLAN_OWE
Opportunistic Wireless Encryption (OWE)
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.
#define SECURITY_TYPE
Security type (.
#define MAX_STAS
The maximum number of stations that can connect to the AP.
void load_mmwlan_ap_args(struct mmwlan_ap_args *ap_args)
Loads the provided structure with initialization parameters read from config store.
#define AP_SSID
SSID of the AP.
#define PMF_MODE
Protected Management Frames (PMF) mode (.
#define STRINGIFY(x)
Convert the content of the given macro to a string.
#define SAE_PASSPHRASE
Passphrase of the AP (ignored if security type is not SAE).
static char * mmwlan_ap_sta_state_to_str(enum mmwlan_ap_sta_state state)
Function to convert mmwlan_ap_sta_state enumeration to a human readable string.
static void handle_ap_sta_status(const struct mmwlan_ap_sta_status *sta_status, void *arg)
Handler for AP STA Status callback.
void app_init(void)
Main entry point to the application.
uint32_t opaque_argument_value
A throw away variable for checking that the opaque argument is correct.
Arguments data structure for mmwlan_ap_enable().
void * sta_status_cb_arg
Optional opaque argument to be passed to sta_status_cb.
uint16_t s1g_chan_num
S1G channel number of the channel to use.
uint8_t pri_1mhz_chan_idx
Index of the primary 1 Mhz channel within the operating channel.
enum mmwlan_pmf_mode pmf_mode
Protected Management Frame mode to use (802.11w)
uint16_t op_class
Operating Class to use (S1G or Global).
uint8_t pri_bw_mhz
Bandwidth to use for the primary channel.
uint8_t max_stas
Maximum number of stations that can connect to the AP simultaneously.
uint16_t ssid_len
Length of the SSID.
uint8_t bssid[MMWLAN_MAC_ADDR_LEN]
Optional BSSID of the AP.
uint8_t ssid[MMWLAN_SSID_MAXLEN]
SSID of the AP.
mmwlan_ap_sta_status_cb_t sta_status_cb
Optional callback to be invoked when the status of a connected STA changes.
char passphrase[MMWLAN_PASSPHRASE_MAXLEN+1]
Passphrase (only used if security_type is MMWLAN_SAE, otherwise ignored.
enum mmwlan_security_type security_type
Type of security to use.
uint16_t passphrase_len
Length of passphrase.
Data structure for communicating STA status information for stations connected to an AP.
uint16_t aid
The AID of the STA.
enum mmwlan_ap_sta_state state
The current state of the STA.
uint8_t mac_addr[MMWLAN_MAC_ADDR_LEN]
The MAC address of the STA.
Arguments data structure for mmwlan_relay_enable().
Channel information for a VIF.
uint8_t pri_bw_mhz
Bandwidth of the primary channel.
uint16_t op_class
Operating class for the BSS.
uint16_t s1g_chan_num
S1G operating channel number.
uint8_t pri_1mhz_chan_idx
Index of the primary 1 MHz channel within the operating channel.