blob: 12c9eb34ed3e057f4461da7a150cbba686a7a0d4 [file] [log] [blame]
Giulio Grassi624f6c62014-02-18 19:42:14 +01001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (C) 2014 Named Data Networking Project
4 * See COPYING for copyright and distribution information.
5 */
6
7#include "face/udp-factory.hpp"
Giulio Grassi624f6c62014-02-18 19:42:14 +01008#include "core/face-uri.hpp"
Giulio Grassi624f6c62014-02-18 19:42:14 +01009#include <ndn-cpp-dev/security/key-chain.hpp>
Junxiao Shi7e2413b2014-03-02 11:15:09 -070010
11#include "tests/test-common.hpp"
12#include "tests/core/limited-io.hpp"
Giulio Grassi624f6c62014-02-18 19:42:14 +010013
14namespace nfd {
15namespace tests {
16
17BOOST_FIXTURE_TEST_SUITE(FaceUdp, BaseFixture)
18
19class FactoryErrorCheck : protected BaseFixture
20{
21public:
22 bool isTheSameMulticastEndpoint(const UdpFactory::Error& e) {
23 return strcmp(e.what(),
24 "Cannot create the requested UDP unicast channel, local "
25 "endpoint is already allocated for a UDP multicast face") == 0;
26 }
Junxiao Shi7e2413b2014-03-02 11:15:09 -070027
Giulio Grassi624f6c62014-02-18 19:42:14 +010028 bool isNotMulticastAddress(const UdpFactory::Error& e) {
29 return strcmp(e.what(),
30 "Cannot create the requested UDP multicast face, "
31 "the multicast group given as input is not a multicast address") == 0;
32 }
Junxiao Shi7e2413b2014-03-02 11:15:09 -070033
Giulio Grassi624f6c62014-02-18 19:42:14 +010034 bool isTheSameUnicastEndpoint(const UdpFactory::Error& e) {
35 return strcmp(e.what(),
36 "Cannot create the requested UDP multicast face, local "
37 "endpoint is already allocated for a UDP unicast channel") == 0;
38 }
Junxiao Shi7e2413b2014-03-02 11:15:09 -070039
Giulio Grassi624f6c62014-02-18 19:42:14 +010040 bool isLocalEndpointOnDifferentGroup(const UdpFactory::Error& e) {
41 return strcmp(e.what(),
42 "Cannot create the requested UDP multicast face, local "
43 "endpoint is already allocated for a UDP multicast face "
44 "on a different multicast group") == 0;
45 }
46};
Junxiao Shi7e2413b2014-03-02 11:15:09 -070047
Giulio Grassi624f6c62014-02-18 19:42:14 +010048BOOST_FIXTURE_TEST_CASE(ChannelMapUdp, FactoryErrorCheck)
49{
50 using boost::asio::ip::udp;
Junxiao Shi7e2413b2014-03-02 11:15:09 -070051
Giulio Grassi624f6c62014-02-18 19:42:14 +010052 UdpFactory factory = UdpFactory();
Junxiao Shi7e2413b2014-03-02 11:15:09 -070053
Giulio Grassi624f6c62014-02-18 19:42:14 +010054 //to instantiate multicast face on a specific ip address, change interfaceIp
55 std::string interfaceIp = "0.0.0.0";
Junxiao Shi7e2413b2014-03-02 11:15:09 -070056
Giulio Grassi624f6c62014-02-18 19:42:14 +010057 shared_ptr<UdpChannel> channel1 = factory.createChannel("127.0.0.1", "20070");
58 shared_ptr<UdpChannel> channel1a = factory.createChannel("127.0.0.1", "20070");
59 BOOST_CHECK_EQUAL(channel1, channel1a);
Junxiao Shi7e2413b2014-03-02 11:15:09 -070060
Giulio Grassi624f6c62014-02-18 19:42:14 +010061 shared_ptr<UdpChannel> channel2 = factory.createChannel("127.0.0.1", "20071");
62 BOOST_CHECK_NE(channel1, channel2);
63
64 shared_ptr<UdpChannel> channel3 = factory.createChannel(interfaceIp, "20070");
Junxiao Shi7e2413b2014-03-02 11:15:09 -070065
Giulio Grassi624f6c62014-02-18 19:42:14 +010066 //same endpoint of a unicast channel
67 BOOST_CHECK_EXCEPTION(factory.createMulticastFace(interfaceIp,
68 "224.0.0.1",
69 "20070"),
70 UdpFactory::Error,
71 isTheSameUnicastEndpoint);
Junxiao Shi7e2413b2014-03-02 11:15:09 -070072
73
Giulio Grassi624f6c62014-02-18 19:42:14 +010074 shared_ptr<MulticastUdpFace> multicastFace1 = factory.createMulticastFace(interfaceIp,
75 "224.0.0.1",
76 "20072");
77 shared_ptr<MulticastUdpFace> multicastFace1a = factory.createMulticastFace(interfaceIp,
78 "224.0.0.1",
79 "20072");
80 BOOST_CHECK_EQUAL(multicastFace1, multicastFace1a);
Junxiao Shi7e2413b2014-03-02 11:15:09 -070081
82
Giulio Grassi624f6c62014-02-18 19:42:14 +010083 //same endpoint of a multicast face
84 BOOST_CHECK_EXCEPTION(factory.createChannel(interfaceIp, "20072"),
85 UdpFactory::Error,
86 isTheSameMulticastEndpoint);
Junxiao Shi7e2413b2014-03-02 11:15:09 -070087
Giulio Grassi624f6c62014-02-18 19:42:14 +010088 //same multicast endpoint, different group
89 BOOST_CHECK_EXCEPTION(factory.createMulticastFace(interfaceIp,
90 "224.0.0.42",
91 "20072"),
92 UdpFactory::Error,
93 isLocalEndpointOnDifferentGroup);
94
95 BOOST_CHECK_EXCEPTION(factory.createMulticastFace(interfaceIp,
96 "192.168.10.15",
97 "20025"),
98 UdpFactory::Error,
99 isNotMulticastAddress);
100
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700101
102
Giulio Grassi624f6c62014-02-18 19:42:14 +0100103// //Test commented because it required to be run in a machine that can resolve ipv6 query
104// shared_ptr<UdpChannel> channel1v6 = factory.createChannel(//"::1",
105// "fe80::5e96:9dff:fe7d:9c8d%en1",
106// //"fe80::aa54:b2ff:fe08:27b8%wlan0",
107// "20070");
108//
109// //the creation of multicastFace2 works properly. It has been disable because it needs an IP address of
110// //an available network interface (different from the first one used)
111// shared_ptr<MulticastUdpFace> multicastFace2 = factory.createMulticastFace("192.168.1.17",
112// "224.0.0.1",
113// "20073");
114// BOOST_CHECK_NE(multicastFace1, multicastFace2);
115//
116//
117// //ipv6 - work in progress
118// shared_ptr<MulticastUdpFace> multicastFace3 = factory.createMulticastFace("fe80::5e96:9dff:fe7d:9c8d%en1",
119// "FF01:0:0:0:0:0:0:2",
120// "20073");
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700121//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100122// shared_ptr<MulticastUdpFace> multicastFace4 = factory.createMulticastFace("fe80::aa54:b2ff:fe08:27b8%wlan0",
123// "FF01:0:0:0:0:0:0:2",
124// "20073");
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700125//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100126// BOOST_CHECK_EQUAL(multicastFace3, multicastFace4);
127//
128// shared_ptr<MulticastUdpFace> multicastFace5 = factory.createMulticastFace("::1",
129// "FF01:0:0:0:0:0:0:2",
130// "20073");
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700131//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100132// BOOST_CHECK_NE(multicastFace3, multicastFace5);
133//
134// //same local ipv6 endpoint for a different multicast group
135// BOOST_CHECK_THROW(factory.createMulticastFace("fe80::aa54:b2ff:fe08:27b8%wlan0",
136// "FE01:0:0:0:0:0:0:2",
137// "20073"),
138// UdpFactory::Error);
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700139//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100140// //same local ipv6 (expect for th port number) endpoint for a different multicast group
141// BOOST_CHECK_THROW(factory.createMulticastFace("fe80::aa54:b2ff:fe08:27b8%wlan0",
142// "FE01:0:0:0:0:0:0:2",
143// "20075"),
144// UdpFactory::Error);
145//
146// BOOST_CHECK_THROW(factory.createMulticastFace("fa80::20a:9dff:fef6:12ff",
147// "FE12:0:0:0:0:0:0:2",
148// "20075"),
149// UdpFactory::Error);
150//
151// //not a multicast ipv6
152// BOOST_CHECK_THROW(factory.createMulticastFace("fa80::20a:9dff:fef6:12ff",
153// "A112:0:0:0:0:0:0:2",
154// "20075"),
155// UdpFactory::Error);
156
157
158
159}
160
161class EndToEndFixture : protected BaseFixture
162{
163public:
164 void
165 channel1_onFaceCreated(const shared_ptr<UdpFace>& newFace)
166 {
167 BOOST_CHECK(!static_cast<bool>(m_face1));
168 m_face1 = newFace;
169 m_face1->onReceiveInterest +=
170 bind(&EndToEndFixture::face1_onReceiveInterest, this, _1);
171 m_face1->onReceiveData +=
172 bind(&EndToEndFixture::face1_onReceiveData, this, _1);
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700173 m_face1->onFail +=
Giulio Grassi624f6c62014-02-18 19:42:14 +0100174 bind(&EndToEndFixture::face1_onFail, this);
175 BOOST_CHECK_MESSAGE(true, "channel 1 face created");
176
177 m_faces.push_back(m_face1);
178
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700179 m_limitedIo.afterOp();
Giulio Grassi624f6c62014-02-18 19:42:14 +0100180 }
181
182 void
183 channel1_onConnectFailed(const std::string& reason)
184 {
185 BOOST_CHECK_MESSAGE(false, reason);
186
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700187 m_limitedIo.afterOp();
Giulio Grassi624f6c62014-02-18 19:42:14 +0100188 }
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700189
Giulio Grassi624f6c62014-02-18 19:42:14 +0100190 void
191 face1_onReceiveInterest(const Interest& interest)
192 {
193 m_face1_receivedInterests.push_back(interest);
194
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700195 m_limitedIo.afterOp();
Giulio Grassi624f6c62014-02-18 19:42:14 +0100196 }
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700197
Giulio Grassi624f6c62014-02-18 19:42:14 +0100198 void
199 face1_onReceiveData(const Data& data)
200 {
201 m_face1_receivedDatas.push_back(data);
202
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700203 m_limitedIo.afterOp();
Giulio Grassi624f6c62014-02-18 19:42:14 +0100204 }
205
206 void
207 face1_onFail()
208 {
209 m_face1.reset();
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700210 m_limitedIo.afterOp();
Giulio Grassi624f6c62014-02-18 19:42:14 +0100211 }
212
213 void
214 channel2_onFaceCreated(const shared_ptr<Face>& newFace)
215 {
216 BOOST_CHECK(!static_cast<bool>(m_face2));
217 m_face2 = newFace;
218 m_face2->onReceiveInterest +=
219 bind(&EndToEndFixture::face2_onReceiveInterest, this, _1);
220 m_face2->onReceiveData +=
221 bind(&EndToEndFixture::face2_onReceiveData, this, _1);
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700222 m_face2->onFail +=
Giulio Grassi624f6c62014-02-18 19:42:14 +0100223 bind(&EndToEndFixture::face2_onFail, this);
224
225 m_faces.push_back(m_face2);
226
227 BOOST_CHECK_MESSAGE(true, "channel 2 face created");
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700228 m_limitedIo.afterOp();
Giulio Grassi624f6c62014-02-18 19:42:14 +0100229 }
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700230
Giulio Grassi624f6c62014-02-18 19:42:14 +0100231 void
232 channel2_onConnectFailed(const std::string& reason)
233 {
234 BOOST_CHECK_MESSAGE(false, reason);
235
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700236 m_limitedIo.afterOp();
Giulio Grassi624f6c62014-02-18 19:42:14 +0100237 }
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700238
Giulio Grassi624f6c62014-02-18 19:42:14 +0100239 void
240 face2_onReceiveInterest(const Interest& interest)
241 {
242 m_face2_receivedInterests.push_back(interest);
243
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700244 m_limitedIo.afterOp();
Giulio Grassi624f6c62014-02-18 19:42:14 +0100245 }
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700246
Giulio Grassi624f6c62014-02-18 19:42:14 +0100247 void
248 face2_onReceiveData(const Data& data)
249 {
250 m_face2_receivedDatas.push_back(data);
251
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700252 m_limitedIo.afterOp();
Giulio Grassi624f6c62014-02-18 19:42:14 +0100253 }
254
255 void
256 face2_onFail()
257 {
258 m_face2.reset();
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700259 m_limitedIo.afterOp();
Giulio Grassi624f6c62014-02-18 19:42:14 +0100260 }
261
262 void
263 channel3_onFaceCreated(const shared_ptr<Face>& newFace)
264 {
265 BOOST_CHECK(!static_cast<bool>(m_face1));
266 m_face3 = newFace;
267 m_faces.push_back(newFace);
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700268
269 m_limitedIo.afterOp();
Giulio Grassi624f6c62014-02-18 19:42:14 +0100270 }
271
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700272
Giulio Grassi624f6c62014-02-18 19:42:14 +0100273 void
274 channel_onFaceCreated(const shared_ptr<UdpFace>& newFace)
275 {
276 m_faces.push_back(newFace);
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700277 m_limitedIo.afterOp();
Giulio Grassi624f6c62014-02-18 19:42:14 +0100278 }
279
280 void
281 channel_onConnectFailed(const std::string& reason)
282 {
283 BOOST_CHECK_MESSAGE(false, reason);
284
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700285 m_limitedIo.afterOp();
Giulio Grassi624f6c62014-02-18 19:42:14 +0100286 }
287
288 void
289 channel_onConnectFailedOk(const std::string& reason)
290 {
291 //it's ok, it was supposed to fail
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700292 m_limitedIo.afterOp();
Giulio Grassi624f6c62014-02-18 19:42:14 +0100293 }
294
295 void
296 checkFaceList(size_t shouldBe)
297 {
298 BOOST_CHECK_EQUAL(m_faces.size(), shouldBe);
299 }
Giulio Grassi624f6c62014-02-18 19:42:14 +0100300
301public:
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700302 LimitedIo m_limitedIo;
Giulio Grassi624f6c62014-02-18 19:42:14 +0100303
304 shared_ptr<Face> m_face1;
305 std::vector<Interest> m_face1_receivedInterests;
306 std::vector<Data> m_face1_receivedDatas;
307 shared_ptr<Face> m_face2;
308 std::vector<Interest> m_face2_receivedInterests;
309 std::vector<Data> m_face2_receivedDatas;
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700310
Giulio Grassi624f6c62014-02-18 19:42:14 +0100311 shared_ptr<Face> m_face3;
312
313
314 std::list< shared_ptr<Face> > m_faces;
315};
316
317
318BOOST_FIXTURE_TEST_CASE(EndToEnd, EndToEndFixture)
319{
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700320 UdpFactory factory;
Giulio Grassi624f6c62014-02-18 19:42:14 +0100321
322 shared_ptr<UdpChannel> channel2 = factory.createChannel("127.0.0.1", "20071");
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700323
324
Giulio Grassi624f6c62014-02-18 19:42:14 +0100325 //channel2->connect("127.0.0.1", "20070",
326 // bind(&EndToEndFixture::channel2_onFaceCreated, this, _1),
327 // bind(&EndToEndFixture::channel2_onConnectFailed, this, _1));
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700328
Giulio Grassi624f6c62014-02-18 19:42:14 +0100329 factory.createFace(FaceUri("udp4://127.0.0.1:20070"),
330 bind(&EndToEndFixture::channel2_onFaceCreated, this, _1),
331 bind(&EndToEndFixture::channel2_onConnectFailed, this, _1));
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700332
333
334 BOOST_CHECK_MESSAGE(m_limitedIo.run(1, time::seconds(1)) == LimitedIo::EXCEED_OPS,
335 "UdpChannel error: cannot connect or cannot accept connection");
Giulio Grassi624f6c62014-02-18 19:42:14 +0100336
337 BOOST_REQUIRE(static_cast<bool>(m_face2));
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700338
Giulio Grassi624f6c62014-02-18 19:42:14 +0100339 shared_ptr<UdpChannel> channel1 = factory.createChannel("127.0.0.1", "20070");
340 channel1->listen(bind(&EndToEndFixture::channel1_onFaceCreated, this, _1),
341 bind(&EndToEndFixture::channel1_onConnectFailed, this, _1));
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700342
Giulio Grassi624f6c62014-02-18 19:42:14 +0100343
344 Interest interest1("ndn:/TpnzGvW9R");
345 Data data1 ("ndn:/KfczhUqVix");
346 data1.setContent(0, 0);
347 Interest interest2("ndn:/QWiIMfj5sL");
348 Data data2 ("ndn:/XNBV796f");
349 data2.setContent(0, 0);
350 Interest interest3("ndn:/QWiIhjgkj5sL");
351 Data data3 ("ndn:/XNBV794f");
352 data3.setContent(0, 0);
353
354
355 ndn::SignatureSha256WithRsa fakeSignature;
356 fakeSignature.setValue(ndn::dataBlock(tlv::SignatureValue,
357 reinterpret_cast<const uint8_t*>(0),
358 0));
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700359
Giulio Grassi624f6c62014-02-18 19:42:14 +0100360 // set fake signature on data1 and data2
361 data1.setSignature(fakeSignature);
362 data2.setSignature(fakeSignature);
363 data3.setSignature(fakeSignature);
364
365 m_face2->sendInterest(interest2);
366 m_face2->sendData (data2 );
367
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700368 BOOST_CHECK_MESSAGE(m_limitedIo.run(3,//2 send + 1 listen return
369 time::seconds(1)) == LimitedIo::EXCEED_OPS,
370 "UdpChannel error: cannot send or receive Interest/Data packets");
Giulio Grassi624f6c62014-02-18 19:42:14 +0100371
372 BOOST_REQUIRE(static_cast<bool>(m_face1));
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700373
Giulio Grassi624f6c62014-02-18 19:42:14 +0100374 m_face1->sendInterest(interest1);
375 m_face1->sendData (data1 );
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700376
377 BOOST_CHECK_MESSAGE(m_limitedIo.run(2, time::seconds(1)) == LimitedIo::EXCEED_OPS,
378 "UdpChannel error: cannot send or receive Interest/Data packets");
Giulio Grassi624f6c62014-02-18 19:42:14 +0100379
380
381 BOOST_REQUIRE_EQUAL(m_face1_receivedInterests.size(), 1);
382 BOOST_REQUIRE_EQUAL(m_face1_receivedDatas .size(), 1);
383 BOOST_REQUIRE_EQUAL(m_face2_receivedInterests.size(), 1);
384 BOOST_REQUIRE_EQUAL(m_face2_receivedDatas .size(), 1);
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700385
Giulio Grassi624f6c62014-02-18 19:42:14 +0100386 BOOST_CHECK_EQUAL(m_face1_receivedInterests[0].getName(), interest2.getName());
387 BOOST_CHECK_EQUAL(m_face1_receivedDatas [0].getName(), data2.getName());
388 BOOST_CHECK_EQUAL(m_face2_receivedInterests[0].getName(), interest1.getName());
389 BOOST_CHECK_EQUAL(m_face2_receivedDatas [0].getName(), data1.getName());
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700390
391
392
Giulio Grassi624f6c62014-02-18 19:42:14 +0100393 //checking if the connection accepting mechanism works properly.
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700394
Giulio Grassi624f6c62014-02-18 19:42:14 +0100395 m_face2->sendData (data3 );
396 m_face2->sendInterest(interest3);
397
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700398 BOOST_CHECK_MESSAGE(m_limitedIo.run(2, time::seconds(1)) == LimitedIo::EXCEED_OPS,
399 "UdpChannel error: cannot send or receive Interest/Data packets");
400
Giulio Grassi624f6c62014-02-18 19:42:14 +0100401 BOOST_REQUIRE_EQUAL(m_face1_receivedInterests.size(), 2);
402 BOOST_REQUIRE_EQUAL(m_face1_receivedDatas .size(), 2);
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700403
Giulio Grassi624f6c62014-02-18 19:42:14 +0100404 BOOST_CHECK_EQUAL(m_face1_receivedInterests[1].getName(), interest3.getName());
405 BOOST_CHECK_EQUAL(m_face1_receivedDatas [1].getName(), data3.getName());
406
407}
408
409BOOST_FIXTURE_TEST_CASE(MultipleAccepts, EndToEndFixture)
410{
411 Interest interest1("ndn:/TpnzGvW9R");
412 Interest interest2("ndn:/QWiIMfj5sL");
413 Interest interest3("ndn:/QWiIhjgkj5sL");
414
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700415 UdpFactory factory;
Giulio Grassi624f6c62014-02-18 19:42:14 +0100416
Giulio Grassi624f6c62014-02-18 19:42:14 +0100417 shared_ptr<UdpChannel> channel1 = factory.createChannel("127.0.0.1", "20070");
418 shared_ptr<UdpChannel> channel2 = factory.createChannel("127.0.0.1", "20071");
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700419
420
421
Giulio Grassi624f6c62014-02-18 19:42:14 +0100422 channel1->listen(bind(&EndToEndFixture::channel_onFaceCreated, this, _1),
423 bind(&EndToEndFixture::channel_onConnectFailed, this, _1));
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700424
Giulio Grassi624f6c62014-02-18 19:42:14 +0100425 channel2->connect("127.0.0.1", "20070",
426 bind(&EndToEndFixture::channel2_onFaceCreated, this, _1),
427 bind(&EndToEndFixture::channel_onConnectFailed, this, _1));
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700428
429
430 BOOST_CHECK_MESSAGE(m_limitedIo.run(1, time::seconds(4)) == LimitedIo::EXCEED_OPS,
431 "UdpChannel error: cannot connect or cannot accept connection");
Giulio Grassi624f6c62014-02-18 19:42:14 +0100432
433 BOOST_CHECK_EQUAL(m_faces.size(), 1);
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700434
Giulio Grassi624f6c62014-02-18 19:42:14 +0100435 shared_ptr<UdpChannel> channel3 = factory.createChannel("127.0.0.1", "20072");
436 channel3->connect("127.0.0.1", "20070",
437 bind(&EndToEndFixture::channel3_onFaceCreated, this, _1),
438 bind(&EndToEndFixture::channel_onConnectFailed, this, _1));
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700439
Giulio Grassi624f6c62014-02-18 19:42:14 +0100440 shared_ptr<UdpChannel> channel4 = factory.createChannel("127.0.0.1", "20073");
441
442 BOOST_CHECK_NE(channel3, channel4);
Giulio Grassi624f6c62014-02-18 19:42:14 +0100443
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700444 scheduler::schedule(time::seconds(0.5),
445 bind(&UdpChannel::connect, channel4, "127.0.0.1", "20070",
446 // does not work without static_cast
447 static_cast<UdpChannel::FaceCreatedCallback>(
448 bind(&EndToEndFixture::channel_onFaceCreated, this, _1)),
449 static_cast<UdpChannel::ConnectFailedCallback>(
450 bind(&EndToEndFixture::channel_onConnectFailed, this, _1))));
451
452 scheduler::schedule(time::seconds(0.4), bind(&EndToEndFixture::checkFaceList, this, 2));
453
454 BOOST_CHECK_MESSAGE(m_limitedIo.run(2,// 2 connects
455 time::seconds(4)) == LimitedIo::EXCEED_OPS,
456 "UdpChannel error: cannot connect or cannot accept multiple connections");
457
Giulio Grassi624f6c62014-02-18 19:42:14 +0100458 BOOST_CHECK_EQUAL(m_faces.size(), 3);
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700459
460
Giulio Grassi624f6c62014-02-18 19:42:14 +0100461 m_face2->sendInterest(interest1);
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700462 BOOST_CHECK_MESSAGE(m_limitedIo.run(1, time::seconds(1)) == LimitedIo::EXCEED_OPS,
463 "UdpChannel error: cannot send or receive Interest/Data packets");
464
Giulio Grassi624f6c62014-02-18 19:42:14 +0100465 BOOST_CHECK_EQUAL(m_faces.size(), 4);
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700466
Giulio Grassi624f6c62014-02-18 19:42:14 +0100467 m_face3->sendInterest(interest2);
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700468 BOOST_CHECK_MESSAGE(m_limitedIo.run(1, time::seconds(1)) == LimitedIo::EXCEED_OPS,
469 "UdpChannel error: cannot send or receive Interest/Data packets");
470
Giulio Grassi624f6c62014-02-18 19:42:14 +0100471 //channel1 should have created 2 faces, one when m_face2 sent an interest, one when m_face3 sent an interest
472 BOOST_CHECK_EQUAL(m_faces.size(), 5);
473 BOOST_CHECK_THROW(channel1->listen(bind(&EndToEndFixture::channel_onFaceCreated,
474 this,
475 _1),
476 bind(&EndToEndFixture::channel_onConnectFailedOk,
477 this,
478 _1)),
479 UdpChannel::Error);
480}
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700481
Giulio Grassi624f6c62014-02-18 19:42:14 +0100482//Test commented because it required to be run in a machine that can resolve ipv6 query
483//BOOST_FIXTURE_TEST_CASE(EndToEndIpv6, EndToEndFixture)
484//{
485// UdpFactory factory = UdpFactory();
486// Scheduler scheduler(g_io); // to limit the amount of time the test may take
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700487//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100488// EventId abortEvent =
489// scheduler.scheduleEvent(time::seconds(1),
490// bind(&EndToEndFixture::abortTestCase, this,
491// "UdpChannel error: cannot connect or cannot accept connection"));
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700492//
493// m_limitedIoRemaining = 1;
494//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100495// shared_ptr<UdpChannel> channel1 = factory.createChannel("::1", "20070");
496// shared_ptr<UdpChannel> channel2 = factory.createChannel("::1", "20071");
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700497//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100498// channel1->listen(bind(&EndToEndFixture::channel1_onFaceCreated, this, _1),
499// bind(&EndToEndFixture::channel1_onConnectFailed, this, _1));
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700500//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100501// channel2->connect("::1", "20070",
502// bind(&EndToEndFixture::channel2_onFaceCreated, this, _1),
503// bind(&EndToEndFixture::channel2_onConnectFailed, this, _1));
504// g_io.run();
505// g_io.reset();
506// scheduler.cancelEvent(abortEvent);
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700507//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100508// BOOST_REQUIRE(static_cast<bool>(m_face2));
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700509//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100510// abortEvent =
511// scheduler.scheduleEvent(time::seconds(1),
512// bind(&EndToEndFixture::abortTestCase, this,
513// "UdpChannel error: cannot send or receive Interest/Data packets"));
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700514//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100515// Interest interest1("ndn:/TpnzGvW9R");
516// Data data1 ("ndn:/KfczhUqVix");
517// data1.setContent(0, 0);
518// Interest interest2("ndn:/QWiIMfj5sL");
519// Data data2 ("ndn:/XNBV796f");
520// data2.setContent(0, 0);
521// Interest interest3("ndn:/QWiIhjgkj5sL");
522// Data data3 ("ndn:/XNBV794f");
523// data3.setContent(0, 0);
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700524//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100525// ndn::SignatureSha256WithRsa fakeSignature;
526// fakeSignature.setValue(ndn::dataBlock(tlv::SignatureValue, reinterpret_cast<const uint8_t*>(0), 0));
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700527//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100528// // set fake signature on data1 and data2
529// data1.setSignature(fakeSignature);
530// data2.setSignature(fakeSignature);
531// data3.setSignature(fakeSignature);
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700532//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100533// m_face2->sendInterest(interest2);
534// m_face2->sendData (data2 );
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700535//
536// m_limitedIoRemaining = 3; //2 send + 1 listen return
Giulio Grassi624f6c62014-02-18 19:42:14 +0100537// g_io.run();
538// g_io.reset();
539// scheduler.cancelEvent(abortEvent);
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700540//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100541// BOOST_REQUIRE(static_cast<bool>(m_face1));
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700542//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100543// m_face1->sendInterest(interest1);
544// m_face1->sendData (data1 );
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700545//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100546// abortEvent =
547// scheduler.scheduleEvent(time::seconds(1),
548// bind(&EndToEndFixture::abortTestCase, this,
549// "UdpChannel error: cannot send or receive Interest/Data packets"));
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700550// m_limitedIoRemaining = 2;
Giulio Grassi624f6c62014-02-18 19:42:14 +0100551// g_io.run();
552// g_io.reset();
553// scheduler.cancelEvent(abortEvent);
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700554//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100555// BOOST_REQUIRE_EQUAL(m_face1_receivedInterests.size(), 1);
556// BOOST_REQUIRE_EQUAL(m_face1_receivedDatas .size(), 1);
557// BOOST_REQUIRE_EQUAL(m_face2_receivedInterests.size(), 1);
558// BOOST_REQUIRE_EQUAL(m_face2_receivedDatas .size(), 1);
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700559//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100560// BOOST_CHECK_EQUAL(m_face1_receivedInterests[0].getName(), interest2.getName());
561// BOOST_CHECK_EQUAL(m_face1_receivedDatas [0].getName(), data2.getName());
562// BOOST_CHECK_EQUAL(m_face2_receivedInterests[0].getName(), interest1.getName());
563// BOOST_CHECK_EQUAL(m_face2_receivedDatas [0].getName(), data1.getName());
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700564//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100565// //checking if the connection accepting mechanism works properly.
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700566//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100567// m_face2->sendData (data3 );
568// m_face2->sendInterest(interest3);
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700569//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100570// abortEvent =
571// scheduler.scheduleEvent(time::seconds(1),
572// bind(&EndToEndFixture::abortTestCase, this,
573// "UdpChannel error: cannot send or receive Interest/Data packets"));
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700574// m_limitedIoRemaining = 2;
Giulio Grassi624f6c62014-02-18 19:42:14 +0100575// g_io.run();
576// g_io.reset();
577// scheduler.cancelEvent(abortEvent);
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700578//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100579// BOOST_REQUIRE_EQUAL(m_face1_receivedInterests.size(), 2);
580// BOOST_REQUIRE_EQUAL(m_face1_receivedDatas .size(), 2);
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700581//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100582// BOOST_CHECK_EQUAL(m_face1_receivedInterests[1].getName(), interest3.getName());
583// BOOST_CHECK_EQUAL(m_face1_receivedDatas [1].getName(), data3.getName());
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700584//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100585//}
586
587
588//Test commented because it required to be run in a machine that can resolve ipv6 query
589//BOOST_FIXTURE_TEST_CASE(MultipleAcceptsIpv6, EndToEndFixture)
590//{
591// Interest interest1("ndn:/TpnzGvW9R");
592// Interest interest2("ndn:/QWiIMfj5sL");
593// Interest interest3("ndn:/QWiIhjgkj5sL");
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700594//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100595// UdpFactory factory = UdpFactory();
596// Scheduler scheduler(g_io); // to limit the amount of time the test may take
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700597//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100598// EventId abortEvent =
599// scheduler.scheduleEvent(time::seconds(4),
600// bind(&EndToEndFixture::abortTestCase, this,
601// "UdpChannel error: cannot connect or cannot accept connection"));
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700602//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100603// shared_ptr<UdpChannel> channel1 = factory.createChannel("::1", "20070");
604// shared_ptr<UdpChannel> channel2 = factory.createChannel("::1", "20071");
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700605//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100606// channel1->listen(bind(&EndToEndFixture::channel_onFaceCreated, this, _1),
607// bind(&EndToEndFixture::channel_onConnectFailed, this, _1));
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700608//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100609// channel2->connect("::1", "20070",
610// bind(&EndToEndFixture::channel2_onFaceCreated, this, _1),
611// bind(&EndToEndFixture::channel_onConnectFailed, this, _1));
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700612//
613// m_limitedIoRemaining = 1;
Giulio Grassi624f6c62014-02-18 19:42:14 +0100614// g_io.run();
615// g_io.reset();
616// scheduler.cancelEvent(abortEvent);
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700617//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100618// BOOST_CHECK_EQUAL(m_faces.size(), 1);
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700619//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100620// shared_ptr<UdpChannel> channel3 = factory.createChannel("::1", "20072");
621// channel3->connect("::1", "20070",
622// bind(&EndToEndFixture::channel3_onFaceCreated, this, _1),
623// bind(&EndToEndFixture::channel_onConnectFailed, this, _1));
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700624//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100625// shared_ptr<UdpChannel> channel4 = factory.createChannel("::1", "20073");
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700626//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100627// BOOST_CHECK_NE(channel3, channel4);
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700628//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100629// scheduler
630// .scheduleEvent(time::seconds(0.5),
631// bind(&UdpChannel::connect, channel4,
632// "::1", "20070",
633// static_cast<UdpChannel::FaceCreatedCallback>(bind(&EndToEndFixture::
634// channel_onFaceCreated, this, _1)),
635// static_cast<UdpChannel::ConnectFailedCallback>(bind(&EndToEndFixture::
636// channel_onConnectFailed, this, _1))));
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700637//
638// m_limitedIoRemaining = 2; // 2 connects
Giulio Grassi624f6c62014-02-18 19:42:14 +0100639// abortEvent =
640// scheduler.scheduleEvent(time::seconds(4),
641// bind(&EndToEndFixture::abortTestCase, this,
642// "UdpChannel error: cannot connect or cannot accept multiple connections"));
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700643//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100644// scheduler.scheduleEvent(time::seconds(0.4),
645// bind(&EndToEndFixture::checkFaceList, this, 2));
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700646//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100647// g_io.run();
648// g_io.reset();
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700649//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100650// BOOST_CHECK_EQUAL(m_faces.size(), 3);
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700651//
652//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100653// m_face2->sendInterest(interest1);
654// abortEvent =
655// scheduler.scheduleEvent(time::seconds(1),
656// bind(&EndToEndFixture::abortTestCase, this,
657// "UdpChannel error: cannot send or receive Interest/Data packets"));
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700658// m_limitedIoRemaining = 1;
Giulio Grassi624f6c62014-02-18 19:42:14 +0100659// g_io.run();
660// g_io.reset();
661// scheduler.cancelEvent(abortEvent);
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700662//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100663// BOOST_CHECK_EQUAL(m_faces.size(), 4);
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700664//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100665// m_face3->sendInterest(interest2);
666// abortEvent =
667// scheduler.scheduleEvent(time::seconds(1),
668// bind(&EndToEndFixture::abortTestCase, this,
669// "UdpChannel error: cannot send or receive Interest/Data packets"));
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700670// m_limitedIoRemaining = 1;
Giulio Grassi624f6c62014-02-18 19:42:14 +0100671// g_io.run();
672// g_io.reset();
673// scheduler.cancelEvent(abortEvent);
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700674//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100675// //channel1 should have created 2 faces, one when m_face2 sent an interest, one when m_face3 sent an interest
676// BOOST_CHECK_EQUAL(m_faces.size(), 5);
677// BOOST_CHECK_THROW(channel1->listen(bind(&EndToEndFixture::channel_onFaceCreated,
678// this,
679// _1),
680// bind(&EndToEndFixture::channel_onConnectFailedOk,
681// this,
682// _1)),
683// UdpChannel::Error);
684//}
685
686
687BOOST_FIXTURE_TEST_CASE(FaceClosing, EndToEndFixture)
688{
689 UdpFactory factory = UdpFactory();
Giulio Grassi624f6c62014-02-18 19:42:14 +0100690
Giulio Grassi624f6c62014-02-18 19:42:14 +0100691 shared_ptr<UdpChannel> channel1 = factory.createChannel("127.0.0.1", "20070");
692 shared_ptr<UdpChannel> channel2 = factory.createChannel("127.0.0.1", "20071");
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700693
Giulio Grassi624f6c62014-02-18 19:42:14 +0100694 channel1->listen(bind(&EndToEndFixture::channel1_onFaceCreated, this, _1),
695 bind(&EndToEndFixture::channel1_onConnectFailed, this, _1));
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700696
Giulio Grassi624f6c62014-02-18 19:42:14 +0100697 channel2->connect("127.0.0.1", "20070",
698 bind(&EndToEndFixture::channel2_onFaceCreated, this, _1),
699 bind(&EndToEndFixture::channel2_onConnectFailed, this, _1));
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700700
701 BOOST_CHECK_MESSAGE(m_limitedIo.run(1, time::seconds(4)) == LimitedIo::EXCEED_OPS,
702 "UdpChannel error: cannot connect or cannot accept connection");
Giulio Grassi624f6c62014-02-18 19:42:14 +0100703
704 BOOST_CHECK_EQUAL(channel2->size(), 1);
705
Giulio Grassi624f6c62014-02-18 19:42:14 +0100706 BOOST_CHECK(static_cast<bool>(m_face2));
707
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700708 // Face::close must be invoked during io run to be counted as an op
709 scheduler::schedule(time::seconds(0.1), bind(&Face::close, m_face2));
710
711 BOOST_CHECK_MESSAGE(m_limitedIo.run(1, time::seconds(4)) == LimitedIo::EXCEED_OPS,
712 "FaceClosing error: cannot properly close faces");
Giulio Grassi624f6c62014-02-18 19:42:14 +0100713
714 BOOST_CHECK(!static_cast<bool>(m_face2));
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700715
Giulio Grassi624f6c62014-02-18 19:42:14 +0100716 BOOST_CHECK_EQUAL(channel2->size(), 0);
717}
718
719//BOOST_FIXTURE_TEST_CASE(MulticastFace, EndToEndFixture)
720//{
721// //to instantiate multicast face on a specific ip address, change interfaceIp
722// std::string interfaceIp = "0.0.0.0";
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700723//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100724// UdpFactory factory = UdpFactory();
725// Scheduler scheduler(g_io); // to limit the amount of time the test may take
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700726//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100727// shared_ptr<MulticastUdpFace> multicastFace1 =
728// factory.createMulticastFace(interfaceIp, "224.0.0.1", "20072");
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700729//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100730// BOOST_REQUIRE(static_cast<bool>(multicastFace1));
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700731//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100732// channel1_onFaceCreated(multicastFace1);
733//
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700734//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100735// EventId abortEvent =
736// scheduler.scheduleEvent(time::seconds(10),
737// bind(&EndToEndFixture::abortTestCase, this,
738// "MulticastFace error: cannot send or receive Interest/Data packets"));
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700739//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100740// Interest interest1("ndn:/TpnzGvW9R");
741// Data data1 ("ndn:/KfczhUqVix");
742// data1.setContent(0, 0);
743// Interest interest2("ndn:/QWiIMfj5sL");
744// Data data2 ("ndn:/XNBV796f");
745// data2.setContent(0, 0);
746// Interest interest3("ndn:/QWiIhjgkj5sL");
747// Data data3 ("ndn:/XNBV794f");
748// data3.setContent(0, 0);
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700749//
750//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100751// ndn::SignatureSha256WithRsa fakeSignature;
752// fakeSignature.setValue(ndn::dataBlock(tlv::SignatureValue, reinterpret_cast<const uint8_t*>(0), 0));
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700753//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100754// // set fake signature on data1 and data2
755// data1.setSignature(fakeSignature);
756// data2.setSignature(fakeSignature);
757// data3.setSignature(fakeSignature);
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700758//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100759// multicastFace1->sendInterest(interest1);
760// multicastFace1->sendData (data1 );
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700761//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100762// g_io.reset();
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700763// m_limitedIoRemaining = 2;
Giulio Grassi624f6c62014-02-18 19:42:14 +0100764// g_io.run();
765// g_io.reset();
766// scheduler.cancelEvent(abortEvent);
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700767//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100768// BOOST_REQUIRE_EQUAL(m_face1_receivedInterests.size(), 1);
769// BOOST_REQUIRE_EQUAL(m_face1_receivedDatas .size(), 1);
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700770//
Giulio Grassi624f6c62014-02-18 19:42:14 +0100771// BOOST_CHECK_EQUAL(m_face1_receivedInterests[0].getName(), interest1.getName());
772// BOOST_CHECK_EQUAL(m_face1_receivedDatas [0].getName(), data1.getName());
773//}
774
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700775
776
Giulio Grassi624f6c62014-02-18 19:42:14 +0100777BOOST_AUTO_TEST_SUITE_END()
Junxiao Shi7e2413b2014-03-02 11:15:09 -0700778
Giulio Grassi624f6c62014-02-18 19:42:14 +0100779} // namespace tests
780} // namespace nfd