1 // Copyright 2019 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 #include "discovery/dnssd/impl/network_interface_config.h" 6 7 namespace openscreen { 8 namespace discovery { 9 NetworkInterfaceConfig(NetworkInterfaceIndex network_interface,IPAddress address_v4,IPAddress address_v6)10NetworkInterfaceConfig::NetworkInterfaceConfig( 11 NetworkInterfaceIndex network_interface, 12 IPAddress address_v4, 13 IPAddress address_v6) 14 : network_interface_(network_interface), 15 address_v4_(address_v4), 16 address_v6_(address_v6) {} 17 18 NetworkInterfaceConfig::NetworkInterfaceConfig() = default; 19 20 NetworkInterfaceConfig::~NetworkInterfaceConfig() = default; 21 HasAddressV4() const22bool NetworkInterfaceConfig::HasAddressV4() const { 23 return address_v4_ ? true : false; 24 } 25 HasAddressV6() const26bool NetworkInterfaceConfig::HasAddressV6() const { 27 return address_v6_ ? true : false; 28 } 29 GetAddress() const30const IPAddress& NetworkInterfaceConfig::GetAddress() const { 31 return HasAddressV4() ? address_v4_ : address_v6_; 32 } 33 34 } // namespace discovery 35 } // namespace openscreen 36