1 // Copyright 2018 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef OSP_PUBLIC_SERVICE_INFO_H_ 6 #define OSP_PUBLIC_SERVICE_INFO_H_ 7 8 #include <cstdint> 9 #include <string> 10 11 #include "platform/api/network_interface.h" 12 #include "platform/base/ip_address.h" 13 14 namespace openscreen { 15 namespace osp { 16 17 // This contains canonical information about a specific Open Screen service 18 // found on the network via our discovery mechanism (mDNS). 19 struct ServiceInfo { 20 ServiceInfo() = default; 21 ServiceInfo(ServiceInfo&&) noexcept = default; 22 ServiceInfo(const ServiceInfo&) = default; 23 24 ServiceInfo& operator=(ServiceInfo&&) = default; 25 ServiceInfo& operator=(const ServiceInfo&) = default; 26 27 bool operator==(const ServiceInfo& other) const; 28 bool operator!=(const ServiceInfo& other) const; 29 30 bool Update(std::string friendly_name, 31 NetworkInterfaceIndex network_interface_index, 32 const IPEndpoint& v4_endpoint, 33 const IPEndpoint& v6_endpoint); 34 35 // Identifier uniquely identifying the Open Screen service. 36 std::string service_id; 37 38 // User visible name of the Open Screen service in UTF-8. 39 std::string friendly_name; 40 41 // The index of the network interface that the screen was discovered on. 42 NetworkInterfaceIndex network_interface_index = kInvalidNetworkInterfaceIndex; 43 44 // The network endpoints to create a new connection to the Open Screen 45 // service. 46 IPEndpoint v4_endpoint; 47 IPEndpoint v6_endpoint; 48 }; 49 50 } // namespace osp 51 } // namespace openscreen 52 53 #endif // OSP_PUBLIC_SERVICE_INFO_H_ 54