blob: b61e5af037824e2262f9cac71214f73cf99b2bef [file] [log] [blame]
Junxiao Shia6286a92021-02-23 06:43:52 -07001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2014-2021, Regents of the University of California,
4 * Arizona Board of Regents,
5 * Colorado State University,
6 * University Pierre & Marie Curie, Sorbonne University,
7 * Washington University in St. Louis,
8 * Beijing Institute of Technology,
9 * The University of Memphis.
10 *
11 * This file is part of NFD (Named Data Networking Forwarding Daemon).
12 * See AUTHORS.md for complete list of NFD authors and contributors.
13 *
14 * NFD is free software: you can redistribute it and/or modify it under the terms
15 * of the GNU General Public License as published by the Free Software Foundation,
16 * either version 3 of the License, or (at your option) any later version.
17 *
18 * NFD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
19 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
20 * PURPOSE. See the GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License along with
23 * NFD, e.g., in COPYING.md file. If not, see <http://www.gnu.org/licenses/>.
24 */
25
26#include "udp-channel-fixture.hpp"
27
28#include "test-ip.hpp"
29#include <boost/mpl/vector.hpp>
30
31namespace nfd {
32namespace face {
33namespace tests {
34
35BOOST_AUTO_TEST_SUITE(Face)
36BOOST_FIXTURE_TEST_SUITE(TestUdpChannel, UdpChannelFixture)
37
38using AddressFamilies = boost::mpl::vector<
39 std::integral_constant<AddressFamily, AddressFamily::V4>,
40 std::integral_constant<AddressFamily, AddressFamily::V6>>;
41
42BOOST_AUTO_TEST_CASE_TEMPLATE(DefaultMtu, F, AddressFamilies)
43{
44 auto address = getTestIp(F::value, AddressScope::Loopback);
45 SKIP_IF_IP_UNAVAILABLE(address);
46 this->listen(address,1452);
47
48 auto ch1 = this->makeChannel(typename IpAddressFromFamily<F::value>::type(), 0, 1232);
49 connect(*ch1);
50
51 BOOST_CHECK_EQUAL(this->limitedIo.run(2, 1_s), LimitedIo::EXCEED_OPS);
52 BOOST_CHECK_EQUAL(this->listenerChannel->size(), 1);
53 BOOST_CHECK_EQUAL(ch1->size(), 1);
54 BOOST_CHECK_EQUAL(ch1->isListening(), false);
55
56 for (const auto& face : this->listenerFaces) {
57 BOOST_CHECK_EQUAL(face->getMtu(), 1452);
58 }
59 for (const auto& face : this->clientFaces) {
60 BOOST_CHECK_EQUAL(face->getMtu(), 1232);
61 }
62}
63
64BOOST_AUTO_TEST_SUITE_END() // TestUdpChannel
65BOOST_AUTO_TEST_SUITE_END() // Face
66
67} // namespace tests
68} // namespace face
69} // namespace nfd