2 * Copyright (c) 2020, The OpenThread Authors.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * 3. Neither the name of the copyright holder nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 * POSSIBILITY OF SUCH DAMAGE.
31 * This file includes definitions for types used by d-bus API.
34 #ifndef OTBR_DBUS_COMMON_TYPES_HPP_
35 #define OTBR_DBUS_COMMON_TYPES_HPP_
37 #include "dbus/common/error.hpp"
49 OTBR_DEVICE_ROLE_DISABLED = 0,
50 OTBR_DEVICE_ROLE_DETACHED = 1,
51 OTBR_DEVICE_ROLE_CHILD = 2,
52 OTBR_DEVICE_ROLE_ROUTER = 3,
53 OTBR_DEVICE_ROLE_LEADER = 4,
56 struct ActiveScanResult
58 uint64_t mExtAddress; ///< IEEE 802.15.4 Extended Address
59 std::string mNetworkName; ///< Thread Network Name
60 uint64_t mExtendedPanId; ///< Thread Extended PAN ID
61 std::vector<uint8_t> mSteeringData; ///< Steering Data
62 uint16_t mPanId; ///< IEEE 802.15.4 PAN ID
63 uint16_t mJoinerUdpPort; ///< Joiner UDP Port
64 uint8_t mChannel; ///< IEEE 802.15.4 Channel
65 int8_t mRssi; ///< RSSI (dBm)
66 uint8_t mLqi; ///< LQI
67 uint8_t mVersion; ///< Version
68 bool mIsNative; ///< Native Commissioner flag
69 bool mIsJoinable; ///< Joining Permitted flag
74 bool mRxOnWhenIdle; ///< 1, if the sender has its receiver on when not transmitting. 0, otherwise.
75 bool mDeviceType; ///< 1, if the sender is an FTD. 0, otherwise.
76 bool mNetworkData; ///< 1, if the sender requires the full Network Data. 0, otherwise.
81 std::vector<uint8_t> mPrefix; ///< The IPv6 prefix.
83 uint8_t mLength; ///< The IPv6 prefix length.
94 * A 2-bit signed integer indicating router preference as defined in RFC 4191.
99 * TRUE, if @p mPrefix is preferred. FALSE, otherwise.
104 * TRUE, if @p mPrefix should be used for address autoconfiguration. FALSE, otherwise.
109 * TRUE, if this border router is a DHCPv6 Agent that supplies IPv6 address configuration. FALSE, otherwise.
114 * TRUE, if this border router is a DHCPv6 Agent that supplies other configuration data. FALSE, otherwise.
119 * TRUE, if this border router is a default route for @p mPrefix. FALSE, otherwise.
124 * TRUE, if this prefix is considered on-mesh. FALSE, otherwise.
129 * TRUE, if this configuration is considered Stable Network Data. FALSE, otherwise.
142 * The Rloc associated with the external route entry.
144 * This value is ignored when adding an external route. For any added route, the device's Rloc is used.
149 * A 2-bit signed integer indicating router preference as defined in RFC 4191.
154 * TRUE, if this configuration is considered Stable Network Data. FALSE, otherwise.
159 * TRUE if the external route entry's next hop is this device itself (i.e., the route was added earlier by this
160 * device). FALSE otherwise.
162 * This value is ignored when adding an external route. For any added route the next hop is this device.
164 bool mNextHopIsThisDevice;
168 * This structure represents the MAC layer counters.
174 * The total number of unique MAC frame transmission requests.
176 * Note that this counter is incremented for each MAC transmission request only by one,
177 * regardless of the amount of CCA failures, CSMA-CA attempts, or retransmissions.
179 * This incrementation rule applies to the following counters:
183 * @p mTxNoAckRequested
187 * @p mTxBeaconRequest
190 * @p mTxErrBusyChannel
192 * The following equations are valid:
193 * @p mTxTotal = @p mTxUnicast + @p mTxBroadcast
194 * @p mTxTotal = @p mTxAckRequested + @p mTxNoAckRequested
195 * @p mTxTotal = @p mTxData + @p mTxDataPoll + @p mTxBeacon + @p mTxBeaconRequest + @p mTxOther
201 * The total number of unique unicast MAC frame transmission requests.
207 * The total number of unique broadcast MAC frame transmission requests.
210 uint32_t mTxBroadcast;
213 * The total number of unique MAC frame transmission requests with requested acknowledgment.
216 uint32_t mTxAckRequested;
219 * The total number of unique MAC frame transmission requests that were acked.
225 * The total number of unique MAC frame transmission requests without requested acknowledgment.
228 uint32_t mTxNoAckRequested;
231 * The total number of unique MAC Data frame transmission requests.
237 * The total number of unique MAC Data Poll frame transmission requests.
240 uint32_t mTxDataPoll;
243 * The total number of unique MAC Beacon frame transmission requests.
249 * The total number of unique MAC Beacon Request frame transmission requests.
252 uint32_t mTxBeaconRequest;
255 * The total number of unique other MAC frame transmission requests.
257 * This counter is currently unused.
263 * The total number of MAC retransmission attempts.
265 * Note that this counter is incremented by one for each retransmission attempt that may be
266 * triggered by lack of acknowledgement, CSMA/CA failure, or other type of transmission error.
267 * The @p mTxRetry counter is incremented both for unicast and broadcast MAC frames.
269 * Check the following configuration parameters to control the amount of retransmissions in the system:
270 * @sa OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_DIRECT
271 * @sa OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_INDIRECT
272 * @sa OPENTHREAD_CONFIG_MAC_TX_NUM_BCAST
273 * @sa OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT
274 * @sa OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_INDIRECT
276 * Currently, this counter is invalid if the platform's radio driver capability includes
277 * @sa OT_RADIO_CAPS_TRANSMIT_RETRIES.
283 * The total number of unique MAC transmission packets that meet maximal retry limit for direct packets.
286 uint32_t mTxDirectMaxRetryExpiry;
289 * The total number of unique MAC transmission packets that meet maximal retry limit for indirect packets.
292 uint32_t mTxIndirectMaxRetryExpiry;
295 * The total number of CCA failures.
297 * The meaning of this counter can be different and it depends on the platform's radio driver capabilities.
299 * If @sa OT_RADIO_CAPS_CSMA_BACKOFF is enabled, this counter represents the total number of full CSMA/CA
300 * failed attempts and it is incremented by one also for each retransmission (in case of a CSMA/CA fail).
302 * If @sa OT_RADIO_CAPS_TRANSMIT_RETRIES is enabled, this counter represents the total number of full CSMA/CA
303 * failed attempts and it is incremented by one for each individual data frame request (regardless of the amount of
310 * The total number of unique MAC transmission request failures cause by an abort error.
313 uint32_t mTxErrAbort;
316 * The total number of unique MAC transmission requests failures caused by a busy channel (a CSMA/CA fail).
319 uint32_t mTxErrBusyChannel;
322 * The total number of received frames.
324 * This counter counts all frames reported by the platform's radio driver, including frames
325 * that were dropped, for example because of an FCS error.
331 * The total number of unicast frames received.
337 * The total number of broadcast frames received.
340 uint32_t mRxBroadcast;
343 * The total number of MAC Data frames received.
349 * The total number of MAC Data Poll frames received.
352 uint32_t mRxDataPoll;
355 * The total number of MAC Beacon frames received.
361 * The total number of MAC Beacon Request frames received.
364 uint32_t mRxBeaconRequest;
367 * The total number of other types of frames received.
373 * The total number of frames dropped by MAC Filter module, for example received from denylisted node.
376 uint32_t mRxAddressFiltered;
379 * The total number of frames dropped by destination address check, for example received frame for other node.
382 uint32_t mRxDestAddrFiltered;
385 * The total number of frames dropped due to duplication, that is when the frame has been already received.
387 * This counter may be incremented, for example when ACK frame generated by the receiver hasn't reached
388 * transmitter node which performed retransmission.
391 uint32_t mRxDuplicated;
394 * The total number of frames dropped because of missing or malformed content.
397 uint32_t mRxErrNoFrame;
400 * The total number of frames dropped due to unknown neighbor.
403 uint32_t mRxErrUnknownNeighbor;
406 * The total number of frames dropped due to invalid source address.
409 uint32_t mRxErrInvalidSrcAddr;
412 * The total number of frames dropped due to security error.
414 * This counter may be incremented, for example when lower than expected Frame Counter is used
415 * to encrypt the frame.
421 * The total number of frames dropped due to invalid FCS.
427 * The total number of frames dropped due to other error.
430 uint32_t mRxErrOther;
435 uint32_t mTxSuccess; ///< The number of IPv6 packets successfully transmitted.
436 uint32_t mRxSuccess; ///< The number of IPv6 packets successfully received.
437 uint32_t mTxFailure; ///< The number of IPv6 packets failed to transmit.
438 uint32_t mRxFailure; ///< The number of IPv6 packets failed to receive.
441 struct ChannelQuality
449 uint64_t mExtAddress; ///< IEEE 802.15.4 Extended Address
450 uint32_t mTimeout; ///< Timeout
451 uint32_t mAge; ///< Time last heard
452 uint16_t mRloc16; ///< RLOC16
453 uint16_t mChildId; ///< Child ID
454 uint8_t mNetworkDataVersion; ///< Network Data Version
455 uint8_t mLinkQualityIn; ///< Link Quality In
456 int8_t mAverageRssi; ///< Average RSSI
457 int8_t mLastRssi; ///< Last observed RSSI
458 uint16_t mFrameErrorRate; ///< Frame error rate (0xffff->100%). Requires error tracking feature.
459 uint16_t mMessageErrorRate; ///< (IPv6) msg error rate (0xffff->100%). Requires error tracking feature.
460 bool mRxOnWhenIdle; ///< rx-on-when-idle
461 bool mFullThreadDevice; ///< Full Thread Device
462 bool mFullNetworkData; ///< Full Network Data
463 bool mIsStateRestoring; ///< Is in restoring state
468 uint64_t mExtAddress; ///< IEEE 802.15.4 Extended Address
469 uint32_t mAge; ///< Time last heard
470 uint16_t mRloc16; ///< RLOC16
471 uint32_t mLinkFrameCounter; ///< Link Frame Counter
472 uint32_t mMleFrameCounter; ///< MLE Frame Counter
473 uint8_t mLinkQualityIn; ///< Link Quality In
474 int8_t mAverageRssi; ///< Average RSSI
475 int8_t mLastRssi; ///< Last observed RSSI
476 uint16_t mFrameErrorRate; ///< Frame error rate (0xffff->100%). Requires error tracking feature.
477 uint16_t mMessageErrorRate; ///< (IPv6) msg error rate (0xffff->100%). Requires error tracking feature.
478 bool mRxOnWhenIdle; ///< rx-on-when-idle
479 bool mFullThreadDevice; ///< Full Thread Device
480 bool mFullNetworkData; ///< Full Network Data
481 bool mIsChild; ///< Is the neighbor a child
486 uint32_t mPartitionId; ///< Partition ID
487 uint8_t mWeighting; ///< Leader Weight
488 uint8_t mDataVersion; ///< Full Network Data Version
489 uint8_t mStableDataVersion; ///< Stable Network Data Version
490 uint8_t mLeaderRouterId; ///< Leader Router ID
496 #endif // OTBR_DBUS_COMMON_TYPES_HPP_