LEFT | RIGHT |
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2013 Universita' di Firenze, Italy | 3 * Copyright (c) 2013 Universita' di Firenze, Italy |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
15 * along with this program; if not, write to the Free Software | 15 * along with this program; if not, write to the Free Software |
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
17 * | 17 * |
18 * Author: Tommaso Pecorella <tommaso.pecorella@unifi.it> | 18 * Author: Tommaso Pecorella <tommaso.pecorella@unifi.it> |
19 */ | 19 */ |
20 #define NS3_LOG_ENABLE 1 | 20 #define NS3_LOG_ENABLE 1 |
21 | 21 |
22 #include "ns3/test.h" | 22 #include "ns3/test.h" |
23 #include "ns3/config.h" | 23 #include "ns3/config.h" |
24 #include "ns3/uinteger.h" | 24 #include "ns3/uinteger.h" |
25 #include "ns3/socket-factory.h" | 25 #include "ns3/socket-factory.h" |
26 #include "ns3/ipv6-raw-socket-factory.h" | 26 #include "ns3/ipv6-raw-socket-factory.h" |
27 #include "ns3/udp-socket-factory.h" | 27 #include "ns3/udp-socket-factory.h" |
28 #include "ns3/simulator.h" | 28 #include "ns3/simulator.h" |
29 #include "error-channel-sixlow.h" | 29 #include "error-channel-sixlow.h" |
30 #include "error-net-device-sixlow.h" | 30 #include "ns3/simple-net-device.h" |
31 #include "ns3/drop-tail-queue.h" | 31 #include "ns3/drop-tail-queue.h" |
32 #include "ns3/socket.h" | 32 #include "ns3/socket.h" |
33 #include "ns3/udp-socket.h" | 33 #include "ns3/udp-socket.h" |
34 | 34 |
35 #include "ns3/log.h" | 35 #include "ns3/log.h" |
36 #include "ns3/node.h" | 36 #include "ns3/node.h" |
37 #include "ns3/inet-socket-address.h" | 37 #include "ns3/inet-socket-address.h" |
38 #include "ns3/boolean.h" | 38 #include "ns3/boolean.h" |
39 | 39 |
40 #include "ns3/ipv6-static-routing.h" | 40 #include "ns3/ipv6-static-routing.h" |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 } | 255 } |
256 | 256 |
257 void | 257 void |
258 SixlowpanFragmentationTest::DoRun (void) | 258 SixlowpanFragmentationTest::DoRun (void) |
259 { | 259 { |
260 // Create topology | 260 // Create topology |
261 | 261 |
262 // Receiver Node | 262 // Receiver Node |
263 Ptr<Node> serverNode = CreateObject<Node> (); | 263 Ptr<Node> serverNode = CreateObject<Node> (); |
264 AddInternetStack (serverNode); | 264 AddInternetStack (serverNode); |
265 Ptr<ErrorNetDeviceSixlow> serverDev; | 265 Ptr<SimpleNetDevice> serverDev; |
266 Ptr<BinaryErrorSixlowModel> serverDevErrorModel = CreateObject<BinaryErrorSixl
owModel> (); | 266 Ptr<BinaryErrorSixlowModel> serverDevErrorModel = CreateObject<BinaryErrorSixl
owModel> (); |
267 { | 267 { |
268 serverDev = CreateObject<ErrorNetDeviceSixlow> (); | 268 serverDev = CreateObject<SimpleNetDevice> (); |
269 serverDev->SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ())
); | 269 serverDev->SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ())
); |
270 serverDev->SetMtu (1500); | 270 serverDev->SetMtu (1500); |
271 serverDev->SetReceiveErrorModel (serverDevErrorModel); | 271 serverDev->SetReceiveErrorModel (serverDevErrorModel); |
272 serverDevErrorModel->Disable (); | 272 serverDevErrorModel->Disable (); |
273 serverNode->AddDevice (serverDev); | 273 serverNode->AddDevice (serverDev); |
274 | 274 |
275 Ptr<SixLowPanNetDevice> serverSix = CreateObject<SixLowPanNetDevice> (); | 275 Ptr<SixLowPanNetDevice> serverSix = CreateObject<SixLowPanNetDevice> (); |
276 serverSix->SetAttribute ("ForceEtherType", BooleanValue (true) ); | 276 serverSix->SetAttribute ("ForceEtherType", BooleanValue (true) ); |
277 serverNode->AddDevice (serverSix); | 277 serverNode->AddDevice (serverSix); |
278 serverSix->SetNetDevice (serverDev); | 278 serverSix->SetNetDevice (serverDev); |
279 | 279 |
280 Ptr<Ipv6> ipv6 = serverNode->GetObject<Ipv6> (); | 280 Ptr<Ipv6> ipv6 = serverNode->GetObject<Ipv6> (); |
281 ipv6->AddInterface (serverDev); | 281 ipv6->AddInterface (serverDev); |
282 uint32_t netdev_idx = ipv6->AddInterface (serverSix); | 282 uint32_t netdev_idx = ipv6->AddInterface (serverSix); |
283 Ipv6InterfaceAddress ipv6Addr = Ipv6InterfaceAddress (Ipv6Address ("2001:010
0::1"), Ipv6Prefix (64)); | 283 Ipv6InterfaceAddress ipv6Addr = Ipv6InterfaceAddress (Ipv6Address ("2001:010
0::1"), Ipv6Prefix (64)); |
284 ipv6->AddAddress (netdev_idx, ipv6Addr); | 284 ipv6->AddAddress (netdev_idx, ipv6Addr); |
285 ipv6->SetUp (netdev_idx); | 285 ipv6->SetUp (netdev_idx); |
286 | 286 |
287 Ptr<Icmpv6L4Protocol> icmpv6l4 = serverNode->GetObject<Icmpv6L4Protocol> (); | 287 Ptr<Icmpv6L4Protocol> icmpv6l4 = serverNode->GetObject<Icmpv6L4Protocol> (); |
288 icmpv6l4->SetAttribute("DAD", BooleanValue (false)); | 288 icmpv6l4->SetAttribute("DAD", BooleanValue (false)); |
289 } | 289 } |
290 StartServer (serverNode); | 290 StartServer (serverNode); |
291 | 291 |
292 // Sender Node | 292 // Sender Node |
293 Ptr<Node> clientNode = CreateObject<Node> (); | 293 Ptr<Node> clientNode = CreateObject<Node> (); |
294 AddInternetStack (clientNode); | 294 AddInternetStack (clientNode); |
295 Ptr<ErrorNetDeviceSixlow> clientDev; | 295 Ptr<SimpleNetDevice> clientDev; |
296 Ptr<BinaryErrorSixlowModel> clientDevErrorModel = CreateObject<BinaryErrorSixl
owModel> (); | 296 Ptr<BinaryErrorSixlowModel> clientDevErrorModel = CreateObject<BinaryErrorSixl
owModel> (); |
297 { | 297 { |
298 clientDev = CreateObject<ErrorNetDeviceSixlow> (); | 298 clientDev = CreateObject<SimpleNetDevice> (); |
299 clientDev->SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ())
); | 299 clientDev->SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ())
); |
300 clientDev->SetMtu (150); | 300 clientDev->SetMtu (150); |
301 clientDev->SetReceiveErrorModel (clientDevErrorModel); | 301 clientDev->SetReceiveErrorModel (clientDevErrorModel); |
302 clientDevErrorModel->Disable (); | 302 clientDevErrorModel->Disable (); |
303 clientNode->AddDevice (clientDev); | 303 clientNode->AddDevice (clientDev); |
304 | 304 |
305 Ptr<SixLowPanNetDevice> clientSix = CreateObject<SixLowPanNetDevice> (); | 305 Ptr<SixLowPanNetDevice> clientSix = CreateObject<SixLowPanNetDevice> (); |
306 clientSix->SetAttribute ("ForceEtherType", BooleanValue (true) ); | 306 clientSix->SetAttribute ("ForceEtherType", BooleanValue (true) ); |
307 serverNode->AddDevice (clientSix); | 307 serverNode->AddDevice (clientSix); |
308 clientSix->SetNetDevice (clientDev); | 308 clientSix->SetNetDevice (clientDev); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 } | 454 } |
455 //----------------------------------------------------------------------------- | 455 //----------------------------------------------------------------------------- |
456 class SixlowpanFragmentationTestSuite : public TestSuite | 456 class SixlowpanFragmentationTestSuite : public TestSuite |
457 { | 457 { |
458 public: | 458 public: |
459 SixlowpanFragmentationTestSuite () : TestSuite ("sixlowpan-fragmentation", UNI
T) | 459 SixlowpanFragmentationTestSuite () : TestSuite ("sixlowpan-fragmentation", UNI
T) |
460 { | 460 { |
461 AddTestCase (new SixlowpanFragmentationTest, TestCase::QUICK); | 461 AddTestCase (new SixlowpanFragmentationTest, TestCase::QUICK); |
462 } | 462 } |
463 } g_sixlowpanFragmentationTestSuite; | 463 } g_sixlowpanFragmentationTestSuite; |
LEFT | RIGHT |