[RFC v2 50/99] NAN: Add an API to convert a schedule into a buffer
Andrei Otcheretianski
andrei.otcheretianski at intel.com
Tue Dec 23 03:51:54 PST 2025
From: Ilan Peer <ilan.peer at intel.com>
Add an API that will allow to export a NAN schedule
to availability attributes and dump them in a buffer.
This API can be used to add the device availability
information in SDFs etc.
Signed-off-by: Ilan Peer <ilan.peer at intel.com>
---
src/nan/nan.c | 32 ++++++++++++++++++++++++++++++++
src/nan/nan.h | 5 +++++
2 files changed, 37 insertions(+)
diff --git a/src/nan/nan.c b/src/nan/nan.c
index 6928e3bf0c..76aee12936 100644
--- a/src/nan/nan.c
+++ b/src/nan/nan.c
@@ -2051,3 +2051,35 @@ int nan_peer_get_pot_avail(struct nan_data *nan, const u8 *addr,
return 0;
}
+
+
+/*
+ * nan_convert_sched_to_avail_attrs - Convert NAN schedule to availability attrs
+ *
+ * @nan: NAN module context from nan_init()
+ * @map_ids_bitmap: Bitmap of map IDs for which NAN availability attributes
+ * should be added. Not all map IDs are covered by &chans. For map IDs that
+ * are not covered, NAN availability attributes will be added with
+ * potential availability entries.
+ * @sequence_id: Sequence ID for the availability attributes
+ * @n_chans: Number of channel entries in chans
+ * @chans: Channel entries
+ * @buf: Buffer to which the availability attributes will be added
+ * Return 0 on success; -1 on failure
+ *
+ * Convert the given NAN schedule information to availability attributes
+ * and add them to the given buffer. For each given map ID the get_chans()
+ * callback will be used to get the channel entries for the potential
+ * availability entries.
+ */
+int nan_convert_sched_to_avail_attrs(struct nan_data *nan, u8 sequence_id,
+ u32 map_ids_bitmap,
+ size_t n_chans,
+ struct nan_chan_schedule *chans,
+ struct wpabuf *buf)
+{
+ return nan_add_avail_attrs(nan, sequence_id,
+ map_ids_bitmap,
+ NAN_AVAIL_ENTRY_CTRL_TYPE_COND,
+ n_chans, chans, buf);
+}
diff --git a/src/nan/nan.h b/src/nan/nan.h
index 74686a3b28..f34f9e0e90 100644
--- a/src/nan/nan.h
+++ b/src/nan/nan.h
@@ -531,4 +531,9 @@ int nan_peer_get_pot_avail(struct nan_data *nan, const u8 *addr,
struct nan_peer_potential_avail *pot_avail);
int nan_peer_dump_pot_avail_to_buf(struct nan_peer_potential_avail *pot_avail,
char *buf, size_t buflen);
+int nan_convert_sched_to_avail_attrs(struct nan_data *nan, u8 sequence_id,
+ u32 map_ids_bitmap,
+ size_t n_chans,
+ struct nan_chan_schedule *chans,
+ struct wpabuf *buf);
#endif /* NAN_H */
--
2.49.0
More information about the Hostap
mailing list