1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
61
62
63
64
65
66
71
72
75
76
81
82
83
88
89
90
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
122
123
124
129
130
131
136
137
138
144
145
146
153
154
155
161
162
163
166
167
168
169
170
171
172
173
/* ... */
/* ... */
#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 "coap/coap_message.hpp"
#include "common/locator.hpp"
#include "common/non_copyable.hpp"
#include "common/notifier.hpp"
#include "mac/mac_frame.hpp"
#include "mac/mac_types.hpp"
#include "net/ip6_address.hpp"
#include "thread/neighbor.hpp"
#include "thread/neighbor_table.hpp"12 includes
namespace ot {
namespace Utils {
/* ... */
class Otns : public InstanceLocator, private NonCopyable
{
friend class ot::Notifier;
public:
/* ... */
explicit Otns(Instance &aInstance)
: InstanceLocator(aInstance)
{
}{...}
/* ... */
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(NeighborTable::Event aEvent, const Neighbor &aNeighbor);
/* ... */
static void EmitTransmit(const Mac::TxFrame &aFrame);
/* ... */
static void EmitDeviceMode(Mle::DeviceMode aMode);
/* ... */
static void EmitCoapSend(const Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo);
/* ... */
static void EmitCoapSendFailure(Error aError, Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo);
/* ... */
static void EmitCoapReceive(const Coap::Message &aMessage, const Ip6::MessageInfo &aMessageInfo);
...
private:
static void EmitStatus(const char *aFmt, ...);
void HandleNotifierEvents(Events aEvents);...
}{...};
}{...}
}{...}
/* ... */
#endif
/* ... */
#endif