mirror of
https://github.com/espressif/openthread.git
synced 2026-07-28 22:57:47 +00:00
[history-tracker] add client/server for remote query (#11757)
This commit introduces a client/server mechanism to the History Tracker module. This allows a device to query history information from another device over the Thread network using TMF messages. The new functionality is composed of three main parts: - Server (`HistoryTracker::Server`): This component is responsible for handling incoming TMF query requests (`h/qy`). It collects the requested local history entries (e.g., Network Info), formats them into TLVs, and sends them back to the requester in one or more TMF answer messages (`h/an`). It can fragment large responses into multiple messages. - Client (`HistoryTracker::Client`): This provides a new public API (`otHistoryTrackerQueryNetInfo`) to send a query to a remote device. It handles sending the request and processing the received answer(s), passing the retrieved history entries to the user via a callback. A function to cancel an ongoing query (`otHistoryTrackerCancelQuery`) is also added. - TLVs (`history_tracker_tlvs`): New TLVs are defined for the query/answer protocol, including `RequestTlv` to specify the query parameters, `AnswerTlv` to manage multi-message responses, `NetworkInfoTlv` to carry the data, and `QueryIdTlv` to correlate requests and responses. A new CLI command, `history query netinfo`, is added to use the new client API. The existing `history netinfo` output logic is refactored into helper methods to be shared by both the local and remote history commands. The new feature can be enabled/disabled using two new configuration flags: - `OPENTHREAD_CONFIG_HISTORY_TRACKER_SERVER_ENABLE` - `OPENTHREAD_CONFIG_HISTORY_TRACKER_CLIENT_ENABLE`
This commit is contained in:
@@ -172,6 +172,13 @@ bool Agent::HandleResource(const char *aUriPath, Message &aMessage, const Ip6::M
|
||||
Case(kUriDiagnosticGetAnswer, NetworkDiagnostic::Client);
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE && OPENTHREAD_CONFIG_HISTORY_TRACKER_SERVER_ENABLE
|
||||
Case(kUriHistoryQuery, HistoryTracker::Server);
|
||||
#endif
|
||||
#if OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE && OPENTHREAD_CONFIG_HISTORY_TRACKER_CLIENT_ENABLE
|
||||
Case(kUriHistoryAnswer, HistoryTracker::Client);
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_FTD && OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE
|
||||
#if OPENTHREAD_CONFIG_BACKBONE_ROUTER_MULTICAST_ROUTING_ENABLE
|
||||
Case(kUriMlr, BackboneRouter::Manager);
|
||||
|
||||
Reference in New Issue
Block a user