diff mbox series

[1/6] network: add __network_path_append_bss

Message ID 20240816125214.1162415-1-prestwoj@gmail.com (mailing list archive)
State Accepted, archived
Headers show
Series [1/6] network: add __network_path_append_bss | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-alpine-ci-fetch success Fetch PR
prestwoj/iwd-ci-fetch success Fetch PR
prestwoj/iwd-ci-gitlint success GitLint
prestwoj/iwd-alpine-ci-setupell success Prep - Setup ELL
prestwoj/iwd-ci-setupell success Prep - Setup ELL
prestwoj/iwd-ci-makedistcheck success Make Distcheck
prestwoj/iwd-alpine-ci-makedistcheck success Make Distcheck
prestwoj/iwd-ci-build success Build - Configure
prestwoj/iwd-alpine-ci-build success Build - Configure
prestwoj/iwd-ci-makecheckvalgrind success Make Check w/Valgrind
prestwoj/iwd-ci-makecheck success Make Check
prestwoj/iwd-ci-clang success clang PASS
prestwoj/iwd-alpine-ci-makecheckvalgrind success Make Check w/Valgrind
prestwoj/iwd-alpine-ci-makecheck success Make Check
prestwoj/iwd-ci-incremental_build success Incremental Build with patches
prestwoj/iwd-alpine-ci-incremental_build success Incremental Build with patches
prestwoj/iwd-ci-testrunner fail test-runner - FAIL: testBasicServiceSet

Commit Message

James Prestwood Aug. 16, 2024, 12:52 p.m. UTC
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.
---
 src/network.c | 12 +++++++++---
 src/network.h |  3 +++
 2 files changed, 12 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/src/network.c b/src/network.c
index 85d2a983..a8e61d48 100644
--- 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
index 78ced99d..c9f73200 100644
--- 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);