1 /* 2 * Copyright (c) 2020, The OpenThread Authors. 3 * All rights reserved. 4 * 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. 15 * 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. 27 */ 28 29 /** 30 * @file 31 * This file includes definitions for types used by d-bus API. 32 */ 33 34 #ifndef OTBR_DBUS_COMMON_TYPES_HPP_ 35 #define OTBR_DBUS_COMMON_TYPES_HPP_ 36 37 #include "openthread-br/config.h" 38 39 #include "dbus/common/error.hpp" 40 41 #include <stdint.h> 42 43 #include <array> 44 #include <string> 45 #include <vector> 46 47 namespace otbr { 48 namespace DBus { 49 50 enum DeviceRole 51 { 52 OTBR_DEVICE_ROLE_DISABLED = 0, 53 OTBR_DEVICE_ROLE_DETACHED = 1, 54 OTBR_DEVICE_ROLE_CHILD = 2, 55 OTBR_DEVICE_ROLE_ROUTER = 3, 56 OTBR_DEVICE_ROLE_LEADER = 4, 57 }; 58 59 struct ActiveScanResult 60 { 61 uint64_t mExtAddress; ///< IEEE 802.15.4 Extended Address 62 std::string mNetworkName; ///< Thread Network Name 63 uint64_t mExtendedPanId; ///< Thread Extended PAN ID 64 std::vector<uint8_t> mSteeringData; ///< Steering Data 65 uint16_t mPanId; ///< IEEE 802.15.4 PAN ID 66 uint16_t mJoinerUdpPort; ///< Joiner UDP Port 67 uint8_t mChannel; ///< IEEE 802.15.4 Channel 68 int8_t mRssi; ///< RSSI (dBm) 69 uint8_t mLqi; ///< LQI 70 uint8_t mVersion; ///< Version 71 bool mIsNative; ///< Native Commissioner flag 72 bool mDiscover; ///< Result from MLE Discovery 73 }; 74 75 struct EnergyScanResult 76 { 77 uint8_t mChannel; ///< IEEE 802.15.4 Channel 78 int8_t mMaxRssi; ///< The max RSSI (dBm) 79 }; 80 81 struct LinkModeConfig 82 { 83 bool mRxOnWhenIdle; ///< 1, if the sender has its receiver on when not transmitting. 0, otherwise. 84 bool mDeviceType; ///< 1, if the sender is an FTD. 0, otherwise. 85 bool mNetworkData; ///< 1, if the sender requires the full Network Data. 0, otherwise. 86 }; 87 88 struct Ip6Prefix 89 { 90 std::vector<uint8_t> mPrefix; ///< The IPv6 prefix. 91 92 uint8_t mLength; ///< The IPv6 prefix length. 93 }; 94 95 using Ip4Address = std::array<uint8_t, 4>; 96 using Ip6Address = std::array<uint8_t, 16>; 97 98 struct OnMeshPrefix 99 { 100 /** 101 * The IPv6 prefix. 102 */ 103 Ip6Prefix mPrefix; 104 105 /** 106 * The Rloc associated with the Border Router prefix. 107 */ 108 uint16_t mRloc16; 109 110 /** 111 * A 2-bit signed integer indicating router preference as defined in RFC 4191. 112 */ 113 int8_t mPreference; 114 115 /** 116 * TRUE, if @p mPrefix is preferred. FALSE, otherwise. 117 */ 118 bool mPreferred; 119 120 /** 121 * TRUE, if @p mPrefix should be used for address autoconfiguration. FALSE, otherwise. 122 */ 123 bool mSlaac; 124 125 /** 126 * TRUE, if this border router is a DHCPv6 Agent that supplies IPv6 address configuration. FALSE, otherwise. 127 */ 128 bool mDhcp; 129 130 /** 131 * TRUE, if this border router is a DHCPv6 Agent that supplies other configuration data. FALSE, otherwise. 132 */ 133 bool mConfigure; 134 135 /** 136 * TRUE, if this border router is a default route for @p mPrefix. FALSE, otherwise. 137 */ 138 bool mDefaultRoute; 139 140 /** 141 * TRUE if this prefix is considered on-mesh. FALSE otherwise. 142 */ 143 bool mOnMesh; 144 145 /** 146 * TRUE if this configuration is considered Stable Network Data. FALSE otherwise. 147 */ 148 bool mStable; 149 150 /** 151 * TRUE if this border router can supply DNS information via ND. FALSE otherwise. 152 */ 153 bool mNdDns; 154 155 /** 156 * TRUE if this prefix is a Thread Domain Prefix. FALSE otherwise. 157 */ 158 bool mDp; 159 }; 160 161 struct ExternalRoute 162 { 163 /** 164 * The IPv6 prefix. 165 */ 166 Ip6Prefix mPrefix; 167 168 /** 169 * The Rloc associated with the external route entry. 170 * 171 * This value is ignored when adding an external route. For any added route, the device's Rloc is used. 172 */ 173 uint16_t mRloc16; 174 175 /** 176 * A 2-bit signed integer indicating router preference as defined in RFC 4191. 177 */ 178 int8_t mPreference; 179 180 /** 181 * TRUE, if this configuration is considered Stable Network Data. FALSE, otherwise. 182 */ 183 bool mStable; 184 185 /** 186 * TRUE if the external route entry's next hop is this device itself (i.e., the route was added earlier by this 187 * device). FALSE otherwise. 188 * 189 * This value is ignored when adding an external route. For any added route the next hop is this device. 190 */ 191 bool mNextHopIsThisDevice; 192 }; 193 194 /** 195 * This structure represents the MAC layer counters. 196 */ 197 struct MacCounters 198 { 199 /** 200 * The total number of unique MAC frame transmission requests. 201 * 202 * Note that this counter is incremented for each MAC transmission request only by one, 203 * regardless of the amount of CCA failures, CSMA-CA attempts, or retransmissions. 204 * 205 * This incrementation rule applies to the following counters: 206 * @p mTxUnicast 207 * @p mTxBroadcast 208 * @p mTxAckRequested 209 * @p mTxNoAckRequested 210 * @p mTxData 211 * @p mTxDataPoll 212 * @p mTxBeacon 213 * @p mTxBeaconRequest 214 * @p mTxOther 215 * @p mTxErrAbort 216 * @p mTxErrBusyChannel 217 * 218 * The following equations are valid: 219 * @p mTxTotal = @p mTxUnicast + @p mTxBroadcast 220 * @p mTxTotal = @p mTxAckRequested + @p mTxNoAckRequested 221 * @p mTxTotal = @p mTxData + @p mTxDataPoll + @p mTxBeacon + @p mTxBeaconRequest + @p mTxOther 222 */ 223 uint32_t mTxTotal; 224 225 /** 226 * The total number of unique unicast MAC frame transmission requests. 227 */ 228 uint32_t mTxUnicast; 229 230 /** 231 * The total number of unique broadcast MAC frame transmission requests. 232 */ 233 uint32_t mTxBroadcast; 234 235 /** 236 * The total number of unique MAC frame transmission requests with requested acknowledgment. 237 */ 238 uint32_t mTxAckRequested; 239 240 /** 241 * The total number of unique MAC frame transmission requests that were acked. 242 */ 243 uint32_t mTxAcked; 244 245 /** 246 * The total number of unique MAC frame transmission requests without requested acknowledgment. 247 */ 248 uint32_t mTxNoAckRequested; 249 250 /** 251 * The total number of unique MAC Data frame transmission requests. 252 */ 253 uint32_t mTxData; 254 255 /** 256 * The total number of unique MAC Data Poll frame transmission requests. 257 */ 258 uint32_t mTxDataPoll; 259 260 /** 261 * The total number of unique MAC Beacon frame transmission requests. 262 */ 263 uint32_t mTxBeacon; 264 265 /** 266 * The total number of unique MAC Beacon Request frame transmission requests. 267 */ 268 uint32_t mTxBeaconRequest; 269 270 /** 271 * The total number of unique other MAC frame transmission requests. 272 * 273 * This counter is currently unused. 274 */ 275 uint32_t mTxOther; 276 277 /** 278 * The total number of MAC retransmission attempts. 279 * 280 * Note that this counter is incremented by one for each retransmission attempt that may be 281 * triggered by lack of acknowledgement, CSMA/CA failure, or other type of transmission error. 282 * The @p mTxRetry counter is incremented both for unicast and broadcast MAC frames. 283 * 284 * Check the following configuration parameters to control the amount of retransmissions in the system: 285 * @sa OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_DIRECT 286 * @sa OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_INDIRECT 287 * @sa OPENTHREAD_CONFIG_MAC_TX_NUM_BCAST 288 * @sa OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT 289 * @sa OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_INDIRECT 290 * 291 * Currently, this counter is invalid if the platform's radio driver capability includes 292 * @sa OT_RADIO_CAPS_TRANSMIT_RETRIES. 293 */ 294 uint32_t mTxRetry; 295 296 /** 297 * The total number of unique MAC transmission packets that meet maximal retry limit for direct packets. 298 */ 299 uint32_t mTxDirectMaxRetryExpiry; 300 301 /** 302 * The total number of unique MAC transmission packets that meet maximal retry limit for indirect packets. 303 */ 304 uint32_t mTxIndirectMaxRetryExpiry; 305 306 /** 307 * The total number of CCA failures. 308 * 309 * The meaning of this counter can be different and it depends on the platform's radio driver capabilities. 310 * 311 * If @sa OT_RADIO_CAPS_CSMA_BACKOFF is enabled, this counter represents the total number of full CSMA/CA 312 * failed attempts and it is incremented by one also for each retransmission (in case of a CSMA/CA fail). 313 * 314 * If @sa OT_RADIO_CAPS_TRANSMIT_RETRIES is enabled, this counter represents the total number of full CSMA/CA 315 * failed attempts and it is incremented by one for each individual data frame request (regardless of the amount of 316 * retransmissions). 317 */ 318 uint32_t mTxErrCca; 319 320 /** 321 * The total number of unique MAC transmission request failures cause by an abort error. 322 */ 323 uint32_t mTxErrAbort; 324 325 /** 326 * The total number of unique MAC transmission requests failures caused by a busy channel (a CSMA/CA fail). 327 */ 328 uint32_t mTxErrBusyChannel; 329 330 /** 331 * The total number of received frames. 332 * 333 * This counter counts all frames reported by the platform's radio driver, including frames 334 * that were dropped, for example because of an FCS error. 335 */ 336 uint32_t mRxTotal; 337 338 /** 339 * The total number of unicast frames received. 340 */ 341 uint32_t mRxUnicast; 342 343 /** 344 * The total number of broadcast frames received. 345 */ 346 uint32_t mRxBroadcast; 347 348 /** 349 * The total number of MAC Data frames received. 350 */ 351 uint32_t mRxData; 352 353 /** 354 * The total number of MAC Data Poll frames received. 355 */ 356 uint32_t mRxDataPoll; 357 358 /** 359 * The total number of MAC Beacon frames received. 360 */ 361 uint32_t mRxBeacon; 362 363 /** 364 * The total number of MAC Beacon Request frames received. 365 */ 366 uint32_t mRxBeaconRequest; 367 368 /** 369 * The total number of other types of frames received. 370 */ 371 uint32_t mRxOther; 372 373 /** 374 * The total number of frames dropped by MAC Filter module, for example received from denylisted node. 375 */ 376 uint32_t mRxAddressFiltered; 377 378 /** 379 * The total number of frames dropped by destination address check, for example received frame for other node. 380 */ 381 uint32_t mRxDestAddrFiltered; 382 383 /** 384 * The total number of frames dropped due to duplication, that is when the frame has been already received. 385 * 386 * This counter may be incremented, for example when ACK frame generated by the receiver hasn't reached 387 * transmitter node which performed retransmission. 388 */ 389 uint32_t mRxDuplicated; 390 391 /** 392 * The total number of frames dropped because of missing or malformed content. 393 */ 394 uint32_t mRxErrNoFrame; 395 396 /** 397 * The total number of frames dropped due to unknown neighbor. 398 */ 399 uint32_t mRxErrUnknownNeighbor; 400 401 /** 402 * The total number of frames dropped due to invalid source address. 403 */ 404 uint32_t mRxErrInvalidSrcAddr; 405 406 /** 407 * The total number of frames dropped due to security error. 408 * 409 * This counter may be incremented, for example when lower than expected Frame Counter is used 410 * to encrypt the frame. 411 */ 412 uint32_t mRxErrSec; 413 414 /** 415 * The total number of frames dropped due to invalid FCS. 416 */ 417 uint32_t mRxErrFcs; 418 419 /** 420 * The total number of frames dropped due to other error. 421 */ 422 uint32_t mRxErrOther; 423 }; 424 425 struct IpCounters 426 { 427 uint32_t mTxSuccess; ///< The number of IPv6 packets successfully transmitted. 428 uint32_t mRxSuccess; ///< The number of IPv6 packets successfully received. 429 uint32_t mTxFailure; ///< The number of IPv6 packets failed to transmit. 430 uint32_t mRxFailure; ///< The number of IPv6 packets failed to receive. 431 }; 432 433 struct ChannelQuality 434 { 435 uint8_t mChannel; 436 uint16_t mOccupancy; 437 }; 438 439 struct ChildInfo 440 { 441 uint64_t mExtAddress; ///< IEEE 802.15.4 Extended Address 442 uint32_t mTimeout; ///< Timeout 443 uint32_t mAge; ///< Time last heard 444 uint16_t mRloc16; ///< RLOC16 445 uint16_t mChildId; ///< Child ID 446 uint8_t mNetworkDataVersion; ///< Network Data Version 447 uint8_t mLinkQualityIn; ///< Link Quality In 448 int8_t mAverageRssi; ///< Average RSSI 449 int8_t mLastRssi; ///< Last observed RSSI 450 uint16_t mFrameErrorRate; ///< Frame error rate (0xffff->100%). Requires error tracking feature. 451 uint16_t mMessageErrorRate; ///< (IPv6) msg error rate (0xffff->100%). Requires error tracking feature. 452 bool mRxOnWhenIdle; ///< rx-on-when-idle 453 bool mFullThreadDevice; ///< Full Thread Device 454 bool mFullNetworkData; ///< Full Network Data 455 bool mIsStateRestoring; ///< Is in restoring state 456 }; 457 458 struct NeighborInfo 459 { 460 uint64_t mExtAddress; ///< IEEE 802.15.4 Extended Address 461 uint32_t mAge; ///< Time last heard 462 uint16_t mRloc16; ///< RLOC16 463 uint32_t mLinkFrameCounter; ///< Link Frame Counter 464 uint32_t mMleFrameCounter; ///< MLE Frame Counter 465 uint8_t mLinkQualityIn; ///< Link Quality In 466 int8_t mAverageRssi; ///< Average RSSI 467 int8_t mLastRssi; ///< Last observed RSSI 468 uint16_t mFrameErrorRate; ///< Frame error rate (0xffff->100%). Requires error tracking feature. 469 uint16_t mMessageErrorRate; ///< (IPv6) msg error rate (0xffff->100%). Requires error tracking feature. 470 uint16_t mVersion; ///< Thread version of the neighbor 471 bool mRxOnWhenIdle; ///< rx-on-when-idle 472 bool mFullThreadDevice; ///< Full Thread Device 473 bool mFullNetworkData; ///< Full Network Data 474 bool mIsChild; ///< Is the neighbor a child 475 }; 476 477 struct LeaderData 478 { 479 uint32_t mPartitionId; ///< Partition ID 480 uint8_t mWeighting; ///< Leader Weight 481 uint8_t mDataVersion; ///< Full Network Data Version 482 uint8_t mStableDataVersion; ///< Stable Network Data Version 483 uint8_t mLeaderRouterId; ///< Leader Router ID 484 }; 485 486 struct TxtEntry 487 { 488 std::string mKey; 489 std::vector<uint8_t> mValue; 490 }; 491 492 enum SrpServerState : uint8_t 493 { 494 OTBR_SRP_SERVER_STATE_DISABLED = 0, ///< The SRP server is disabled. 495 OTBR_SRP_SERVER_STATE_RUNNING = 1, ///< The SRP server is running. 496 OTBR_SRP_SERVER_STATE_STOPPED = 2, ///< The SRP server is stopped. 497 }; 498 499 enum SrpServerAddressMode : uint8_t 500 { 501 OTBR_SRP_SERVER_ADDRESS_MODE_UNICAST = 0, ///< Unicast address mode. 502 OTBR_SRP_SERVER_ADDRESS_MODE_ANYCAST = 1, ///< Anycast address mode. 503 }; 504 505 struct SrpServerInfo 506 { 507 struct Registration 508 { 509 uint32_t mFreshCount; ///< The number of active hosts/services registered on the SRP server 510 uint32_t mDeletedCount; ///< The number of hosts/services in 'Deleted' state on the SRP server 511 uint64_t mLeaseTimeTotal; ///< The sum of lease time in milliseconds of all active hosts/services 512 ///< on the SRP server 513 uint64_t mKeyLeaseTimeTotal; ///< The sum of key lease time in milliseconds of all active hosts/services on the 514 ///< SRP server 515 uint64_t mRemainingLeaseTimeTotal; ///< The sum of remaining lease time in milliseconds of all active 516 ///< hosts/services on the SRP server 517 uint64_t mRemainingKeyLeaseTimeTotal; ///< The sum of remaining key lease time in milliseconds of all active 518 ///< hosts/services on the SRP server 519 }; 520 521 struct ResponseCounters 522 { 523 uint32_t mSuccess; ///< The number of successful responses 524 uint32_t mServerFailure; ///< The number of server failure responses 525 uint32_t mFormatError; ///< The number of format error responses 526 uint32_t mNameExists; ///< The number of 'name exists' responses 527 uint32_t mRefused; ///< The number of refused responses 528 uint32_t mOther; ///< The number of other responses 529 }; 530 531 SrpServerState mState; ///< The state of the SRP server 532 uint16_t mPort; ///< The listening port number 533 SrpServerAddressMode mAddressMode; ///< The address mode {unicast, anycast} of the SRP server 534 Registration mHosts; ///< The registration information of hosts on the SRP server 535 Registration mServices; ///< The registration information of services on the SRP server 536 ResponseCounters mResponseCounters; ///< The counters of response codes sent by the SRP server 537 }; 538 539 struct DnssdCounters 540 { 541 uint32_t mSuccessResponse; ///< The number of successful responses 542 uint32_t mServerFailureResponse; ///< The number of server failure responses 543 uint32_t mFormatErrorResponse; ///< The number of format error responses 544 uint32_t mNameErrorResponse; ///< The number of name error responses 545 uint32_t mNotImplementedResponse; ///< The number of 'not implemented' responses 546 uint32_t mOtherResponse; ///< The number of other responses 547 548 uint32_t mResolvedBySrp; ///< The number of queries completely resolved by the local SRP server 549 }; 550 551 struct RadioSpinelMetrics 552 { 553 uint32_t mRcpTimeoutCount; ///< The number of RCP timeouts. 554 uint32_t mRcpUnexpectedResetCount; ///< The number of RCP unexcepted resets. 555 uint32_t mRcpRestorationCount; ///< The number of RCP restorations. 556 uint32_t mSpinelParseErrorCount; ///< The number of spinel frame parse errors. 557 }; 558 559 struct RcpInterfaceMetrics 560 { 561 uint8_t mRcpInterfaceType; ///< The RCP interface type. 562 uint64_t mTransferredFrameCount; ///< The number of transferred frames. 563 uint64_t mTransferredValidFrameCount; ///< The number of transferred valid frames. 564 uint64_t mTransferredGarbageFrameCount; ///< The number of transferred garbage frames. 565 uint64_t mRxFrameCount; ///< The number of received frames. 566 uint64_t mRxFrameByteCount; ///< The number of received bytes. 567 uint64_t mTxFrameCount; ///< The number of transmitted frames. 568 uint64_t mTxFrameByteCount; ///< The number of transmitted bytes. 569 }; 570 571 struct RadioCoexMetrics 572 { 573 uint32_t mNumGrantGlitch; ///< Number of grant glitches. 574 uint32_t mNumTxRequest; ///< Number of tx requests. 575 uint32_t mNumTxGrantImmediate; ///< Number of tx requests while grant was active. 576 uint32_t mNumTxGrantWait; ///< Number of tx requests while grant was inactive. 577 uint32_t mNumTxGrantWaitActivated; ///< Number of tx requests while grant was inactive that were ultimately granted. 578 uint32_t mNumTxGrantWaitTimeout; ///< Number of tx requests while grant was inactive that timed out. 579 uint32_t mNumTxGrantDeactivatedDuringRequest; ///< Number of tx that were in progress when grant was deactivated. 580 uint32_t mNumTxDelayedGrant; ///< Number of tx requests that were not granted within 50us. 581 uint32_t mAvgTxRequestToGrantTime; ///< Average time in usec from tx request to grant. 582 uint32_t mNumRxRequest; ///< Number of rx requests. 583 uint32_t mNumRxGrantImmediate; ///< Number of rx requests while grant was active. 584 uint32_t mNumRxGrantWait; ///< Number of rx requests while grant was inactive. 585 uint32_t mNumRxGrantWaitActivated; ///< Number of rx requests while grant was inactive that were ultimately granted. 586 uint32_t mNumRxGrantWaitTimeout; ///< Number of rx requests while grant was inactive that timed out. 587 uint32_t mNumRxGrantDeactivatedDuringRequest; ///< Number of rx that were in progress when grant was deactivated. 588 uint32_t mNumRxDelayedGrant; ///< Number of rx requests that were not granted within 50us. 589 uint32_t mAvgRxRequestToGrantTime; ///< Average time in usec from rx request to grant. 590 uint32_t mNumRxGrantNone; ///< Number of rx requests that completed without receiving grant. 591 bool mStopped; ///< Stats collection stopped due to saturation. 592 }; 593 594 struct BorderRoutingCounters 595 { 596 struct PacketsAndBytes 597 { 598 uint64_t mPackets; ///< The number of packets. 599 uint64_t mBytes; ///< The number of bytes. 600 }; 601 602 PacketsAndBytes mInboundUnicast; ///< The counters for inbound unicast. 603 PacketsAndBytes mInboundMulticast; ///< The counters for inbound multicast. 604 PacketsAndBytes mOutboundUnicast; ///< The counters for outbound unicast. 605 PacketsAndBytes mOutboundMulticast; ///< The counters for outbound multicast. 606 uint32_t mRaRx; ///< The number of received RA packets. 607 uint32_t mRaTxSuccess; ///< The number of RA packets successfully transmitted. 608 uint32_t mRaTxFailure; ///< The number of RA packets failed to transmit. 609 uint32_t mRsRx; ///< The number of received RS packets. 610 uint32_t mRsTxSuccess; ///< The number of RS packets successfully transmitted. 611 uint32_t mRsTxFailure; ///< The number of RS packets failed to transmit. 612 }; 613 614 struct Nat64ComponentState 615 { 616 std::string mPrefixManagerState; 617 std::string mTranslatorState; 618 }; 619 620 struct Nat64TrafficCounters 621 { 622 uint64_t m4To6Packets; ///< Number of packets translated from IPv4 to IPv6. 623 uint64_t m4To6Bytes; ///< Sum of size of packets translated from IPv4 to IPv6. 624 uint64_t m6To4Packets; ///< Number of packets translated from IPv6 to IPv4. 625 uint64_t m6To4Bytes; ///< Sum of size of packets translated from IPv6 to IPv4. 626 }; 627 628 struct Nat64PacketCounters 629 { 630 uint64_t m4To6Packets; ///< Number of packets translated from IPv4 to IPv6. 631 uint64_t m6To4Packets; ///< Number of packets translated from IPv6 to IPv4. 632 }; 633 634 struct Nat64ProtocolCounters 635 { 636 Nat64TrafficCounters mTotal; ///< Counters for sum of all protocols. 637 Nat64TrafficCounters mIcmp; ///< Counters for ICMP and ICMPv6. 638 Nat64TrafficCounters mUdp; ///< Counters for UDP. 639 Nat64TrafficCounters mTcp; ///< Counters for TCP. 640 }; 641 642 struct Nat64AddressMapping 643 { 644 uint64_t mId; ///< The unique id for a mapping session. 645 Ip4Address mIp4; ///< The IPv4 address of the mapping. 646 Ip6Address mIp6; ///< The IPv6 address of the mapping. 647 uint32_t mRemainingTimeMs; ///< Remaining time before expiry in milliseconds. 648 649 Nat64ProtocolCounters mCounters; 650 }; 651 652 struct Nat64ErrorCounters 653 { 654 Nat64PacketCounters mUnknown; ///< Packet drop for unknown reasons. 655 Nat64PacketCounters mIllegalPacket; ///< Packet drop due to failed to parse the datagram. 656 Nat64PacketCounters mUnsupportedProto; ///< Packet drop due to unsupported IP protocol. 657 Nat64PacketCounters mNoMapping; ///< Packet drop due to no mappings found or mapping pool exhausted. 658 }; 659 660 struct InfraLinkInfo 661 { 662 std::string mName; ///< The name of the infrastructure network interface. 663 bool mIsUp; ///< Whether the infrastructure network interface is up. 664 bool mIsRunning; ///< Whether the infrastructure network interface is running. 665 bool mIsMulticast; ///< Whether the infrastructure network interface is multicast. 666 uint32_t mLinkLocalAddressCount; ///< The number of link-local addresses on the infra network interface. 667 uint32_t mUniqueLocalAddressCount; ///< The number of unique local addresses on the infra network interface. 668 uint32_t mGlobalUnicastAddressCount; ///< The number of global unicast addresses on the infra network interface. 669 }; 670 671 struct TrelInfo 672 { 673 struct TrelPacketCounters 674 { 675 uint64_t mTxPackets; ///< Number of packets transmitted through TREL. 676 uint64_t mTxBytes; ///< Sum of size of packets transmitted through TREL. 677 uint64_t mTxFailure; ///< Number of packet transmission failures through TREL. 678 uint64_t mRxPackets; ///< Number of packets received through TREL. 679 uint64_t mRxBytes; ///< Sum of size of packets received through TREL. 680 }; 681 682 bool mEnabled; ///< Whether TREL is enabled. 683 uint16_t mNumTrelPeers; ///< The number of TREL peers. 684 TrelPacketCounters mTrelCounters; ///< The TREL counters. 685 }; 686 687 } // namespace DBus 688 } // namespace otbr 689 690 #endif // OTBR_DBUS_COMMON_TYPES_HPP_ 691