Morse Micro IoT SDK  2.9.7
WLAN Utilities

Detailed Description

Utility macros and functions relating to WLAN.

Data Structures

struct  mm_rsn_information
 Data structure to represent information extracted from an RSN information element. More...
 
struct  mm_s1g_operation
 Data structure to represent information extracted from an S1G Operation information element. More...
 

Macros

#define MM_RSN_INFORMATION_MAX_PAIRWISE_CIPHER_SUITES   (2)
 Maximum number of pairwise cipher suites our parser will process. More...
 
#define MM_RSN_INFORMATION_MAX_AKM_SUITES   (2)
 Maximum number of AKM suites our parser will process. More...
 
#define MM_RSN_INFORMATION_IE_TYPE   (48)
 Tag number of the RSN information element, in which we can find security details of the AP. More...
 
#define MM_VENDOR_SPECIFIC_IE_TYPE   (221)
 Tag number of the Vendor Specific information element. More...
 
#define MM_S1G_OPERATION_IE_TYPE   (232)
 Tag number of the S1G Operation information element. More...
 

Enumerations

enum  mm_akm_suite_oui {
  MM_AKM_SUITE_NONE = 0 , MM_AKM_SUITE_PSK = 0x506f9a02 , MM_AKM_SUITE_SAE = 0x000fac08 , MM_AKM_SUITE_OWE = 0x000fac12 ,
  MM_AKM_SUITE_OTHER = 1
}
 Enumeration of Authentication Key Management (AKM) Suite OUIs as BE32 integers. More...
 
enum  mm_cipher_suite_oui { MM_CIPHER_SUITE_AES_CCM = 0x000fac04 , MM_CIPHER_SUITE_OTHER = 1 }
 Enumeration of Cipher Suite OUIs as BE32 integers. More...
 
enum  mm_errno {
  MM_ENOMEM = 12 , MM_EFAULT = 14 , MM_ENODEV = 19 , MM_EINVAL = 22 ,
  MM_ETIMEDOUT = 110
}
 Explicitly defined errno values to obviate the need to include errno.h. More...
 

Functions

const char * mm_akm_suite_to_string (uint32_t akm_suite_oui)
 Get the name of the given AKM Suite as a string. More...
 
int mm_find_ie_from_offset (const uint8_t *ies, uint32_t ies_len, uint32_t search_offset, uint8_t ie_type)
 Search a list of Information Elements (IEs) from the given starting offset and find the first instance of matching the given type. More...
 
static int mm_find_ie (const uint8_t *ies, uint32_t ies_len, uint8_t ie_type)
 Search a list of Information Elements (IEs) and find the first instance of matching the given type. More...
 
int mm_find_vendor_specific_ie_from_offset (const uint8_t *ies, uint32_t ies_len, uint32_t search_offset, const uint8_t *id, size_t id_len)
 Search through the given list of Information Elements (IEs) from the given starting offset to find the first Vendor Specific IE that matches the given id. More...
 
static int mm_find_vendor_specific_ie (const uint8_t *ies, uint32_t ies_len, const uint8_t *id, size_t id_len)
 Search through the given list of Information Elements (IEs) to find the first Vendor Specific IE that matches the given id. More...
 
int mm_parse_rsn_information (const uint8_t *ies, uint32_t ies_len, struct mm_rsn_information *output)
 Search through the given list of information elements to find the RSN IE then parse it to extract relevant information into an instance of mm_rsn_information. More...
 
int mm_parse_s1g_operation (const uint8_t *ies, uint32_t ies_len, struct mm_s1g_operation *output)
 Find the S1G Operation information element from within a block of IEs and extract useful information from it. More...
 
static bool mm_mac_addr_is_zero (const uint8_t *mac_addr)
 Determines if a given MAC address is all zeros. More...
 

Macro Definition Documentation

◆ MM_RSN_INFORMATION_IE_TYPE

#define MM_RSN_INFORMATION_IE_TYPE   (48)

Tag number of the RSN information element, in which we can find security details of the AP.

Definition at line 190 of file mmutils.h.

◆ MM_RSN_INFORMATION_MAX_AKM_SUITES

#define MM_RSN_INFORMATION_MAX_AKM_SUITES   (2)

Maximum number of AKM suites our parser will process.

Definition at line 186 of file mmutils.h.

◆ MM_RSN_INFORMATION_MAX_PAIRWISE_CIPHER_SUITES

#define MM_RSN_INFORMATION_MAX_PAIRWISE_CIPHER_SUITES   (2)

Maximum number of pairwise cipher suites our parser will process.

Definition at line 181 of file mmutils.h.

◆ MM_S1G_OPERATION_IE_TYPE

#define MM_S1G_OPERATION_IE_TYPE   (232)

Tag number of the S1G Operation information element.

Definition at line 194 of file mmutils.h.

◆ MM_VENDOR_SPECIFIC_IE_TYPE

#define MM_VENDOR_SPECIFIC_IE_TYPE   (221)

Tag number of the Vendor Specific information element.

Definition at line 192 of file mmutils.h.

Enumeration Type Documentation

◆ mm_akm_suite_oui

Enumeration of Authentication Key Management (AKM) Suite OUIs as BE32 integers.

Enumerator
MM_AKM_SUITE_NONE 

Open (no security)

MM_AKM_SUITE_PSK 

Pre-shared key (WFA OUI)

MM_AKM_SUITE_SAE 

Simultaneous Authentication of Equals (SAE)

MM_AKM_SUITE_OWE 

OWE.

MM_AKM_SUITE_OTHER 

Another suite not in this enum.

Definition at line 156 of file mmutils.h.

◆ mm_cipher_suite_oui

Enumeration of Cipher Suite OUIs as BE32 integers.

Enumerator
MM_CIPHER_SUITE_AES_CCM 

Open (no security)

MM_CIPHER_SUITE_OTHER 

Another cipher suite not in this enum.

Definition at line 171 of file mmutils.h.

◆ mm_errno

enum mm_errno

Explicitly defined errno values to obviate the need to include errno.h.

MM prefix to avoid namespace collision in case errno.h gets included.

Definition at line 198 of file mmutils.h.

Function Documentation

◆ mm_akm_suite_to_string()

const char * mm_akm_suite_to_string ( uint32_t  akm_suite_oui)

Get the name of the given AKM Suite as a string.

Parameters
akm_suite_ouiThe OUI of the AKM suite as a big endian integer.
Returns
the string representation.

◆ mm_find_ie()

static int mm_find_ie ( const uint8_t *  ies,
uint32_t  ies_len,
uint8_t  ie_type 
)
inlinestatic

Search a list of Information Elements (IEs) and find the first instance of matching the given type.

Parameters
iesBuffer containing the information elements.
ies_lenLength of ies
ie_typeThe type of the IE to look for.
Returns
If the information element is found, the offset of the start of the IE within ies; if no match is found then -1; if the IE is found but is malformed then -2.

Definition at line 270 of file mmutils.h.

◆ mm_find_ie_from_offset()

int mm_find_ie_from_offset ( const uint8_t *  ies,
uint32_t  ies_len,
uint32_t  search_offset,
uint8_t  ie_type 
)

Search a list of Information Elements (IEs) from the given starting offset and find the first instance of matching the given type.

Warning
A search_offset that is not aligned to the start of an IE header will result in undefined behaviour.
Parameters
iesBuffer containing the information elements.
ies_lenLength of ies.
search_offsetOffset to start searching from. This must point to a IE header.
ie_typeThe type of the IE to look for.
Returns
If the information element is found, the offset of the start of the IE within ies; if no match is found then -1; if the IE is found but is malformed then -2.

◆ mm_find_vendor_specific_ie()

static int mm_find_vendor_specific_ie ( const uint8_t *  ies,
uint32_t  ies_len,
const uint8_t *  id,
size_t  id_len 
)
inlinestatic

Search through the given list of Information Elements (IEs) to find the first Vendor Specific IE that matches the given id.

Parameters
[in]iesBuffer containing the information elements.
[in]ies_lenLength of ies.
[in]idBuffer containing the IE ID, usually OUI+TYPE.
[in]id_lenLength of the ID.
Returns
If the information element is found, the offset of the start of the IE within ies; if no match is found then -1; if the IE is found but is malformed then -2.

Definition at line 309 of file mmutils.h.

◆ mm_find_vendor_specific_ie_from_offset()

int mm_find_vendor_specific_ie_from_offset ( const uint8_t *  ies,
uint32_t  ies_len,
uint32_t  search_offset,
const uint8_t *  id,
size_t  id_len 
)

Search through the given list of Information Elements (IEs) from the given starting offset to find the first Vendor Specific IE that matches the given id.

Warning
A search_offset that is not aligned to the start of an IE header will result in undefined behaviour.
Parameters
[in]iesBuffer containing the information elements.
[in]ies_lenLength of ies.
[in]search_offsetOffset to start searching from. This must point to a IE header.
[in]idBuffer containing the IE ID, usually OUI+TYPE.
[in]id_lenLength of the ID.
Returns
If the information element is found, the offset of the start of the IE within ies; if no match is found then -1; if the IE is found but is malformed then -2.

◆ mm_mac_addr_is_zero()

static bool mm_mac_addr_is_zero ( const uint8_t *  mac_addr)
inlinestatic

Determines if a given MAC address is all zeros.

Parameters
mac_addrArray of length MMWLAN_MAC_ADDR_LEN containing a MAC address.
Returns
true if all bytes in the given MAC address are zero, else false

Definition at line 365 of file mmutils.h.

◆ mm_parse_rsn_information()

int mm_parse_rsn_information ( const uint8_t *  ies,
uint32_t  ies_len,
struct mm_rsn_information output 
)

Search through the given list of information elements to find the RSN IE then parse it to extract relevant information into an instance of mm_rsn_information.

Parameters
[in]iesBuffer containing the information elements.
[in]ies_lenLength of ies.
[out]outputPointer to an instance of mm_rsn_information to receive output.
Returns
-2 on parse error, -1 if the RSN IE was not found, 0 if the RSN IE was found.

◆ mm_parse_s1g_operation()

int mm_parse_s1g_operation ( const uint8_t *  ies,
uint32_t  ies_len,
struct mm_s1g_operation output 
)

Find the S1G Operation information element from within a block of IEs and extract useful information from it.

Parameters
[in]iesBuffer containing the information elements.
[in]ies_lenLength of ies.
[out]outputPointer to an instance of mm_rsn_information to receive output.
Returns
-2 on parse error, -1 if the S1G Opration IE was not found, 0 on success.