1 // Copyright (c) 2017 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 QUICHE_QUIC_PLATFORM_API_QUIC_TEST_LOOPBACK_H_ 6 #define QUICHE_QUIC_PLATFORM_API_QUIC_TEST_LOOPBACK_H_ 7 8 #include "quiche/quic/platform/api/quic_ip_address.h" 9 #include "quiche/quic/platform/api/quic_ip_address_family.h" 10 #include "quiche/common/platform/api/quiche_test_loopback.h" 11 12 namespace quic { 13 14 // Returns the address family (IPv4 or IPv6) used to run test under. AddressFamilyUnderTest()15inline IpAddressFamily AddressFamilyUnderTest() { 16 return quiche::AddressFamilyUnderTest(); 17 } 18 19 // Returns an IPv4 loopback address. TestLoopback4()20inline QuicIpAddress TestLoopback4() { return quiche::TestLoopback4(); } 21 22 // Returns the only IPv6 loopback address. TestLoopback6()23inline QuicIpAddress TestLoopback6() { return quiche::TestLoopback6(); } 24 25 // Returns an appropriate IPv4/Ipv6 loopback address based upon whether the 26 // test's environment. TestLoopback()27inline QuicIpAddress TestLoopback() { return quiche::TestLoopback(); } 28 29 // If address family under test is IPv4, returns an indexed IPv4 loopback 30 // address. If address family under test is IPv6, the address returned is 31 // platform-dependent. TestLoopback(int index)32inline QuicIpAddress TestLoopback(int index) { 33 return quiche::TestLoopback(index); 34 } 35 36 } // namespace quic 37 38 #endif // QUICHE_QUIC_PLATFORM_API_QUIC_TEST_LOOPBACK_H_ 39