commit 514e483bc3c5eeed82bb232b84c3615614bca6e9
parent 7604762013b6859c42bc92374559d309bd0aadb6
Author: James Prestwood <prestwoj@gmail.com>
Date: Mon, 19 Aug 2024 08:57:29 -0700
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.
Diffstat:
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/network.c b/src/network.c
@@ -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;
diff --git a/src/network.h b/src/network.h
@@ -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);