2929
3030#include <openthread/instance.h>
3131#include <openthread/ip6.h>
32+ #include <openthread/netdata.h>
3233#include <openthread/thread.h>
3334
3435#ifdef __cplusplus
@@ -38,18 +39,13 @@ extern "C" {
3839/**
3940 * @addtogroup api-history-tracker
4041 *
41- * @{
42- *
43- */
44-
45- /**
4642 * @brief
47- * This header defines the public API for History Tracker.
43+ * Records the history of different events, for example RX and TX messages or network info changes. All tracked
44+ * entries are timestamped.
4845 *
49- * History Tracker module records history of different events (e.g. RX and TX messages or network info changes, etc.)
50- * as the Thread network operates. All tracked entries are timestamped.
46+ * The functions in this module are available when `OPENTHREAD_CONFIG_HISTOR_TRACKER_ENABLE` is enabled.
5147 *
52- * The functions in this module are available when `OPENTHREAD_CONFIG_HISTOR_TRACKER_ENABLE` is enabled.
48+ * @{
5349 *
5450 */
5551
@@ -196,6 +192,36 @@ typedef struct otHistoryTrackerNeighborInfo
196192 bool mIsChild : 1 ; ///< Indicates whether or not the neighbor is a child.
197193} otHistoryTrackerNeighborInfo ;
198194
195+ /**
196+ * This enumeration defines the events for a Network Data entry (i.e., whether an entry is added or removed).
197+ *
198+ */
199+ typedef enum
200+ {
201+ OT_HISTORY_TRACKER_NET_DATA_ENTRY_ADDED = 0 , ///< Network data entry is added.
202+ OT_HISTORY_TRACKER_NET_DATA_ENTRY_REMOVED = 1 , ///< Network data entry is removed.
203+ } otHistoryTrackerNetDataEvent ;
204+
205+ /**
206+ * This structure represent a Network Data on mesh prefix info.
207+ *
208+ */
209+ typedef struct otHistoryTrackerOnMeshPrefixInfo
210+ {
211+ otBorderRouterConfig mPrefix ; ///< The on mesh prefix entry.
212+ otHistoryTrackerNetDataEvent mEvent ; ///< Indicates the event (added/removed).
213+ } otHistoryTrackerOnMeshPrefixInfo ;
214+
215+ /**
216+ * This structure represent a Network Data extern route info.
217+ *
218+ */
219+ typedef struct otHistoryTrackerExternalRouteInfo
220+ {
221+ otExternalRouteConfig mRoute ; ///< The external route entry.
222+ otHistoryTrackerNetDataEvent mEvent ; ///< Indicates the event (added/removed).
223+ } otHistoryTrackerExternalRouteInfo ;
224+
199225/**
200226 * This function initializes an `otHistoryTrackerIterator`.
201227 *
@@ -316,6 +342,41 @@ const otHistoryTrackerNeighborInfo *otHistoryTrackerIterateNeighborHistory(otIns
316342 otHistoryTrackerIterator * aIterator ,
317343 uint32_t * aEntryAge );
318344
345+ /**
346+ * This function iterates over the entries in the Network Data on mesh prefix entry history list.
347+ *
348+ * @param[in] aInstance A pointer to the OpenThread instance.
349+ * @param[inout] aIterator A pointer to an iterator. MUST be initialized or the behavior is undefined.
350+ * @param[out] aEntryAge A pointer to a variable to output the entry's age. MUST NOT be NULL.
351+ * Age is provided as the duration (in milliseconds) from when entry was recorded to
352+ * @p aIterator initialization time. It is set to `OT_HISTORY_TRACKER_MAX_AGE` for entries
353+ * older than max age.
354+ *
355+ * @returns The `otHistoryTrackerOnMeshPrefixInfo` entry or `NULL` if no more entries in the list.
356+ *
357+ */
358+ const otHistoryTrackerOnMeshPrefixInfo * otHistoryTrackerIterateOnMeshPrefixHistory (otInstance * aInstance ,
359+ otHistoryTrackerIterator * aIterator ,
360+ uint32_t * aEntryAge );
361+
362+ /**
363+ * This function iterates over the entries in the Network Data external route entry history list.
364+ *
365+ * @param[in] aInstance A pointer to the OpenThread instance.
366+ * @param[inout] aIterator A pointer to an iterator. MUST be initialized or the behavior is undefined.
367+ * @param[out] aEntryAge A pointer to a variable to output the entry's age. MUST NOT be NULL.
368+ * Age is provided as the duration (in milliseconds) from when entry was recorded to
369+ * @p aIterator initialization time. It is set to `OT_HISTORY_TRACKER_MAX_AGE` for entries
370+ * older than max age.
371+ *
372+ * @returns The `otHistoryTrackerExternalRouteInfo` entry or `NULL` if no more entries in the list.
373+ *
374+ */
375+ const otHistoryTrackerExternalRouteInfo * otHistoryTrackerIterateExternalRouteHistory (
376+ otInstance * aInstance ,
377+ otHistoryTrackerIterator * aIterator ,
378+ uint32_t * aEntryAge );
379+
319380/**
320381 * This function converts a given entry age to a human-readable string.
321382 *
0 commit comments