#ifndef UTILS_OTNS_HPP_
#define UTILS_OTNS_HPP_
#include "openthread-core-config.h"
#if (OPENTHREAD_MTD || OPENTHREAD_FTD) && OPENTHREAD_CONFIG_OTNS_ENABLE
#include <openthread/thread.h>
#include <openthread/thread_ftd.h>
#include <openthread/platform/otns.h>
#include "common/locator.hpp"
#include "common/non_copyable.hpp"
#include "common/notifier.hpp"
#include "mac/mac_types.hpp"
#include "net/ip6_address.hpp"
#include "thread/topology.hpp"
namespace ot {
namespace Utils {
class Otns : public InstanceLocator, private NonCopyable
{
public:
explicit Otns(Instance &aInstance)
: InstanceLocator(aInstance)
, mNotifierCallback(aInstance, &Otns::HandleStateChanged, this)
{
}
static void EmitShortAddress(uint16_t aShortAddress);
static void EmitExtendedAddress(const Mac::ExtAddress &aExtAddress);
static void EmitPingRequest(const Ip6::Address &aPeerAddress,
uint16_t aPingLength,
uint32_t aTimestamp,
uint8_t aHopLimit);
static void EmitPingReply(const Ip6::Address &aPeerAddress,
uint16_t aPingLength,
uint32_t aTimestamp,
uint8_t aHopLimit);
static void EmitNeighborChange(otNeighborTableEvent aEvent, Neighbor &aNeighbor);
private:
static void EmitStatus(const char *aFmt, ...);
static void HandleStateChanged(Notifier::Callback &aCallback, otChangedFlags aFlags);
void HandleStateChanged(otChangedFlags aFlags);
Notifier::Callback mNotifierCallback;
};
} }
#endif
#endif