Andrei Litvin | 00b522f | 2023-06-13 11:32:16 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2023 Project CHIP Authors |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | * you may not use this file except in compliance with the License. |
| 7 | * You may obtain a copy of the License at |
| 8 | * |
| 9 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | * |
| 11 | * Unless required by applicable law or agreed to in writing, software |
| 12 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | * See the License for the specific language governing permissions and |
| 15 | * limitations under the License. |
| 16 | */ |
| 17 | #pragma once |
| 18 | |
| 19 | #include <lib/address_resolve/AddressResolve.h> |
| 20 | #include <tracing/log_declares.h> |
| 21 | |
| 22 | namespace chip { |
| 23 | namespace Tracing { |
| 24 | |
| 25 | /// Concrete definitions of the DNSSD tracing info that the address resolver will |
| 26 | /// report. |
| 27 | |
| 28 | /// A node lookup has been requested |
| 29 | struct NodeLookupInfo |
| 30 | { |
| 31 | const chip::AddressResolve::NodeLookupRequest * request; // request for node lookup |
| 32 | }; |
| 33 | |
| 34 | enum class DiscoveryInfoType |
| 35 | { |
| 36 | kIntermediateResult = 0, // Received intermediate address data |
| 37 | kResolutionDone = 1, // resolution completed |
| 38 | kRetryDifferent = 2, // Try a different/new IP address |
| 39 | }; |
| 40 | |
| 41 | /// A node was discovered and we have information about it. |
| 42 | struct NodeDiscoveredInfo |
| 43 | { |
| 44 | DiscoveryInfoType type; // separate callbacks depending on state |
| 45 | const PeerId * peerId; // what peer was discovered |
| 46 | const chip::AddressResolve::ResolveResult * result; // a SINGLE result representing the resolution |
| 47 | }; |
| 48 | |
| 49 | /// A node lookup failed / give up on this discovery |
| 50 | struct NodeDiscoveryFailedInfo |
| 51 | { |
| 52 | const PeerId * peerId; // what peer discovery failed |
| 53 | CHIP_ERROR error; // error that caused a failure |
| 54 | }; |
| 55 | |
| 56 | } // namespace Tracing |
| 57 | } // namespace chip |