/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
 * Copyright (c) 2013-2023 Regents of the University of California,
 *                         Arizona Board of Regents,
 *                         Colorado State University,
 *                         University Pierre & Marie Curie, Sorbonne University,
 *                         Washington University in St. Louis,
 *                         Beijing Institute of Technology,
 *                         The University of Memphis.
 *
 * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
 *
 * ndn-cxx library is free software: you can redistribute it and/or modify it under the
 * terms of the GNU Lesser General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later version.
 *
 * ndn-cxx library is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
 * PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more details.
 *
 * You should have received copies of the GNU General Public License and GNU Lesser
 * General Public License along with ndn-cxx, e.g., in COPYING.md file.  If not, see
 * <http://www.gnu.org/licenses/>.
 *
 * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
 */

#include "ndn-cxx/net/face-uri.hpp"
#include "ndn-cxx/net/network-interface.hpp"
#include "ndn-cxx/net/network-monitor.hpp"

#include "tests/boost-test.hpp"
#include "tests/unit/net/network-configuration-detector.hpp"

#include <boost/concept_check.hpp>

namespace ndn::tests {

BOOST_CONCEPT_ASSERT((boost::EqualityComparable<FaceUri>));
BOOST_CONCEPT_ASSERT((boost::Comparable<FaceUri>));

BOOST_AUTO_TEST_SUITE(Net)
BOOST_AUTO_TEST_SUITE(TestFaceUri)

class CanonizeFixture
{
protected:
  CanonizeFixture()
  {
    static const auto netifs = [this] {
      net::NetworkMonitor netmon(m_io);
      if (netmon.getCapabilities() & net::NetworkMonitor::CAP_ENUM) {
        netmon.onEnumerationCompleted.connect([this] { m_io.stop(); });
        m_io.run();
        m_io.restart();
      }
      return netmon.listNetworkInterfaces();
    }();

    if (!netifs.empty()) {
      m_netif = netifs.front();
    }
  }

  void
  runTest(const std::string& request, bool shouldSucceed, const std::string& expectedUri = "")
  {
    BOOST_TEST_CONTEXT(std::quoted(request) << " should " << (shouldSucceed ? "succeed" : "fail")) {
      bool didInvokeCb = false;
      FaceUri uri(request);
      uri.canonize(
        [&] (const FaceUri& canonicalUri) {
          BOOST_CHECK_EQUAL(didInvokeCb, false);
          didInvokeCb = true;
          BOOST_CHECK_EQUAL(shouldSucceed, true);
          if (shouldSucceed) {
            BOOST_CHECK_EQUAL(canonicalUri.toString(), expectedUri);
          }
        },
        [&] (const std::string&) {
          BOOST_CHECK_EQUAL(didInvokeCb, false);
          didInvokeCb = true;
          BOOST_CHECK_EQUAL(shouldSucceed, false);
        },
        m_io, 30_s);

      m_io.run();
      BOOST_CHECK_EQUAL(didInvokeCb, true);
      m_io.restart();
    }
  }

protected:
  shared_ptr<const net::NetworkInterface> m_netif;

private:
  boost::asio::io_context m_io;
};

BOOST_AUTO_TEST_CASE(ParseInternal)
{
  FaceUri uri;

  BOOST_CHECK(uri.parse("internal://"));
  BOOST_CHECK_EQUAL(uri.getScheme(), "internal");
  BOOST_CHECK_EQUAL(uri.getHost(), "");
  BOOST_CHECK_EQUAL(uri.getPort(), "");
  BOOST_CHECK_EQUAL(uri.getPath(), "");

  BOOST_CHECK_EQUAL(uri.parse("internal:"), false);
  BOOST_CHECK_EQUAL(uri.parse("internal:/"), false);
}

BOOST_AUTO_TEST_CASE(ParseUdp)
{
  FaceUri uri("udp://hostname:6363");
  BOOST_CHECK_THROW(FaceUri("udp//hostname:6363"), FaceUri::Error);
  BOOST_CHECK_THROW(FaceUri("udp://hostname:port"), FaceUri::Error);

  BOOST_CHECK_EQUAL(uri.parse("udp//hostname:6363"), false);

  BOOST_CHECK(uri.parse("udp://hostname:80"));
  BOOST_CHECK_EQUAL(uri.getScheme(), "udp");
  BOOST_CHECK_EQUAL(uri.getHost(), "hostname");
  BOOST_CHECK_EQUAL(uri.getPort(), "80");
  BOOST_CHECK_EQUAL(uri.getPath(), "");

  BOOST_CHECK(uri.parse("udp4://192.0.2.1:20"));
  BOOST_CHECK_EQUAL(uri.getScheme(), "udp4");
  BOOST_CHECK_EQUAL(uri.getHost(), "192.0.2.1");
  BOOST_CHECK_EQUAL(uri.getPort(), "20");
  BOOST_CHECK_EQUAL(uri.getPath(), "");

  BOOST_CHECK(uri.parse("udp6://[2001:db8:3f9:0::1]:6363"));
  BOOST_CHECK_EQUAL(uri.getScheme(), "udp6");
  BOOST_CHECK_EQUAL(uri.getHost(), "2001:db8:3f9:0::1");
  BOOST_CHECK_EQUAL(uri.getPort(), "6363");
  BOOST_CHECK_EQUAL(uri.getPath(), "");

  BOOST_CHECK(uri.parse("udp6://[2001:db8:3f9:0:3025:ccc5:eeeb:86d3]:6363"));
  BOOST_CHECK_EQUAL(uri.getScheme(), "udp6");
  BOOST_CHECK_EQUAL(uri.getHost(), "2001:db8:3f9:0:3025:ccc5:eeeb:86d3");
  BOOST_CHECK_EQUAL(uri.getPort(), "6363");
  BOOST_CHECK_EQUAL(uri.getPath(), "");

  BOOST_CHECK_EQUAL(uri.parse("udp6://[2001:db8:3f9:0:3025:ccc5:eeeb:86dg]:6363"), false);

  namespace ip = boost::asio::ip;

  ip::udp::endpoint endpoint4(ip::make_address_v4("192.0.2.1"), 7777);
  uri = FaceUri(endpoint4);
  BOOST_CHECK_EQUAL(uri.toString(), "udp4://192.0.2.1:7777");

  ip::udp::endpoint endpoint6(ip::make_address_v6("2001:DB8::1"), 7777);
  uri = FaceUri(endpoint6);
  BOOST_CHECK_EQUAL(uri.toString(), "udp6://[2001:db8::1]:7777");

  BOOST_CHECK(uri.parse("udp6://[fe80::1%25eth1]:6363"));
  BOOST_CHECK_EQUAL(uri.getHost(), "fe80::1%25eth1");

  BOOST_CHECK(uri.parse("udp6://[fe80::1%eth1]:6363"));
  BOOST_CHECK_EQUAL(uri.getHost(), "fe80::1%eth1");

  BOOST_CHECK(uri.parse("udp6://[fe80::1%1]:6363"));
  BOOST_CHECK(uri.parse("udp6://[fe80::1%eth1]"));

  BOOST_CHECK(uri.parse("udp6://[ff01::114%eth#1]"));
  BOOST_CHECK(uri.parse("udp6://[ff01::114%eth.1,2]"));
  BOOST_CHECK(uri.parse("udp6://[ff01::114%a+b-c=0]"));
  BOOST_CHECK(uri.parse("udp6://[ff01::114%[foo]]"));
  BOOST_CHECK(uri.parse("udp6://[ff01::114%]]"));
  BOOST_CHECK(uri.parse("udp6://[ff01::114%%]"));
  BOOST_CHECK(!uri.parse("udp6://[ff01::114%]"));
  BOOST_CHECK(!uri.parse("udp6://[ff01::114%foo bar]"));
  BOOST_CHECK(!uri.parse("udp6://[ff01::114%foo/bar]"));
  BOOST_CHECK(!uri.parse("udp6://[ff01::114%eth0:1]"));
}

BOOST_FIXTURE_TEST_CASE(IsCanonicalUdp, CanonizeFixture)
{
  BOOST_CHECK_EQUAL(FaceUri::canCanonize("udp"), true);
  BOOST_CHECK_EQUAL(FaceUri::canCanonize("udp4"), true);
  BOOST_CHECK_EQUAL(FaceUri::canCanonize("udp6"), true);

  BOOST_CHECK_EQUAL(FaceUri("udp4://192.0.2.1:6363").isCanonical(), true);
  BOOST_CHECK_EQUAL(FaceUri("udp://192.0.2.1:6363").isCanonical(), false);
  BOOST_CHECK_EQUAL(FaceUri("udp4://192.0.2.1").isCanonical(), false);
  BOOST_CHECK_EQUAL(FaceUri("udp4://192.0.2.1:6363/").isCanonical(), false);
  BOOST_CHECK_EQUAL(FaceUri("udp6://[2001:db8::1]:6363").isCanonical(), true);
  BOOST_CHECK_EQUAL(FaceUri("udp6://[2001:db8::01]:6363").isCanonical(), false);
  BOOST_CHECK_EQUAL(FaceUri("udp://[2001:db8::1]:6363").isCanonical(), false);
  BOOST_CHECK_EQUAL(FaceUri("udp://example.net:6363").isCanonical(), false);
  BOOST_CHECK_EQUAL(FaceUri("udp4://example.net:6363").isCanonical(), false);
  BOOST_CHECK_EQUAL(FaceUri("udp6://example.net:6363").isCanonical(), false);
  BOOST_CHECK_EQUAL(FaceUri("udp4://224.0.23.170:56363").isCanonical(), true);
  BOOST_CHECK_EQUAL(FaceUri("udp4://[2001:db8::1]:6363").isCanonical(), false);
  BOOST_CHECK_EQUAL(FaceUri("udp6://192.0.2.1:6363").isCanonical(), false);

  if (m_netif) {
    auto name = m_netif->getName();
    auto index = to_string(m_netif->getIndex());

    BOOST_CHECK_EQUAL(FaceUri("udp6://[fe80::1%" + name + "]:6363").isCanonical(), true);
    BOOST_CHECK_EQUAL(FaceUri("udp6://[fe80::1%" + index + "]:6363").isCanonical(), false);
    BOOST_CHECK_EQUAL(FaceUri("udp6://[fe80::1%" + name + "]").isCanonical(), false);
    BOOST_CHECK_EQUAL(FaceUri("udp6://[fe80::1068:dddb:fe26:fe3f%25en0]:6363").isCanonical(), false);
  }
}

BOOST_FIXTURE_TEST_CASE(CanonizeUdpV4, CanonizeFixture,
  * boost::unit_test::expected_failures(1))
{
  SKIP_IF_IPV4_UNAVAILABLE();

  // IPv4 unicast
  runTest("udp4://192.0.2.1:6363", true, "udp4://192.0.2.1:6363");
  runTest("udp://192.0.2.2:6363", true, "udp4://192.0.2.2:6363");
  runTest("udp4://192.0.2.3", true, "udp4://192.0.2.3:6363");
  runTest("udp4://192.0.2.4:6363/", true, "udp4://192.0.2.4:6363");
  runTest("udp4://192.0.2.5:9695", true, "udp4://192.0.2.5:9695");
  runTest("udp4://192.0.2.666:6363", false);
  runTest("udp4://192.0.2.7:99999", false); // Bug #3897
  runTest("udp4://google-public-dns-a.google.com", true, "udp4://8.8.8.8:6363");
  runTest("udp4://google-public-dns-a.google.com:70000", false);
  runTest("udp4://invalid.invalid.", false);
  runTest("udp://invalid.invalid.", false);

  // IPv4 multicast
  runTest("udp4://224.0.23.170:56363", true, "udp4://224.0.23.170:56363");
  runTest("udp4://224.0.23.170", true, "udp4://224.0.23.170:56363");
  runTest("udp4://all-routers.mcast.net:56363", true, "udp4://224.0.0.2:56363");
  runTest("udp://all-routers.mcast.net:56363", true, "udp4://224.0.0.2:56363");

  // IPv6 used with udp4 protocol - not canonical
  runTest("udp4://[2001:db8::1]:6363", false);
}

BOOST_FIXTURE_TEST_CASE(CanonizeUdpV6, CanonizeFixture,
  * boost::unit_test::expected_failures(1))
{
  SKIP_IF_IPV6_UNAVAILABLE();

  // IPv6 unicast
  runTest("udp6://[2001:db8::1]:6363", true, "udp6://[2001:db8::1]:6363");
  runTest("udp6://[2001:db8::1]", true, "udp6://[2001:db8::1]:6363");
  runTest("udp://[2001:db8::1]:6363", true, "udp6://[2001:db8::1]:6363");
  runTest("udp6://[2001:db8::01]:6363", true, "udp6://[2001:db8::1]:6363");
  runTest("udp6://[2001::db8::1]:6363", false);
  runTest("udp6://[2001:db8::1]:99999", false); // Bug #3897
  runTest("udp6://google-public-dns-a.google.com", true, "udp6://[2001:4860:4860::8888]:6363");
  runTest("udp6://google-public-dns-a.google.com:70000", false);
  runTest("udp6://invalid.invalid.", false);

  // IPv6 multicast
  runTest("udp6://[ff02::2]:56363", true, "udp6://[ff02::2]:56363");
  runTest("udp6://[ff02::2]", true, "udp6://[ff02::2]:56363");

  // IPv4 used with udp6 protocol - not canonical
  runTest("udp6://192.0.2.1:6363", false);

  if (m_netif) {
    auto name = m_netif->getName();
    auto index = to_string(m_netif->getIndex());

    runTest("udp6://[fe80::1068:dddb:fe26:fe3f%25" + name + "]:6363", true,
            "udp6://[fe80::1068:dddb:fe26:fe3f%" + name + "]:6363");

    runTest("udp6://[fe80::1068:dddb:fe26:fe3f%" + index + "]:6363", true,
            "udp6://[fe80::1068:dddb:fe26:fe3f%" + name + "]:6363");
  }
}

BOOST_AUTO_TEST_CASE(ParseTcp)
{
  FaceUri uri;

  BOOST_CHECK(uri.parse("tcp://random.host.name"));
  BOOST_CHECK_EQUAL(uri.getScheme(), "tcp");
  BOOST_CHECK_EQUAL(uri.getHost(), "random.host.name");
  BOOST_CHECK_EQUAL(uri.getPort(), "");
  BOOST_CHECK_EQUAL(uri.getPath(), "");

  BOOST_CHECK_EQUAL(uri.parse("tcp://192.0.2.1:"), false);
  BOOST_CHECK_EQUAL(uri.parse("tcp://[::zzzz]"), false);

  namespace ip = boost::asio::ip;

  ip::tcp::endpoint endpoint4(ip::make_address_v4("192.0.2.1"), 7777);
  uri = FaceUri(endpoint4);
  BOOST_CHECK_EQUAL(uri.toString(), "tcp4://192.0.2.1:7777");

  uri = FaceUri(endpoint4, "wsclient");
  BOOST_CHECK_EQUAL(uri.toString(), "wsclient://192.0.2.1:7777");

  ip::tcp::endpoint endpoint6(ip::make_address_v6("2001:DB8::1"), 7777);
  uri = FaceUri(endpoint6);
  BOOST_CHECK_EQUAL(uri.toString(), "tcp6://[2001:db8::1]:7777");

  BOOST_CHECK(uri.parse("tcp6://[fe80::1%25eth1]:6363"));
  BOOST_CHECK_EQUAL(uri.getHost(), "fe80::1%25eth1");

  BOOST_CHECK(uri.parse("tcp6://[fe80::1%eth1]:6363"));
  BOOST_CHECK_EQUAL(uri.getHost(), "fe80::1%eth1");

  BOOST_CHECK(uri.parse("tcp6://[fe80::1%1]:6363"));
  BOOST_CHECK(uri.parse("tcp6://[fe80::1%eth1]"));
}

BOOST_FIXTURE_TEST_CASE(IsCanonicalTcp, CanonizeFixture)
{
  BOOST_CHECK_EQUAL(FaceUri::canCanonize("tcp"), true);
  BOOST_CHECK_EQUAL(FaceUri::canCanonize("tcp4"), true);
  BOOST_CHECK_EQUAL(FaceUri::canCanonize("tcp6"), true);

  BOOST_CHECK_EQUAL(FaceUri("tcp4://192.0.2.1:6363").isCanonical(), true);
  BOOST_CHECK_EQUAL(FaceUri("tcp://192.0.2.1:6363").isCanonical(), false);
  BOOST_CHECK_EQUAL(FaceUri("tcp4://192.0.2.1").isCanonical(), false);
  BOOST_CHECK_EQUAL(FaceUri("tcp4://192.0.2.1:6363/").isCanonical(), false);
  BOOST_CHECK_EQUAL(FaceUri("tcp6://[2001:db8::1]:6363").isCanonical(), true);
  BOOST_CHECK_EQUAL(FaceUri("tcp6://[2001:db8::01]:6363").isCanonical(), false);
  BOOST_CHECK_EQUAL(FaceUri("tcp://[2001:db8::1]:6363").isCanonical(), false);
  BOOST_CHECK_EQUAL(FaceUri("tcp://example.net:6363").isCanonical(), false);
  BOOST_CHECK_EQUAL(FaceUri("tcp4://example.net:6363").isCanonical(), false);
  BOOST_CHECK_EQUAL(FaceUri("tcp6://example.net:6363").isCanonical(), false);
  BOOST_CHECK_EQUAL(FaceUri("tcp4://224.0.23.170:56363").isCanonical(), false);
  BOOST_CHECK_EQUAL(FaceUri("tcp4://[2001:db8::1]:6363").isCanonical(), false);
  BOOST_CHECK_EQUAL(FaceUri("tcp6://192.0.2.1:6363").isCanonical(), false);

  if (m_netif) {
    auto name = m_netif->getName();
    auto index = to_string(m_netif->getIndex());

    BOOST_CHECK_EQUAL(FaceUri("tcp6://[fe80::1%" + name + "]:6363").isCanonical(), true);
    BOOST_CHECK_EQUAL(FaceUri("tcp6://[fe80::1%" + index + "]:6363").isCanonical(), false);
    BOOST_CHECK_EQUAL(FaceUri("tcp6://[fe80::1%" + name + "]").isCanonical(), false);
    BOOST_CHECK_EQUAL(FaceUri("tcp6://[fe80::1068:dddb:fe26:fe3f%25en0]:6363").isCanonical(), false);
  }
}

BOOST_FIXTURE_TEST_CASE(CanonizeTcpV4, CanonizeFixture,
  * boost::unit_test::expected_failures(1))
{
  SKIP_IF_IPV4_UNAVAILABLE();

  // IPv4 unicast
  runTest("tcp4://192.0.2.1:6363", true, "tcp4://192.0.2.1:6363");
  runTest("tcp://192.0.2.2:6363", true, "tcp4://192.0.2.2:6363");
  runTest("tcp4://192.0.2.3", true, "tcp4://192.0.2.3:6363");
  runTest("tcp4://192.0.2.4:6363/", true, "tcp4://192.0.2.4:6363");
  runTest("tcp4://192.0.2.5:9695", true, "tcp4://192.0.2.5:9695");
  runTest("tcp4://192.0.2.666:6363", false);
  runTest("tcp4://192.0.2.7:99999", false); // Bug #3897
  runTest("tcp4://google-public-dns-a.google.com", true, "tcp4://8.8.8.8:6363");
  runTest("tcp4://google-public-dns-a.google.com:70000", false);
  runTest("tcp4://invalid.invalid.", false);
  runTest("tcp://invalid.invalid.", false);

  // IPv4 multicast
  runTest("tcp4://224.0.23.170:56363", false);
  runTest("tcp4://224.0.23.170", false);
  runTest("tcp4://all-routers.mcast.net:56363", false);
  runTest("tcp://all-routers.mcast.net:56363", false);

  // IPv6 used with tcp4 protocol - not canonical
  runTest("tcp4://[2001:db8::1]:6363", false);

  if (m_netif) {
    auto name = m_netif->getName();
    auto index = to_string(m_netif->getIndex());

    runTest("tcp6://[fe80::1068:dddb:fe26:fe3f%25" + name + "]:6363", true,
            "tcp6://[fe80::1068:dddb:fe26:fe3f%" + name + "]:6363");

    runTest("tcp6://[fe80::1068:dddb:fe26:fe3f%" + index + "]:6363", true,
            "tcp6://[fe80::1068:dddb:fe26:fe3f%" + name + "]:6363");
  }
}

BOOST_FIXTURE_TEST_CASE(CanonizeTcpV6, CanonizeFixture,
  * boost::unit_test::expected_failures(1))
{
  SKIP_IF_IPV6_UNAVAILABLE();

  // IPv6 unicast
  runTest("tcp6://[2001:db8::1]:6363", true, "tcp6://[2001:db8::1]:6363");
  runTest("tcp6://[2001:db8::1]", true, "tcp6://[2001:db8::1]:6363");
  runTest("tcp://[2001:db8::1]:6363", true, "tcp6://[2001:db8::1]:6363");
  runTest("tcp6://[2001:db8::01]:6363", true, "tcp6://[2001:db8::1]:6363");
  runTest("tcp6://[2001::db8::1]:6363", false);
  runTest("tcp6://[2001:db8::1]:99999", false); // Bug #3897
  runTest("tcp6://google-public-dns-a.google.com", true, "tcp6://[2001:4860:4860::8888]:6363");
  runTest("tcp6://google-public-dns-a.google.com:70000", false);
  runTest("tcp6://invalid.invalid.", false);

  // IPv6 multicast
  runTest("tcp6://[ff02::2]:56363", false);
  runTest("tcp6://[ff02::2]", false);

  // IPv4 used with tcp6 protocol - not canonical
  runTest("tcp6://192.0.2.1:6363", false);
}

BOOST_AUTO_TEST_CASE(ParseUnix,
  * boost::unit_test::expected_failures(1))
{
  FaceUri uri;

  BOOST_CHECK(uri.parse("unix:///var/run/example.sock"));
  BOOST_CHECK_EQUAL(uri.getScheme(), "unix");
  BOOST_CHECK_EQUAL(uri.getHost(), "");
  BOOST_CHECK_EQUAL(uri.getPort(), "");
  BOOST_CHECK_EQUAL(uri.getPath(), "/var/run/example.sock");

  // This is not a valid unix:// URI, but the parse would treat "var" as host
  BOOST_CHECK_EQUAL(uri.parse("unix://var/run/example.sock"), false); // Bug #3896

#ifdef BOOST_ASIO_HAS_LOCAL_SOCKETS
  using boost::asio::local::stream_protocol;
  stream_protocol::endpoint endpoint("/var/run/example.sock");
  uri = FaceUri(endpoint);
  BOOST_CHECK_EQUAL(uri.toString(), "unix:///var/run/example.sock");
#endif // BOOST_ASIO_HAS_LOCAL_SOCKETS
}

BOOST_AUTO_TEST_CASE(ParseFd)
{
  FaceUri uri;

  BOOST_CHECK(uri.parse("fd://6"));
  BOOST_CHECK_EQUAL(uri.getScheme(), "fd");
  BOOST_CHECK_EQUAL(uri.getHost(), "6");
  BOOST_CHECK_EQUAL(uri.getPort(), "");
  BOOST_CHECK_EQUAL(uri.getPath(), "");

  int fd = 21;
  uri = FaceUri::fromFd(fd);
  BOOST_CHECK_EQUAL(uri.toString(), "fd://21");
}

BOOST_AUTO_TEST_CASE(ParseEther)
{
  FaceUri uri;

  BOOST_CHECK(uri.parse("ether://[08:00:27:01:dd:01]"));
  BOOST_CHECK_EQUAL(uri.getScheme(), "ether");
  BOOST_CHECK_EQUAL(uri.getHost(), "08:00:27:01:dd:01");
  BOOST_CHECK_EQUAL(uri.getPort(), "");
  BOOST_CHECK_EQUAL(uri.getPath(), "");

  BOOST_CHECK_EQUAL(uri.parse("ether://[08:00:27:zz:dd:01]"), false);

  auto address = ethernet::Address::fromString("33:33:01:01:01:01");
  uri = FaceUri(address);
  BOOST_CHECK_EQUAL(uri.toString(), "ether://[33:33:01:01:01:01]");
}

BOOST_FIXTURE_TEST_CASE(CanonizeEther, CanonizeFixture)
{
  BOOST_CHECK_EQUAL(FaceUri::canCanonize("ether"), true);

  BOOST_CHECK_EQUAL(FaceUri("ether://[08:00:27:01:01:01]").isCanonical(), true);
  BOOST_CHECK_EQUAL(FaceUri("ether://[08:00:27:1:1:1]").isCanonical(), false);
  BOOST_CHECK_EQUAL(FaceUri("ether://[08:00:27:01:01:01]/").isCanonical(), false);
  BOOST_CHECK_EQUAL(FaceUri("ether://[33:33:01:01:01:01]").isCanonical(), true);

  runTest("ether://[08:00:27:01:01:01]", true, "ether://[08:00:27:01:01:01]");
  runTest("ether://[08:00:27:1:1:1]", true, "ether://[08:00:27:01:01:01]");
  runTest("ether://[08:00:27:01:01:01]/", true, "ether://[08:00:27:01:01:01]");
  runTest("ether://[33:33:01:01:01:01]", true, "ether://[33:33:01:01:01:01]");
}

BOOST_AUTO_TEST_CASE(ParseDev,
  * boost::unit_test::expected_failures(1))
{
  FaceUri uri;

  BOOST_CHECK(uri.parse("dev://eth0"));
  BOOST_CHECK_EQUAL(uri.getScheme(), "dev");
  BOOST_CHECK_EQUAL(uri.getHost(), "eth0");
  BOOST_CHECK_EQUAL(uri.getPort(), "");
  BOOST_CHECK_EQUAL(uri.getPath(), "");

  BOOST_CHECK_EQUAL(uri.parse("dev://eth0:8888"), false); // Bug #3896

  std::string ifname = "en1";
  uri = FaceUri::fromDev(ifname);
  BOOST_CHECK_EQUAL(uri.toString(), "dev://en1");
}

BOOST_AUTO_TEST_CASE(IsCanonicalDev)
{
  BOOST_CHECK_EQUAL(FaceUri::canCanonize("dev"), true);

  BOOST_CHECK_EQUAL(FaceUri("dev://eth0").isCanonical(), true);
  BOOST_CHECK_EQUAL(FaceUri("dev://").isCanonical(), false);
  BOOST_CHECK_EQUAL(FaceUri("dev://eth0:8888").isCanonical(), false);
  BOOST_CHECK_EQUAL(FaceUri("dev://eth0/").isCanonical(), false);
  BOOST_CHECK_EQUAL(FaceUri("dev://eth0/A").isCanonical(), false);
}

BOOST_FIXTURE_TEST_CASE(CanonizeDev, CanonizeFixture)
{
  runTest("dev://eth0", true, "dev://eth0");
  runTest("dev://", false);
  runTest("dev://eth0:8888", false);
  runTest("dev://eth0/", true, "dev://eth0");
  runTest("dev://eth0/A", false);
}

BOOST_AUTO_TEST_CASE(ParseUdpDev)
{
  FaceUri uri;

  BOOST_CHECK(uri.parse("udp4+dev://eth0:7777"));
  BOOST_CHECK_EQUAL(uri.getScheme(), "udp4+dev");
  BOOST_CHECK_EQUAL(uri.getHost(), "eth0");
  BOOST_CHECK_EQUAL(uri.getPort(), "7777");
  BOOST_CHECK_EQUAL(uri.getPath(), "");

  BOOST_CHECK(uri.parse("udp6+dev://eth1:7777"));
  BOOST_CHECK_EQUAL(uri.getScheme(), "udp6+dev");
  BOOST_CHECK_EQUAL(uri.getHost(), "eth1");
  BOOST_CHECK_EQUAL(uri.getPort(), "7777");
  BOOST_CHECK_EQUAL(uri.getPath(), "");

  BOOST_CHECK(uri.parse("abc+efg://eth0"));
  BOOST_CHECK(!uri.parse("abc+://eth0"));
  BOOST_CHECK(!uri.parse("+abc://eth0"));

  namespace ip = boost::asio::ip;

  ip::udp::endpoint endpoint4(ip::udp::v4(), 7777);
  uri = FaceUri::fromUdpDev(endpoint4, "en1");
  BOOST_CHECK_EQUAL(uri.toString(), "udp4+dev://en1:7777");

  ip::udp::endpoint endpoint6(ip::udp::v6(), 7777);
  uri = FaceUri::fromUdpDev(endpoint6, "en2");
  BOOST_CHECK_EQUAL(uri.toString(), "udp6+dev://en2:7777");
}

BOOST_FIXTURE_TEST_CASE(CanonizeUdpDev, CanonizeFixture)
{
  BOOST_CHECK_EQUAL(FaceUri("udp4+dev://eth0:7777").isCanonical(), true);
  BOOST_CHECK_EQUAL(FaceUri("udp6+dev://eth1:7777").isCanonical(), true);
  BOOST_CHECK_EQUAL(FaceUri("udp+dev://eth1:7777").isCanonical(), false);
  BOOST_CHECK_EQUAL(FaceUri("udp6+dev://eth1").isCanonical(), false);

  runTest("udp4+dev://en0:7777", true, "udp4+dev://en0:7777");
  runTest("udp6+dev://en0:7777", true, "udp6+dev://en0:7777");
  runTest("udp+dev://en1:7777", false);
  runTest("udp6+dev://en2", false);
}

BOOST_AUTO_TEST_CASE(CanonizeEmptyCallback)
{
  boost::asio::io_context io;

  // unsupported scheme
  FaceUri("null://").canonize(nullptr, nullptr, io, 1_ms);

  // cannot resolve
  FaceUri("udp://192.0.2.333").canonize(nullptr, nullptr, io, 1_ms);

  // already canonical
  FaceUri("udp4://192.0.2.1:6363").canonize(nullptr, nullptr, io, 1_ms);

  // need DNS resolution
  FaceUri("udp://192.0.2.1:6363").canonize(nullptr, nullptr, io, 1_ms);

  io.run(); // should not crash

  // avoid "test case [...] did not check any assertions" message from Boost.Test
  BOOST_CHECK(true);
}

BOOST_FIXTURE_TEST_CASE(CanonizeUnsupported, CanonizeFixture)
{
  BOOST_CHECK_EQUAL(FaceUri::canCanonize("internal"), false);
  BOOST_CHECK_EQUAL(FaceUri::canCanonize("null"), false);
  BOOST_CHECK_EQUAL(FaceUri::canCanonize("unix"), false);
  BOOST_CHECK_EQUAL(FaceUri::canCanonize("fd"), false);

  BOOST_CHECK_EQUAL(FaceUri("internal://").isCanonical(), false);
  BOOST_CHECK_EQUAL(FaceUri("null://").isCanonical(), false);
  BOOST_CHECK_EQUAL(FaceUri("unix:///var/run/nfd.sock").isCanonical(), false);
  BOOST_CHECK_EQUAL(FaceUri("fd://0").isCanonical(), false);

  runTest("internal://", false);
  runTest("null://", false);
  runTest("unix:///var/run/nfd.sock", false);
  runTest("fd://0", false);
}

BOOST_AUTO_TEST_CASE(Bug1635)
{
  FaceUri uri;

  BOOST_CHECK(uri.parse("wsclient://[::ffff:76.90.11.239]:56366"));
  BOOST_CHECK_EQUAL(uri.getScheme(), "wsclient");
  BOOST_CHECK_EQUAL(uri.getHost(), "76.90.11.239");
  BOOST_CHECK_EQUAL(uri.getPort(), "56366");
  BOOST_CHECK_EQUAL(uri.getPath(), "");
  BOOST_CHECK_EQUAL(uri.toString(), "wsclient://76.90.11.239:56366");
}

BOOST_AUTO_TEST_CASE(Compare)
{
  FaceUri uri0("udp://[::1]:6363");
  FaceUri uri1("tcp://[::1]:6363");
  FaceUri uri2("tcp://127.0.0.1:6363");
  FaceUri uri3("unix:///run/ndn/nfd.sock");

  BOOST_CHECK_EQUAL(uri0, uri0);
  BOOST_CHECK_LE(uri0, uri0);
  BOOST_CHECK_GE(uri0, uri0);

  BOOST_CHECK_GT(uri0, uri1);
  BOOST_CHECK_GE(uri0, uri1);
  BOOST_CHECK_NE(uri0, uri1);

  BOOST_CHECK_LT(uri1, uri0);
  BOOST_CHECK_LE(uri1, uri0);
  BOOST_CHECK_NE(uri1, uri0);

  BOOST_CHECK_GT(uri0, uri2);
  BOOST_CHECK_GE(uri0, uri2);
  BOOST_CHECK_NE(uri0, uri2);

  BOOST_CHECK_LT(uri2, uri0);
  BOOST_CHECK_LE(uri2, uri0);
  BOOST_CHECK_NE(uri2, uri0);

  BOOST_CHECK_LT(uri0, uri3);
  BOOST_CHECK_LE(uri0, uri3);
  BOOST_CHECK_NE(uri0, uri3);

  BOOST_CHECK_GT(uri3, uri0);
  BOOST_CHECK_GE(uri3, uri0);
  BOOST_CHECK_NE(uri3, uri0);
}

BOOST_AUTO_TEST_SUITE_END() // TestFaceUri
BOOST_AUTO_TEST_SUITE_END() // Net

} // namespace ndn::tests
