network: add __network_path_append_bss

To reduce code duplication and prepare for moving the BSS interface
to station, add a new API so station can create a BSS path without
a network object directly.
This commit is contained in:
James Prestwood 2024-08-19 08:57:29 -07:00 committed by Denis Kenzior
parent 7604762013
commit 514e483bc3
2 changed files with 12 additions and 3 deletions

View File

@ -1130,17 +1130,23 @@ bool network_update_known_frequencies(struct network *network)
return true;
}
const char *network_bss_get_path(const struct network *network,
const struct scan_bss *bss)
const char *__network_path_append_bss(const char *network_path,
const struct scan_bss *bss)
{
static char path[256];
snprintf(path, sizeof(path), "%s/%02x%02x%02x%02x%02x%02x",
network->object_path, MAC_STR(bss->addr));
network_path, MAC_STR(bss->addr));
return path;
}
const char *network_bss_get_path(const struct network *network,
const struct scan_bss *bss)
{
return __network_path_append_bss(network->object_path, bss);
}
static bool network_unregister_bss(void *a, void *user_data)
{
struct scan_bss *bss = a;

View File

@ -77,6 +77,9 @@ const char *network_bss_get_path(const struct network *network,
const struct scan_bss *bss);
bool network_bss_list_isempty(struct network *network);
const char *__network_path_append_bss(const char *network_path,
const struct scan_bss *bss);
struct scan_bss *network_bss_list_pop(struct network *network);
struct scan_bss *network_bss_find_by_addr(struct network *network,
const uint8_t *addr);