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 */ 198 struct MacCounters 199 { 200 /** 201 * The total number of unique MAC frame transmission requests. 202 * 203 * Note that this counter is incremented for each MAC transmission request only by one, 204 * regardless of the amount of CCA failures, CSMA-CA attempts, or retransmissions. 205 * 206 * This incrementation rule applies to the following counters: 207 * @p mTxUnicast 208 * @p mTxBroadcast 209 * @p mTxAckRequested 210 * @p mTxNoAckRequested 211 * @p mTxData 212 * @p mTxDataPoll 213 * @p mTxBeacon 214 * @p mTxBeaconRequest 215 * @p mTxOther 216 * @p mTxErrAbort 217 * @p mTxErrBusyChannel 218 * 219 * The following equations are valid: 220 * @p mTxTotal = @p mTxUnicast + @p mTxBroadcast 221 * @p mTxTotal = @p mTxAckRequested + @p mTxNoAckRequested 222 * @p mTxTotal = @p mTxData + @p mTxDataPoll + @p mTxBeacon + @p mTxBeaconRequest + @p mTxOther 223 * 224 */ 225 uint32_t mTxTotal; 226 227 /** 228 * The total number of unique unicast MAC frame transmission requests. 229 * 230 */ 231 uint32_t mTxUnicast; 232 233 /** 234 * The total number of unique broadcast MAC frame transmission requests. 235 * 236 */ 237 uint32_t mTxBroadcast; 238 239 /** 240 * The total number of unique MAC frame transmission requests with requested acknowledgment. 241 * 242 */ 243 uint32_t mTxAckRequested; 244 245 /** 246 * The total number of unique MAC frame transmission requests that were acked. 247 * 248 */ 249 uint32_t mTxAcked; 250 251 /** 252 * The total number of unique MAC frame transmission requests without requested acknowledgment. 253 * 254 */ 255 uint32_t mTxNoAckRequested; 256 257 /** 258 * The total number of unique MAC Data frame transmission requests. 259 * 260 */ 261 uint32_t mTxData; 262 263 /** 264 * The total number of unique MAC Data Poll frame transmission requests. 265 * 266 */ 267 uint32_t mTxDataPoll; 268 269 /** 270 * The total number of unique MAC Beacon frame transmission requests. 271 * 272 */ 273 uint32_t mTxBeacon; 274 275 /** 276 * The total number of unique MAC Beacon Request frame transmission requests. 277 * 278 */ 279 uint32_t mTxBeaconRequest; 280 281 /** 282 * The total number of unique other MAC frame transmission requests. 283 * 284 * This counter is currently unused. 285 * 286 */ 287 uint32_t mTxOther; 288 289 /** 290 * The total number of MAC retransmission attempts. 291 * 292 * Note that this counter is incremented by one for each retransmission attempt that may be 293 * triggered by lack of acknowledgement, CSMA/CA failure, or other type of transmission error. 294 * The @p mTxRetry counter is incremented both for unicast and broadcast MAC frames. 295 * 296 * Check the following configuration parameters to control the amount of retransmissions in the system: 297 * @sa OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_DIRECT 298 * @sa OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_INDIRECT 299 * @sa OPENTHREAD_CONFIG_MAC_TX_NUM_BCAST 300 * @sa OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_DIRECT 301 * @sa OPENTHREAD_CONFIG_MAC_MAX_CSMA_BACKOFFS_INDIRECT 302 * 303 * Currently, this counter is invalid if the platform's radio driver capability includes 304 * @sa OT_RADIO_CAPS_TRANSMIT_RETRIES. 305 * 306 */ 307 uint32_t mTxRetry; 308 309 /** 310 * The total number of unique MAC transmission packets that meet maximal retry limit for direct packets. 311 * 312 */ 313 uint32_t mTxDirectMaxRetryExpiry; 314 315 /** 316 * The total number of unique MAC transmission packets that meet maximal retry limit for indirect packets. 317 * 318 */ 319 uint32_t mTxIndirectMaxRetryExpiry; 320 321 /** 322 * The total number of CCA failures. 323 * 324 * The meaning of this counter can be different and it depends on the platform's radio driver capabilities. 325 * 326 * If @sa OT_RADIO_CAPS_CSMA_BACKOFF is enabled, this counter represents the total number of full CSMA/CA 327 * failed attempts and it is incremented by one also for each retransmission (in case of a CSMA/CA fail). 328 * 329 * If @sa OT_RADIO_CAPS_TRANSMIT_RETRIES is enabled, this counter represents the total number of full CSMA/CA 330 * failed attempts and it is incremented by one for each individual data frame request (regardless of the amount of 331 * retransmissions). 332 * 333 */ 334 uint32_t mTxErrCca; 335 336 /** 337 * The total number of unique MAC transmission request failures cause by an abort error. 338 * 339 */ 340 uint32_t mTxErrAbort; 341 342 /** 343 * The total number of unique MAC transmission requests failures caused by a busy channel (a CSMA/CA fail). 344 * 345 */ 346 uint32_t mTxErrBusyChannel; 347 348 /** 349 * The total number of received frames. 350 * 351 * This counter counts all frames reported by the platform's radio driver, including frames 352 * that were dropped, for example because of an FCS error. 353 * 354 */ 355 uint32_t mRxTotal; 356 357 /** 358 * The total number of unicast frames received. 359 * 360 */ 361 uint32_t mRxUnicast; 362 363 /** 364 * The total number of broadcast frames received. 365 * 366 */ 367 uint32_t mRxBroadcast; 368 369 /** 370 * The total number of MAC Data frames received. 371 * 372 */ 373 uint32_t mRxData; 374 375 /** 376 * The total number of MAC Data Poll frames received. 377 * 378 */ 379 uint32_t mRxDataPoll; 380 381 /** 382 * The total number of MAC Beacon frames received. 383 * 384 */ 385 uint32_t mRxBeacon; 386 387 /** 388 * The total number of MAC Beacon Request frames received. 389 * 390 */ 391 uint32_t mRxBeaconRequest; 392 393 /** 394 * The total number of other types of frames received. 395 * 396 */ 397 uint32_t mRxOther; 398 399 /** 400 * The total number of frames dropped by MAC Filter module, for example received from denylisted node. 401 * 402 */ 403 uint32_t mRxAddressFiltered; 404 405 /** 406 * The total number of frames dropped by destination address check, for example received frame for other node. 407 * 408 */ 409 uint32_t mRxDestAddrFiltered; 410 411 /** 412 * The total number of frames dropped due to duplication, that is when the frame has been already received. 413 * 414 * This counter may be incremented, for example when ACK frame generated by the receiver hasn't reached 415 * transmitter node which performed retransmission. 416 * 417 */ 418 uint32_t mRxDuplicated; 419 420 /** 421 * The total number of frames dropped because of missing or malformed content. 422 * 423 */ 424 uint32_t mRxErrNoFrame; 425 426 /** 427 * The total number of frames dropped due to unknown neighbor. 428 * 429 */ 430 uint32_t mRxErrUnknownNeighbor; 431 432 /** 433 * The total number of frames dropped due to invalid source address. 434 * 435 */ 436 uint32_t mRxErrInvalidSrcAddr; 437 438 /** 439 * The total number of frames dropped due to security error. 440 * 441 * This counter may be incremented, for example when lower than expected Frame Counter is used 442 * to encrypt the frame. 443 * 444 */ 445 uint32_t mRxErrSec; 446 447 /** 448 * The total number of frames dropped due to invalid FCS. 449 * 450 */ 451 uint32_t mRxErrFcs; 452 453 /** 454 * The total number of frames dropped due to other error. 455 * 456 */ 457 uint32_t mRxErrOther; 458 }; 459 460 struct IpCounters 461 { 462 uint32_t mTxSuccess; ///< The number of IPv6 packets successfully transmitted. 463 uint32_t mRxSuccess; ///< The number of IPv6 packets successfully received. 464 uint32_t mTxFailure; ///< The number of IPv6 packets failed to transmit. 465 uint32_t mRxFailure; ///< The number of IPv6 packets failed to receive. 466 }; 467 468 struct ChannelQuality 469 { 470 uint8_t mChannel; 471 uint16_t mOccupancy; 472 }; 473 474 struct ChildInfo 475 { 476 uint64_t mExtAddress; ///< IEEE 802.15.4 Extended Address 477 uint32_t mTimeout; ///< Timeout 478 uint32_t mAge; ///< Time last heard 479 uint16_t mRloc16; ///< RLOC16 480 uint16_t mChildId; ///< Child ID 481 uint8_t mNetworkDataVersion; ///< Network Data Version 482 uint8_t mLinkQualityIn; ///< Link Quality In 483 int8_t mAverageRssi; ///< Average RSSI 484 int8_t mLastRssi; ///< Last observed RSSI 485 uint16_t mFrameErrorRate; ///< Frame error rate (0xffff->100%). Requires error tracking feature. 486 uint16_t mMessageErrorRate; ///< (IPv6) msg error rate (0xffff->100%). Requires error tracking feature. 487 bool mRxOnWhenIdle; ///< rx-on-when-idle 488 bool mFullThreadDevice; ///< Full Thread Device 489 bool mFullNetworkData; ///< Full Network Data 490 bool mIsStateRestoring; ///< Is in restoring state 491 }; 492 493 struct NeighborInfo 494 { 495 uint64_t mExtAddress; ///< IEEE 802.15.4 Extended Address 496 uint32_t mAge; ///< Time last heard 497 uint16_t mRloc16; ///< RLOC16 498 uint32_t mLinkFrameCounter; ///< Link Frame Counter 499 uint32_t mMleFrameCounter; ///< MLE Frame Counter 500 uint8_t mLinkQualityIn; ///< Link Quality In 501 int8_t mAverageRssi; ///< Average RSSI 502 int8_t mLastRssi; ///< Last observed RSSI 503 uint16_t mFrameErrorRate; ///< Frame error rate (0xffff->100%). Requires error tracking feature. 504 uint16_t mMessageErrorRate; ///< (IPv6) msg error rate (0xffff->100%). Requires error tracking feature. 505 uint16_t mVersion; ///< Thread version of the neighbor 506 bool mRxOnWhenIdle; ///< rx-on-when-idle 507 bool mFullThreadDevice; ///< Full Thread Device 508 bool mFullNetworkData; ///< Full Network Data 509 bool mIsChild; ///< Is the neighbor a child 510 }; 511 512 struct LeaderData 513 { 514 uint32_t mPartitionId; ///< Partition ID 515 uint8_t mWeighting; ///< Leader Weight 516 uint8_t mDataVersion; ///< Full Network Data Version 517 uint8_t mStableDataVersion; ///< Stable Network Data Version 518 uint8_t mLeaderRouterId; ///< Leader Router ID 519 }; 520 521 struct TxtEntry 522 { 523 std::string mKey; 524 std::vector<uint8_t> mValue; 525 }; 526 527 enum SrpServerState : uint8_t 528 { 529 OTBR_SRP_SERVER_STATE_DISABLED = 0, ///< The SRP server is disabled. 530 OTBR_SRP_SERVER_STATE_RUNNING = 1, ///< The SRP server is running. 531 OTBR_SRP_SERVER_STATE_STOPPED = 2, ///< The SRP server is stopped. 532 }; 533 534 enum SrpServerAddressMode : uint8_t 535 { 536 OTBR_SRP_SERVER_ADDRESS_MODE_UNICAST = 0, ///< Unicast address mode. 537 OTBR_SRP_SERVER_ADDRESS_MODE_ANYCAST = 1, ///< Anycast address mode. 538 }; 539 540 struct SrpServerInfo 541 { 542 struct Registration 543 { 544 uint32_t mFreshCount; ///< The number of active hosts/services registered on the SRP server 545 uint32_t mDeletedCount; ///< The number of hosts/services in 'Deleted' state on the SRP server 546 uint64_t mLeaseTimeTotal; ///< The sum of lease time in milliseconds of all active hosts/services 547 ///< on the SRP server 548 uint64_t mKeyLeaseTimeTotal; ///< The sum of key lease time in milliseconds of all active hosts/services on the 549 ///< SRP server 550 uint64_t mRemainingLeaseTimeTotal; ///< The sum of remaining lease time in milliseconds of all active 551 ///< hosts/services on the SRP server 552 uint64_t mRemainingKeyLeaseTimeTotal; ///< The sum of remaining key lease time in milliseconds of all active 553 ///< hosts/services on the SRP server 554 }; 555 556 struct ResponseCounters 557 { 558 uint32_t mSuccess; ///< The number of successful responses 559 uint32_t mServerFailure; ///< The number of server failure responses 560 uint32_t mFormatError; ///< The number of format error responses 561 uint32_t mNameExists; ///< The number of 'name exists' responses 562 uint32_t mRefused; ///< The number of refused responses 563 uint32_t mOther; ///< The number of other responses 564 }; 565 566 SrpServerState mState; ///< The state of the SRP server 567 uint16_t mPort; ///< The listening port number 568 SrpServerAddressMode mAddressMode; ///< The address mode {unicast, anycast} of the SRP server 569 Registration mHosts; ///< The registration information of hosts on the SRP server 570 Registration mServices; ///< The registration information of services on the SRP server 571 ResponseCounters mResponseCounters; ///< The counters of response codes sent by the SRP server 572 }; 573 574 struct DnssdCounters 575 { 576 uint32_t mSuccessResponse; ///< The number of successful responses 577 uint32_t mServerFailureResponse; ///< The number of server failure responses 578 uint32_t mFormatErrorResponse; ///< The number of format error responses 579 uint32_t mNameErrorResponse; ///< The number of name error responses 580 uint32_t mNotImplementedResponse; ///< The number of 'not implemented' responses 581 uint32_t mOtherResponse; ///< The number of other responses 582 583 uint32_t mResolvedBySrp; ///< The number of queries completely resolved by the local SRP server 584 }; 585 586 struct RadioSpinelMetrics 587 { 588 uint32_t mRcpTimeoutCount; ///< The number of RCP timeouts. 589 uint32_t mRcpUnexpectedResetCount; ///< The number of RCP unexcepted resets. 590 uint32_t mRcpRestorationCount; ///< The number of RCP restorations. 591 uint32_t mSpinelParseErrorCount; ///< The number of spinel frame parse errors. 592 }; 593 594 struct RcpInterfaceMetrics 595 { 596 uint8_t mRcpInterfaceType; ///< The RCP interface type. 597 uint64_t mTransferredFrameCount; ///< The number of transferred frames. 598 uint64_t mTransferredValidFrameCount; ///< The number of transferred valid frames. 599 uint64_t mTransferredGarbageFrameCount; ///< The number of transferred garbage frames. 600 uint64_t mRxFrameCount; ///< The number of received frames. 601 uint64_t mRxFrameByteCount; ///< The number of received bytes. 602 uint64_t mTxFrameCount; ///< The number of transmitted frames. 603 uint64_t mTxFrameByteCount; ///< The number of transmitted bytes. 604 }; 605 606 struct RadioCoexMetrics 607 { 608 uint32_t mNumGrantGlitch; ///< Number of grant glitches. 609 uint32_t mNumTxRequest; ///< Number of tx requests. 610 uint32_t mNumTxGrantImmediate; ///< Number of tx requests while grant was active. 611 uint32_t mNumTxGrantWait; ///< Number of tx requests while grant was inactive. 612 uint32_t mNumTxGrantWaitActivated; ///< Number of tx requests while grant was inactive that were ultimately granted. 613 uint32_t mNumTxGrantWaitTimeout; ///< Number of tx requests while grant was inactive that timed out. 614 uint32_t mNumTxGrantDeactivatedDuringRequest; ///< Number of tx that were in progress when grant was deactivated. 615 uint32_t mNumTxDelayedGrant; ///< Number of tx requests that were not granted within 50us. 616 uint32_t mAvgTxRequestToGrantTime; ///< Average time in usec from tx request to grant. 617 uint32_t mNumRxRequest; ///< Number of rx requests. 618 uint32_t mNumRxGrantImmediate; ///< Number of rx requests while grant was active. 619 uint32_t mNumRxGrantWait; ///< Number of rx requests while grant was inactive. 620 uint32_t mNumRxGrantWaitActivated; ///< Number of rx requests while grant was inactive that were ultimately granted. 621 uint32_t mNumRxGrantWaitTimeout; ///< Number of rx requests while grant was inactive that timed out. 622 uint32_t mNumRxGrantDeactivatedDuringRequest; ///< Number of rx that were in progress when grant was deactivated. 623 uint32_t mNumRxDelayedGrant; ///< Number of rx requests that were not granted within 50us. 624 uint32_t mAvgRxRequestToGrantTime; ///< Average time in usec from rx request to grant. 625 uint32_t mNumRxGrantNone; ///< Number of rx requests that completed without receiving grant. 626 bool mStopped; ///< Stats collection stopped due to saturation. 627 }; 628 629 struct BorderRoutingCounters 630 { 631 struct PacketsAndBytes 632 { 633 uint64_t mPackets; ///< The number of packets. 634 uint64_t mBytes; ///< The number of bytes. 635 }; 636 637 PacketsAndBytes mInboundUnicast; ///< The counters for inbound unicast. 638 PacketsAndBytes mInboundMulticast; ///< The counters for inbound multicast. 639 PacketsAndBytes mOutboundUnicast; ///< The counters for outbound unicast. 640 PacketsAndBytes mOutboundMulticast; ///< The counters for outbound multicast. 641 uint32_t mRaRx; ///< The number of received RA packets. 642 uint32_t mRaTxSuccess; ///< The number of RA packets successfully transmitted. 643 uint32_t mRaTxFailure; ///< The number of RA packets failed to transmit. 644 uint32_t mRsRx; ///< The number of received RS packets. 645 uint32_t mRsTxSuccess; ///< The number of RS packets successfully transmitted. 646 uint32_t mRsTxFailure; ///< The number of RS packets failed to transmit. 647 }; 648 649 struct Nat64ComponentState 650 { 651 std::string mPrefixManagerState; 652 std::string mTranslatorState; 653 }; 654 655 struct Nat64TrafficCounters 656 { 657 uint64_t m4To6Packets; ///< Number of packets translated from IPv4 to IPv6. 658 uint64_t m4To6Bytes; ///< Sum of size of packets translated from IPv4 to IPv6. 659 uint64_t m6To4Packets; ///< Number of packets translated from IPv6 to IPv4. 660 uint64_t m6To4Bytes; ///< Sum of size of packets translated from IPv6 to IPv4. 661 }; 662 663 struct Nat64PacketCounters 664 { 665 uint64_t m4To6Packets; ///< Number of packets translated from IPv4 to IPv6. 666 uint64_t m6To4Packets; ///< Number of packets translated from IPv6 to IPv4. 667 }; 668 669 struct Nat64ProtocolCounters 670 { 671 Nat64TrafficCounters mTotal; ///< Counters for sum of all protocols. 672 Nat64TrafficCounters mIcmp; ///< Counters for ICMP and ICMPv6. 673 Nat64TrafficCounters mUdp; ///< Counters for UDP. 674 Nat64TrafficCounters mTcp; ///< Counters for TCP. 675 }; 676 677 struct Nat64AddressMapping 678 { 679 uint64_t mId; ///< The unique id for a mapping session. 680 Ip4Address mIp4; ///< The IPv4 address of the mapping. 681 Ip6Address mIp6; ///< The IPv6 address of the mapping. 682 uint32_t mRemainingTimeMs; ///< Remaining time before expiry in milliseconds. 683 684 Nat64ProtocolCounters mCounters; 685 }; 686 687 struct Nat64ErrorCounters 688 { 689 Nat64PacketCounters mUnknown; ///< Packet drop for unknown reasons. 690 Nat64PacketCounters mIllegalPacket; ///< Packet drop due to failed to parse the datagram. 691 Nat64PacketCounters mUnsupportedProto; ///< Packet drop due to unsupported IP protocol. 692 Nat64PacketCounters mNoMapping; ///< Packet drop due to no mappings found or mapping pool exhausted. 693 }; 694 695 struct InfraLinkInfo 696 { 697 std::string mName; ///< The name of the infrastructure network interface. 698 bool mIsUp; ///< Whether the infrastructure network interface is up. 699 bool mIsRunning; ///< Whether the infrastructure network interface is running. 700 bool mIsMulticast; ///< Whether the infrastructure network interface is multicast. 701 uint32_t mLinkLocalAddresses; ///< The number of link-local addresses on the infra network interface. 702 uint32_t mUniqueLocalAddresses; ///< The number of unique local addresses on the infra network interface. 703 uint32_t mGlobalUnicastAddresses; ///< The number of global unicast addresses on the infra network interface. 704 }; 705 706 struct TrelInfo 707 { 708 struct TrelPacketCounters 709 { 710 uint64_t mTxPackets; ///< Number of packets transmitted through TREL. 711 uint64_t mTxBytes; ///< Sum of size of packets transmitted through TREL. 712 uint64_t mTxFailure; ///< Number of packet transmission failures through TREL. 713 uint64_t mRxPackets; ///< Number of packets received through TREL. 714 uint64_t mRxBytes; ///< Sum of size of packets received through TREL. 715 }; 716 717 bool mEnabled; ///< Whether TREL is enabled. 718 u_int16_t mNumTrelPeers; ///< The number of TREL peers. 719 TrelPacketCounters mTrelCounters; ///< The TREL counters. 720 }; 721 722 } // namespace DBus 723 } // namespace otbr 724 725 #endif // OTBR_DBUS_COMMON_TYPES_HPP_ 726