42#define MM_MIN(_x, _y) (((_x) < (_y)) ? (_x) : (_y))
58#define MM_MAX(_x, _y) (((_x) > (_y)) ? (_x) : (_y))
65#ifndef MM_FAST_ROUND_UP
66#define MM_FAST_ROUND_UP(x, m) ((((x) - 1) | ((m) - 1)) + 1)
70#define MM_UNUSED(_x) (void)(_x)
74#define MM_PACKED __attribute__((packed))
79#define MM_WEAK __attribute__((weak))
84#define MM_FALLTHROUGH __attribute__((fallthrough))
87#ifndef MM_STATIC_ASSERT
99#define MM_STATIC_ASSERT(_expression, _message) _Static_assert((_expression), _message)
111#define MM_ARRAY_COUNT(_a) (sizeof(_a) / sizeof((_a)[0]))
121#define MM_MEMBER_SIZE(_type, _member) (sizeof(((_type *)0)->_member))
144 return 'A' + nibble - 0x0a;
181#ifndef MM_RSN_INFORMATION_MAX_PAIRWISE_CIPHER_SUITES
182#define MM_RSN_INFORMATION_MAX_PAIRWISE_CIPHER_SUITES (2)
186#ifndef MM_RSN_INFORMATION_MAX_AKM_SUITES
187#define MM_RSN_INFORMATION_MAX_AKM_SUITES (2)
191#define MM_RSN_INFORMATION_IE_TYPE (48)
193#define MM_VENDOR_SPECIFIC_IE_TYPE (221)
195#define MM_S1G_OPERATION_IE_TYPE (232)
258 uint32_t search_offset,
273static inline int mm_find_ie(
const uint8_t *ies, uint32_t ies_len, uint8_t ie_type)
297 uint32_t search_offset,
374 return (mac_addr[0] | mac_addr[1] | mac_addr[2] | mac_addr[3] | mac_addr[4] | mac_addr[5]) ==
387 return mac_addr[0] & 0x01;
399 return (mac_addr[0] & mac_addr[1] & mac_addr[2] & mac_addr[3] & mac_addr[4] & mac_addr[5]) ==
413 return memcmp(mac_addr1, mac_addr2, 6) == 0;
#define MM_RSN_INFORMATION_MAX_AKM_SUITES
Maximum number of AKM suites our parser will process.
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...
mm_akm_suite_oui
Enumeration of Authentication Key Management (AKM) Suite OUIs as BE32 integers.
static bool mm_mac_addr_is_zero(const uint8_t *mac_addr)
Determines if a given MAC address is all zeros.
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.
const char * mm_akm_suite_to_string(uint32_t akm_suite_oui)
Get the name of the given AKM Suite as a string.
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 ...
static bool mm_mac_addr_is_multicast(const uint8_t *mac_addr)
Determines if a given MAC address is a multicast/broadcast address.
static bool mm_mac_addr_is_equal(const uint8_t *mac_addr1, const uint8_t *mac_addr2)
Compares two MAC addresses and determines if they are equal.
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 th...
static bool mm_mac_addr_is_broadcast(const uint8_t *mac_addr)
Determines if a given MAC address is the broadcast address (i.e., ff:ff:ff:ff:ff:ff ).
mm_errno
Explicitly defined errno values to obviate the need to include errno.h.
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 rel...
#define MM_RSN_INFORMATION_MAX_PAIRWISE_CIPHER_SUITES
Maximum number of pairwise cipher suites our parser will process.
mm_cipher_suite_oui
Enumeration of Cipher Suite OUIs as BE32 integers.
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 instanc...
@ MM_AKM_SUITE_SAE
Simultaneous Authentication of Equals (SAE)
@ MM_AKM_SUITE_NONE
Open (no security)
@ MM_AKM_SUITE_OTHER
Another suite not in this enum.
@ MM_AKM_SUITE_PSK
Pre-shared key (WFA OUI)
@ MM_CIPHER_SUITE_OTHER
Another cipher suite not in this enum.
@ MM_CIPHER_SUITE_AES_CCM
Open (no security)
static char mm_nibble_to_hex_char(uint8_t nibble)
Convert the least significant 4 bits of the given argument to a character representing their hexadeci...
Data structure to represent information extracted from an S1G Operation information element.
uint8_t operating_channel_width_mhz
Width of the operating channel in MHz.
uint8_t operating_channel_number
Channel number of the operating channel.
uint8_t primary_channel_width_mhz
Width of the primary channel in MHz.
uint8_t primary_channel_number
Channel number of the primary channel.
uint8_t operating_class
Operating class.