mirror of
https://github.com/espressif/openthread.git
synced 2026-08-31 06:19:54 +00:00
[telemetry] border routing packet counters (#8280)
This commit introduces `otBorderRoutingCounters` which contains the number of packets and bytes forwarded via border routing. The counters have 4 categories: inbound unicast, inbound multicast, outbound unicast, outbound multicast. I've verified this feature locally on a BR device by ping command in following scenarios: - A host pings an ED's OMR. - An ED pings a host's onlink address. - A host pings a multicast address which an ED subscribes to. - An ED pings a multicast address which a host subscribes to.
This commit is contained in:
@@ -53,7 +53,7 @@ extern "C" {
|
||||
* @note This number versions both OpenThread platform and user APIs.
|
||||
*
|
||||
*/
|
||||
#define OPENTHREAD_API_VERSION (259)
|
||||
#define OPENTHREAD_API_VERSION (260)
|
||||
|
||||
/**
|
||||
* @addtogroup api-instance
|
||||
|
||||
@@ -851,6 +851,40 @@ otError otIp6SetMeshLocalIid(otInstance *aInstance, const otIp6InterfaceIdentifi
|
||||
*/
|
||||
const char *otIp6ProtoToString(uint8_t aIpProto);
|
||||
|
||||
/**
|
||||
* This structure represents the counters for packets and bytes.
|
||||
*
|
||||
*/
|
||||
typedef struct otPacketsAndBytes
|
||||
{
|
||||
uint64_t mPackets; ///< The number of packets.
|
||||
uint64_t mBytes; ///< The number of bytes.
|
||||
} otPacketsAndBytes;
|
||||
|
||||
/**
|
||||
* This structure represents the counters of packets forwarded via Border Routing.
|
||||
*
|
||||
*/
|
||||
typedef struct otBorderRoutingCounters
|
||||
{
|
||||
otPacketsAndBytes mInboundUnicast; ///< The counters for inbound unicast.
|
||||
otPacketsAndBytes mInboundMulticast; ///< The counters for inbound multicast.
|
||||
otPacketsAndBytes mOutboundUnicast; ///< The counters for outbound unicast.
|
||||
otPacketsAndBytes mOutboundMulticast; ///< The counters for outbound multicast.
|
||||
} otBorderRoutingCounters;
|
||||
|
||||
/**
|
||||
* Gets the Border Routing counters.
|
||||
*
|
||||
* This function requires the build-time feature `OPENTHREAD_CONFIG_IP6_BR_COUNTERS_ENABLE` to be enabled.
|
||||
*
|
||||
* @param[in] aInstance A pointer to an OpenThread instance.
|
||||
*
|
||||
* @returns A pointer to the Border Routing counters.
|
||||
*
|
||||
*/
|
||||
const otBorderRoutingCounters *otIp6GetBorderRoutingCounters(otInstance *aInstance);
|
||||
|
||||
/**
|
||||
* @}
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user