3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 13:02:44 +01:00

util: Add util_ssid_is_hidden

This commit is contained in:
Tim Kourt 2018-06-27 16:33:03 -07:00 committed by Denis Kenzior
parent a681e845a6
commit 3781c157db
2 changed files with 17 additions and 0 deletions

View File

@ -88,6 +88,22 @@ bool util_ssid_is_utf8(size_t len, const uint8_t *ssid)
return l_utf8_validate((const char *)ssid, len, NULL); return l_utf8_validate((const char *)ssid, len, NULL);
} }
/*
* Checks whether this is a hidden SSID. Two conditions are checked:
* 1. If the SSID is length 0
* 2. If the SSID length > 0 and all bytes are 0
*
* The length is not sanitized so the caller must have sanitized the arguments
* beforehand.
*/
bool util_ssid_is_hidden(size_t len, const uint8_t *ssid)
{
if (!len)
return true;
return util_mem_is_zero(ssid, len);
}
const char *util_address_to_string(const uint8_t *addr) const char *util_address_to_string(const uint8_t *addr)
{ {
static char str[18]; static char str[18];

View File

@ -37,6 +37,7 @@
const char *util_ssid_to_utf8(size_t len, const uint8_t *ssid); const char *util_ssid_to_utf8(size_t len, const uint8_t *ssid);
bool util_ssid_is_utf8(size_t len, const uint8_t *ssid); bool util_ssid_is_utf8(size_t len, const uint8_t *ssid);
bool util_ssid_is_hidden(size_t len, const uint8_t *ssid);
const char *util_address_to_string(const uint8_t *addr); const char *util_address_to_string(const uint8_t *addr);
bool util_string_to_address(const char *str, uint8_t *addr); bool util_string_to_address(const char *str, uint8_t *addr);
bool util_is_group_address(const uint8_t *addr); bool util_is_group_address(const uint8_t *addr);