Davide Pesavento | 44deacc | 2014-02-19 10:48:07 +0100 | [diff] [blame] | 1 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 | /** |
Alexander Afanasyev | 319f2c8 | 2015-01-07 14:56:53 -0800 | [diff] [blame] | 3 | * Copyright (c) 2014-2015, 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. |
Alexander Afanasyev | 9bcbc7c | 2014-04-06 19:37:37 -0700 | [diff] [blame] | 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/>. |
Steve DiBenedetto | ef04f27 | 2014-06-04 14:28:31 -0600 | [diff] [blame] | 24 | */ |
Davide Pesavento | 44deacc | 2014-02-19 10:48:07 +0100 | [diff] [blame] | 25 | |
Davide Pesavento | 7726ae5 | 2014-11-23 21:01:05 +0100 | [diff] [blame] | 26 | #include "face/ethernet-face.hpp" |
Alexander Afanasyev | 0eb7065 | 2014-02-27 18:35:07 -0800 | [diff] [blame] | 27 | #include "face/ethernet-factory.hpp" |
Davide Pesavento | 44deacc | 2014-02-19 10:48:07 +0100 | [diff] [blame] | 28 | |
Davide Pesavento | 7726ae5 | 2014-11-23 21:01:05 +0100 | [diff] [blame] | 29 | #include "core/network-interface.hpp" |
Davide Pesavento | 4c1a078 | 2014-08-14 16:13:20 +0200 | [diff] [blame] | 30 | #include "tests/test-common.hpp" |
Davide Pesavento | b60cc12 | 2014-03-19 19:26:02 +0100 | [diff] [blame] | 31 | |
Davide Pesavento | 7726ae5 | 2014-11-23 21:01:05 +0100 | [diff] [blame] | 32 | #include <pcap/pcap.h> |
| 33 | |
Davide Pesavento | 44deacc | 2014-02-19 10:48:07 +0100 | [diff] [blame] | 34 | namespace nfd { |
Junxiao Shi | d9ee45c | 2014-02-27 15:38:11 -0700 | [diff] [blame] | 35 | namespace tests { |
Davide Pesavento | 44deacc | 2014-02-19 10:48:07 +0100 | [diff] [blame] | 36 | |
Davide Pesavento | b60cc12 | 2014-03-19 19:26:02 +0100 | [diff] [blame] | 37 | class InterfacesFixture : protected BaseFixture |
| 38 | { |
| 39 | protected: |
| 40 | InterfacesFixture() |
| 41 | { |
Alexander Afanasyev | b56c5b9 | 2014-06-05 08:05:24 +0300 | [diff] [blame] | 42 | EthernetFactory factory; |
| 43 | |
Davide Pesavento | b499a60 | 2014-11-18 22:36:56 +0100 | [diff] [blame] | 44 | for (const auto& netif : listNetworkInterfaces()) { |
| 45 | if (!netif.isLoopback() && netif.isUp()) { |
| 46 | try { |
| 47 | factory.createMulticastFace(netif, ethernet::getBroadcastAddress()); |
| 48 | } |
| 49 | catch (Face::Error&) { |
| 50 | continue; |
| 51 | } |
Davide Pesavento | b60cc12 | 2014-03-19 19:26:02 +0100 | [diff] [blame] | 52 | |
Davide Pesavento | b499a60 | 2014-11-18 22:36:56 +0100 | [diff] [blame] | 53 | m_interfaces.push_back(netif); |
Davide Pesavento | b60cc12 | 2014-03-19 19:26:02 +0100 | [diff] [blame] | 54 | } |
Davide Pesavento | b499a60 | 2014-11-18 22:36:56 +0100 | [diff] [blame] | 55 | } |
Davide Pesavento | b60cc12 | 2014-03-19 19:26:02 +0100 | [diff] [blame] | 56 | } |
| 57 | |
| 58 | protected: |
Davide Pesavento | b499a60 | 2014-11-18 22:36:56 +0100 | [diff] [blame] | 59 | std::vector<NetworkInterfaceInfo> m_interfaces; |
Davide Pesavento | b60cc12 | 2014-03-19 19:26:02 +0100 | [diff] [blame] | 60 | }; |
| 61 | |
Davide Pesavento | 7726ae5 | 2014-11-23 21:01:05 +0100 | [diff] [blame] | 62 | BOOST_FIXTURE_TEST_SUITE(FaceEthernet, InterfacesFixture) |
Davide Pesavento | b60cc12 | 2014-03-19 19:26:02 +0100 | [diff] [blame] | 63 | |
Davide Pesavento | 7726ae5 | 2014-11-23 21:01:05 +0100 | [diff] [blame] | 64 | BOOST_AUTO_TEST_CASE(GetChannels) |
Davide Pesavento | 44deacc | 2014-02-19 10:48:07 +0100 | [diff] [blame] | 65 | { |
Alexander Afanasyev | 0eb7065 | 2014-02-27 18:35:07 -0800 | [diff] [blame] | 66 | EthernetFactory factory; |
Davide Pesavento | 44deacc | 2014-02-19 10:48:07 +0100 | [diff] [blame] | 67 | |
Davide Pesavento | 7726ae5 | 2014-11-23 21:01:05 +0100 | [diff] [blame] | 68 | auto channels = factory.getChannels(); |
| 69 | BOOST_CHECK_EQUAL(channels.empty(), true); |
| 70 | } |
Davide Pesavento | 44deacc | 2014-02-19 10:48:07 +0100 | [diff] [blame] | 71 | |
Davide Pesavento | 7726ae5 | 2014-11-23 21:01:05 +0100 | [diff] [blame] | 72 | BOOST_AUTO_TEST_CASE(MulticastFacesMap) |
| 73 | { |
| 74 | if (m_interfaces.empty()) { |
| 75 | BOOST_WARN_MESSAGE(false, "No interfaces available for pcap, " |
| 76 | "cannot perform MulticastFacesMap test"); |
| 77 | return; |
| 78 | } |
| 79 | |
| 80 | EthernetFactory factory; |
Alexander Afanasyev | b56c5b9 | 2014-06-05 08:05:24 +0300 | [diff] [blame] | 81 | shared_ptr<EthernetFace> face1 = factory.createMulticastFace(m_interfaces.front(), |
| 82 | ethernet::getBroadcastAddress()); |
| 83 | shared_ptr<EthernetFace> face1bis = factory.createMulticastFace(m_interfaces.front(), |
| 84 | ethernet::getBroadcastAddress()); |
Davide Pesavento | b60cc12 | 2014-03-19 19:26:02 +0100 | [diff] [blame] | 85 | BOOST_CHECK_EQUAL(face1, face1bis); |
| 86 | |
Davide Pesavento | b499a60 | 2014-11-18 22:36:56 +0100 | [diff] [blame] | 87 | if (m_interfaces.size() > 1) { |
| 88 | shared_ptr<EthernetFace> face2 = factory.createMulticastFace(m_interfaces.back(), |
| 89 | ethernet::getBroadcastAddress()); |
| 90 | BOOST_CHECK_NE(face1, face2); |
| 91 | } |
| 92 | else { |
Davide Pesavento | 7726ae5 | 2014-11-23 21:01:05 +0100 | [diff] [blame] | 93 | BOOST_WARN_MESSAGE(false, "Only one interface available for pcap, " |
| 94 | "cannot test second EthernetFace creation"); |
Davide Pesavento | b499a60 | 2014-11-18 22:36:56 +0100 | [diff] [blame] | 95 | } |
Davide Pesavento | b60cc12 | 2014-03-19 19:26:02 +0100 | [diff] [blame] | 96 | |
Alexander Afanasyev | b56c5b9 | 2014-06-05 08:05:24 +0300 | [diff] [blame] | 97 | shared_ptr<EthernetFace> face3 = factory.createMulticastFace(m_interfaces.front(), |
| 98 | ethernet::getDefaultMulticastAddress()); |
Davide Pesavento | b60cc12 | 2014-03-19 19:26:02 +0100 | [diff] [blame] | 99 | BOOST_CHECK_NE(face1, face3); |
| 100 | } |
| 101 | |
Yukai Tu | 7c90e6d | 2015-07-11 12:21:46 +0800 | [diff] [blame] | 102 | BOOST_AUTO_TEST_CASE(UnsupportedFaceCreate) |
| 103 | { |
| 104 | EthernetFactory factory; |
| 105 | |
| 106 | BOOST_CHECK_THROW(factory.createFace(FaceUri("ether://[08:00:27:01:01:01]"), |
| 107 | ndn::nfd::FACE_PERSISTENCY_PERMANENT, |
| 108 | bind([]{}), |
| 109 | bind([]{})), |
| 110 | ProtocolFactory::Error); |
| 111 | |
| 112 | BOOST_CHECK_THROW(factory.createFace(FaceUri("ether://[08:00:27:01:01:01]"), |
| 113 | ndn::nfd::FACE_PERSISTENCY_ON_DEMAND, |
| 114 | bind([]{}), |
| 115 | bind([]{})), |
| 116 | ProtocolFactory::Error); |
| 117 | |
| 118 | BOOST_CHECK_THROW(factory.createFace(FaceUri("ether://[08:00:27:01:01:01]"), |
| 119 | ndn::nfd::FACE_PERSISTENCY_PERSISTENT, |
| 120 | bind([]{}), |
| 121 | bind([]{})), |
| 122 | ProtocolFactory::Error); |
| 123 | } |
| 124 | |
Davide Pesavento | 7726ae5 | 2014-11-23 21:01:05 +0100 | [diff] [blame] | 125 | BOOST_AUTO_TEST_CASE(SendPacket) |
Davide Pesavento | b60cc12 | 2014-03-19 19:26:02 +0100 | [diff] [blame] | 126 | { |
Davide Pesavento | 7726ae5 | 2014-11-23 21:01:05 +0100 | [diff] [blame] | 127 | if (m_interfaces.empty()) { |
| 128 | BOOST_WARN_MESSAGE(false, "No interfaces available for pcap, " |
| 129 | "cannot perform SendPacket test"); |
| 130 | return; |
| 131 | } |
| 132 | |
Davide Pesavento | b60cc12 | 2014-03-19 19:26:02 +0100 | [diff] [blame] | 133 | EthernetFactory factory; |
Davide Pesavento | b60cc12 | 2014-03-19 19:26:02 +0100 | [diff] [blame] | 134 | shared_ptr<EthernetFace> face = factory.createMulticastFace(m_interfaces.front(), |
Alexander Afanasyev | b56c5b9 | 2014-06-05 08:05:24 +0300 | [diff] [blame] | 135 | ethernet::getDefaultMulticastAddress()); |
Alexander Afanasyev | 355c066 | 2014-03-20 18:08:17 -0700 | [diff] [blame] | 136 | |
Davide Pesavento | 7726ae5 | 2014-11-23 21:01:05 +0100 | [diff] [blame] | 137 | BOOST_REQUIRE(static_cast<bool>(face)); |
Davide Pesavento | 44deacc | 2014-02-19 10:48:07 +0100 | [diff] [blame] | 138 | BOOST_CHECK_EQUAL(face->isLocal(), false); |
Yukai Tu | 731f0d7 | 2015-07-04 11:14:44 +0800 | [diff] [blame] | 139 | BOOST_CHECK_EQUAL(face->getPersistency(), ndn::nfd::FACE_PERSISTENCY_PERSISTENT); |
Davide Pesavento | 9427941 | 2015-02-27 01:29:32 +0100 | [diff] [blame] | 140 | BOOST_CHECK_EQUAL(face->isMultiAccess(), true); |
Junxiao Shi | 7949416 | 2014-04-02 18:25:11 -0700 | [diff] [blame] | 141 | BOOST_CHECK_EQUAL(face->getRemoteUri().toString(), |
Davide Pesavento | b499a60 | 2014-11-18 22:36:56 +0100 | [diff] [blame] | 142 | "ether://[" + ethernet::getDefaultMulticastAddress().toString() + "]"); |
Junxiao Shi | 7949416 | 2014-04-02 18:25:11 -0700 | [diff] [blame] | 143 | BOOST_CHECK_EQUAL(face->getLocalUri().toString(), |
Davide Pesavento | b499a60 | 2014-11-18 22:36:56 +0100 | [diff] [blame] | 144 | "dev://" + m_interfaces.front().name); |
Davide Pesavento | 7726ae5 | 2014-11-23 21:01:05 +0100 | [diff] [blame] | 145 | BOOST_CHECK_EQUAL(face->getCounters().getNInBytes(), 0); |
| 146 | BOOST_CHECK_EQUAL(face->getCounters().getNOutBytes(), 0); |
| 147 | |
Junxiao Shi | c099ddb | 2014-12-25 20:53:20 -0700 | [diff] [blame] | 148 | face->onFail.connect([] (const std::string& reason) { BOOST_FAIL(reason); }); |
Davide Pesavento | 44deacc | 2014-02-19 10:48:07 +0100 | [diff] [blame] | 149 | |
Alexander Afanasyev | b56c5b9 | 2014-06-05 08:05:24 +0300 | [diff] [blame] | 150 | shared_ptr<Interest> interest1 = makeInterest("ndn:/TpnzGvW9R"); |
| 151 | shared_ptr<Data> data1 = makeData("ndn:/KfczhUqVix"); |
| 152 | shared_ptr<Interest> interest2 = makeInterest("ndn:/QWiIMfj5sL"); |
| 153 | shared_ptr<Data> data2 = makeData("ndn:/XNBV796f"); |
Davide Pesavento | 44deacc | 2014-02-19 10:48:07 +0100 | [diff] [blame] | 154 | |
Davide Pesavento | 7726ae5 | 2014-11-23 21:01:05 +0100 | [diff] [blame] | 155 | face->sendInterest(*interest1); |
| 156 | face->sendData (*data1 ); |
| 157 | face->sendInterest(*interest2); |
| 158 | face->sendData (*data2 ); |
| 159 | |
Matteo Sammarco | 66df974 | 2014-11-21 18:31:26 +0100 | [diff] [blame] | 160 | BOOST_CHECK_EQUAL(face->getCounters().getNOutBytes(), |
| 161 | 14 * 4 + // 4 NDNLP headers |
| 162 | interest1->wireEncode().size() + |
| 163 | data1->wireEncode().size() + |
| 164 | interest2->wireEncode().size() + |
| 165 | data2->wireEncode().size()); |
Davide Pesavento | 44deacc | 2014-02-19 10:48:07 +0100 | [diff] [blame] | 166 | |
| 167 | // m_ioRemaining = 4; |
| 168 | // m_ioService.run(); |
| 169 | // m_ioService.reset(); |
| 170 | |
| 171 | // BOOST_REQUIRE_EQUAL(m_face1_receivedInterests.size(), 1); |
| 172 | // BOOST_REQUIRE_EQUAL(m_face1_receivedDatas .size(), 1); |
| 173 | // BOOST_REQUIRE_EQUAL(m_face2_receivedInterests.size(), 1); |
| 174 | // BOOST_REQUIRE_EQUAL(m_face2_receivedDatas .size(), 1); |
| 175 | |
| 176 | // BOOST_CHECK_EQUAL(m_face1_receivedInterests[0].getName(), interest2.getName()); |
| 177 | // BOOST_CHECK_EQUAL(m_face1_receivedDatas [0].getName(), data2.getName()); |
| 178 | // BOOST_CHECK_EQUAL(m_face2_receivedInterests[0].getName(), interest1.getName()); |
| 179 | // BOOST_CHECK_EQUAL(m_face2_receivedDatas [0].getName(), data1.getName()); |
| 180 | } |
| 181 | |
Davide Pesavento | 7726ae5 | 2014-11-23 21:01:05 +0100 | [diff] [blame] | 182 | BOOST_AUTO_TEST_CASE(ProcessIncomingPacket) |
| 183 | { |
| 184 | if (m_interfaces.empty()) { |
| 185 | BOOST_WARN_MESSAGE(false, "No interfaces available for pcap, " |
| 186 | "cannot perform ProcessIncomingPacket test"); |
| 187 | return; |
| 188 | } |
| 189 | |
| 190 | EthernetFactory factory; |
| 191 | shared_ptr<EthernetFace> face = factory.createMulticastFace(m_interfaces.front(), |
| 192 | ethernet::getDefaultMulticastAddress()); |
| 193 | BOOST_REQUIRE(static_cast<bool>(face)); |
| 194 | |
| 195 | std::vector<Interest> recInterests; |
| 196 | std::vector<Data> recDatas; |
| 197 | |
Junxiao Shi | c099ddb | 2014-12-25 20:53:20 -0700 | [diff] [blame] | 198 | face->onFail.connect([] (const std::string& reason) { BOOST_FAIL(reason); }); |
| 199 | face->onReceiveInterest.connect( |
| 200 | [&recInterests] (const Interest& i) { recInterests.push_back(i); }); |
| 201 | face->onReceiveData.connect([&recDatas] (const Data& d) { recDatas.push_back(d); }); |
Davide Pesavento | 7726ae5 | 2014-11-23 21:01:05 +0100 | [diff] [blame] | 202 | |
| 203 | // check that packet data is not accessed if pcap didn't capture anything (caplen == 0) |
| 204 | static const pcap_pkthdr header1{}; |
| 205 | face->processIncomingPacket(&header1, nullptr); |
| 206 | BOOST_CHECK_EQUAL(face->getCounters().getNInBytes(), 0); |
| 207 | BOOST_CHECK_EQUAL(recInterests.size(), 0); |
| 208 | BOOST_CHECK_EQUAL(recDatas.size(), 0); |
| 209 | |
| 210 | // runt frame (too short) |
| 211 | static const pcap_pkthdr header2{{}, ethernet::HDR_LEN + 6}; |
| 212 | static const uint8_t packet2[ethernet::HDR_LEN + 6]{}; |
| 213 | face->processIncomingPacket(&header2, packet2); |
| 214 | BOOST_CHECK_EQUAL(face->getCounters().getNInBytes(), 0); |
| 215 | BOOST_CHECK_EQUAL(recInterests.size(), 0); |
| 216 | BOOST_CHECK_EQUAL(recDatas.size(), 0); |
| 217 | |
| 218 | // valid frame, but TLV block has invalid length |
| 219 | static const pcap_pkthdr header3{{}, ethernet::HDR_LEN + ethernet::MIN_DATA_LEN}; |
| 220 | static const uint8_t packet3[ethernet::HDR_LEN + ethernet::MIN_DATA_LEN]{ |
Matteo Sammarco | 66df974 | 2014-11-21 18:31:26 +0100 | [diff] [blame] | 221 | 0x01, 0x00, 0x5e, 0x00, 0x17, 0xaa, // destination address |
Davide Pesavento | 7726ae5 | 2014-11-23 21:01:05 +0100 | [diff] [blame] | 222 | 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, // source address |
| 223 | 0x86, 0x24, // NDN ethertype |
Matteo Sammarco | 66df974 | 2014-11-21 18:31:26 +0100 | [diff] [blame] | 224 | tlv::NdnlpData, // TLV type |
| 225 | 0xfd, 0xff, 0xff // TLV length (invalid because greater than buffer size) |
Davide Pesavento | 7726ae5 | 2014-11-23 21:01:05 +0100 | [diff] [blame] | 226 | }; |
| 227 | face->processIncomingPacket(&header3, packet3); |
| 228 | BOOST_CHECK_EQUAL(face->getCounters().getNInBytes(), 0); |
| 229 | BOOST_CHECK_EQUAL(recInterests.size(), 0); |
| 230 | BOOST_CHECK_EQUAL(recDatas.size(), 0); |
| 231 | |
| 232 | // valid frame, but TLV block has invalid type |
| 233 | static const pcap_pkthdr header4{{}, ethernet::HDR_LEN + ethernet::MIN_DATA_LEN}; |
| 234 | static const uint8_t packet4[ethernet::HDR_LEN + ethernet::MIN_DATA_LEN]{ |
Matteo Sammarco | 66df974 | 2014-11-21 18:31:26 +0100 | [diff] [blame] | 235 | 0x01, 0x00, 0x5e, 0x00, 0x17, 0xaa, // destination address |
Davide Pesavento | 7726ae5 | 2014-11-23 21:01:05 +0100 | [diff] [blame] | 236 | 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, // source address |
| 237 | 0x86, 0x24, // NDN ethertype |
| 238 | 0x00, // TLV type (invalid) |
| 239 | 0x00 // TLV length |
| 240 | }; |
| 241 | face->processIncomingPacket(&header4, packet4); |
| 242 | BOOST_CHECK_EQUAL(face->getCounters().getNInBytes(), 2); |
| 243 | BOOST_CHECK_EQUAL(recInterests.size(), 0); |
| 244 | BOOST_CHECK_EQUAL(recDatas.size(), 0); |
| 245 | |
Matteo Sammarco | 66df974 | 2014-11-21 18:31:26 +0100 | [diff] [blame] | 246 | // valid frame and valid NDNLP header, but invalid payload |
Davide Pesavento | 7726ae5 | 2014-11-23 21:01:05 +0100 | [diff] [blame] | 247 | static const pcap_pkthdr header5{{}, ethernet::HDR_LEN + ethernet::MIN_DATA_LEN}; |
| 248 | static const uint8_t packet5[ethernet::HDR_LEN + ethernet::MIN_DATA_LEN]{ |
Matteo Sammarco | 66df974 | 2014-11-21 18:31:26 +0100 | [diff] [blame] | 249 | 0x01, 0x00, 0x5e, 0x00, 0x17, 0xaa, // destination address |
Davide Pesavento | 7726ae5 | 2014-11-23 21:01:05 +0100 | [diff] [blame] | 250 | 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, // source address |
Matteo Sammarco | 66df974 | 2014-11-21 18:31:26 +0100 | [diff] [blame] | 251 | 0x86, 0x24, // NDN ethertype |
| 252 | tlv::NdnlpData, 0x0e, // NDNLP header |
| 253 | tlv::NdnlpSequence, 0x08, |
| 254 | 0, 0, 0, 0, 0, 0, 0, 0, |
| 255 | tlv::NdnlpPayload, 0x02, |
| 256 | 0x00, // NDN TLV type (invalid) |
| 257 | 0x00 // NDN TLV length |
| 258 | }; |
| 259 | face->processIncomingPacket(&header5, packet5); |
| 260 | BOOST_CHECK_EQUAL(face->getCounters().getNInBytes(), 18); |
| 261 | BOOST_CHECK_EQUAL(recInterests.size(), 0); |
| 262 | BOOST_CHECK_EQUAL(recDatas.size(), 0); |
| 263 | |
| 264 | // valid frame, valid NDNLP header, and valid NDN (interest) packet |
| 265 | static const pcap_pkthdr header6{{}, ethernet::HDR_LEN + ethernet::MIN_DATA_LEN}; |
| 266 | static const uint8_t packet6[ethernet::HDR_LEN + ethernet::MIN_DATA_LEN]{ |
| 267 | 0x01, 0x00, 0x5e, 0x00, 0x17, 0xaa, // destination address |
| 268 | 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, // source address |
| 269 | 0x86, 0x24, // NDN ethertype |
| 270 | tlv::NdnlpData, 0x24, // NDNLP TLV type and length |
| 271 | 0x51, 0x08, 0x00, 0x00, 0x00, 0x00, // rest of NDNLP header |
| 272 | 0x00, 0x00, 0x00, 0x00, 0x54, 0x18, |
| 273 | tlv::Interest, 0x16, // NDN TLV type and length |
Davide Pesavento | 7726ae5 | 2014-11-23 21:01:05 +0100 | [diff] [blame] | 274 | 0x07, 0x0e, 0x08, 0x07, 0x65, 0x78, // payload |
| 275 | 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x08, |
| 276 | 0x03, 0x66, 0x6f, 0x6f, 0x0a, 0x04, |
| 277 | 0x03, 0xef, 0xe9, 0x7c |
| 278 | }; |
Matteo Sammarco | 66df974 | 2014-11-21 18:31:26 +0100 | [diff] [blame] | 279 | face->processIncomingPacket(&header6, packet6); |
| 280 | BOOST_CHECK_EQUAL(face->getCounters().getNInBytes(), 56); |
Davide Pesavento | 7726ae5 | 2014-11-23 21:01:05 +0100 | [diff] [blame] | 281 | BOOST_CHECK_EQUAL(recInterests.size(), 1); |
| 282 | BOOST_CHECK_EQUAL(recDatas.size(), 0); |
| 283 | } |
| 284 | |
Davide Pesavento | 44deacc | 2014-02-19 10:48:07 +0100 | [diff] [blame] | 285 | BOOST_AUTO_TEST_SUITE_END() |
| 286 | |
Junxiao Shi | d9ee45c | 2014-02-27 15:38:11 -0700 | [diff] [blame] | 287 | } // namespace tests |
Davide Pesavento | 44deacc | 2014-02-19 10:48:07 +0100 | [diff] [blame] | 288 | } // namespace nfd |