Avi Drissman | 6459548 | 2022-09-14 20:52:29 | [diff] [blame^] | 1 | // Copyright 2021 The Chromium Authors |
Eric Orth | d39d067 | 2021-11-16 21:17:58 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Yoichiro Hibara | 4d2c1dcbb5 | 2022-09-05 23:56:47 | [diff] [blame] | 5 | #ifndef NET_DNS_PUBLIC_HOST_RESOLVER_RESULTS_H_ |
| 6 | #define NET_DNS_PUBLIC_HOST_RESOLVER_RESULTS_H_ |
Eric Orth | d39d067 | 2021-11-16 21:17:58 | [diff] [blame] | 7 | |
| 8 | #include <string> |
Eric Orth | c869186e | 2022-01-11 00:18:43 | [diff] [blame] | 9 | #include <tuple> |
Eric Orth | d39d067 | 2021-11-16 21:17:58 | [diff] [blame] | 10 | #include <vector> |
| 11 | |
| 12 | #include "net/base/connection_endpoint_metadata.h" |
| 13 | #include "net/base/ip_endpoint.h" |
| 14 | #include "net/base/net_export.h" |
| 15 | |
| 16 | namespace net { |
| 17 | |
| 18 | // Host-resolution-result representation of a single endpoint and the |
| 19 | // information necessary to attempt a connection to that endpoint. |
| 20 | struct NET_EXPORT_PRIVATE HostResolverEndpointResult { |
| 21 | HostResolverEndpointResult(); |
| 22 | ~HostResolverEndpointResult(); |
| 23 | |
| 24 | HostResolverEndpointResult(const HostResolverEndpointResult&); |
| 25 | HostResolverEndpointResult& operator=(const HostResolverEndpointResult&) = |
| 26 | default; |
| 27 | HostResolverEndpointResult(HostResolverEndpointResult&&); |
| 28 | HostResolverEndpointResult& operator=(HostResolverEndpointResult&&) = default; |
| 29 | |
Eric Orth | c869186e | 2022-01-11 00:18:43 | [diff] [blame] | 30 | bool operator==(const HostResolverEndpointResult& other) const { |
| 31 | return std::tie(ip_endpoints, metadata) == |
| 32 | std::tie(other.ip_endpoints, other.metadata); |
| 33 | } |
| 34 | bool operator!=(const HostResolverEndpointResult& other) const { |
| 35 | return !(*this == other); |
| 36 | } |
| 37 | |
Eric Orth | 92c0771 | 2021-12-02 17:54:58 | [diff] [blame] | 38 | // IP endpoints at which to connect to the service. |
| 39 | std::vector<net::IPEndPoint> ip_endpoints; |
Eric Orth | d39d067 | 2021-11-16 21:17:58 | [diff] [blame] | 40 | |
Eric Orth | d39d067 | 2021-11-16 21:17:58 | [diff] [blame] | 41 | // Additional metadata for creating connections to the endpoint. Typically |
| 42 | // sourced from DNS HTTPS records. |
| 43 | ConnectionEndpointMetadata metadata; |
| 44 | }; |
| 45 | |
Yoichiro Hibara | cf4081df | 2022-09-12 13:15:42 | [diff] [blame] | 46 | using HostResolverEndpointResults = |
| 47 | std::vector<net::HostResolverEndpointResult>; |
| 48 | |
Eric Orth | d39d067 | 2021-11-16 21:17:58 | [diff] [blame] | 49 | } // namespace net |
| 50 | |
Yoichiro Hibara | 4d2c1dcbb5 | 2022-09-05 23:56:47 | [diff] [blame] | 51 | #endif // NET_DNS_PUBLIC_HOST_RESOLVER_RESULTS_H_ |