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 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 | 130 |
131 // Receiver Node | 131 // Receiver Node |
132 Ptr<Node> rxNode = CreateObject<Node> (); | 132 Ptr<Node> rxNode = CreateObject<Node> (); |
133 AddInternetStack6 (rxNode); | 133 AddInternetStack6 (rxNode); |
134 Ptr<SimpleNetDevice> rxDev; | 134 Ptr<SimpleNetDevice> rxDev; |
135 { // first interface | 135 { // first interface |
136 rxDev = CreateObject<SimpleNetDevice> (); | 136 rxDev = CreateObject<SimpleNetDevice> (); |
137 rxDev->SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ())); | 137 rxDev->SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ())); |
138 rxNode->AddDevice (rxDev); | 138 rxNode->AddDevice (rxDev); |
139 | 139 |
140 Ptr<sixlowpan::SixLowPanNetDevice> rxSix = CreateObject<sixlowpan::SixLowPan
NetDevice> (); | 140 Ptr<SixLowPanNetDevice> rxSix = CreateObject<SixLowPanNetDevice> (); |
141 rxSix->SetAttribute ("ForceEtherType", BooleanValue (true) ); | 141 rxSix->SetAttribute ("ForceEtherType", BooleanValue (true) ); |
142 rxNode->AddDevice (rxSix); | 142 rxNode->AddDevice (rxSix); |
143 rxSix->SetNetDevice (rxDev); | 143 rxSix->SetNetDevice (rxDev); |
144 | 144 |
145 Ptr<Ipv6> ipv6 = rxNode->GetObject<Ipv6> (); | 145 Ptr<Ipv6> ipv6 = rxNode->GetObject<Ipv6> (); |
146 ipv6->AddInterface (rxDev); | 146 ipv6->AddInterface (rxDev); |
147 uint32_t netdev_idx = ipv6->AddInterface (rxSix); | 147 uint32_t netdev_idx = ipv6->AddInterface (rxSix); |
148 Ipv6InterfaceAddress ipv6Addr = Ipv6InterfaceAddress (Ipv6Address ("2001:010
0::1"), Ipv6Prefix (64)); | 148 Ipv6InterfaceAddress ipv6Addr = Ipv6InterfaceAddress (Ipv6Address ("2001:010
0::1"), Ipv6Prefix (64)); |
149 ipv6->AddAddress (netdev_idx, ipv6Addr); | 149 ipv6->AddAddress (netdev_idx, ipv6Addr); |
150 ipv6->SetUp (netdev_idx); | 150 ipv6->SetUp (netdev_idx); |
151 } | 151 } |
152 | 152 |
153 // Sender Node | 153 // Sender Node |
154 Ptr<Node> txNode = CreateObject<Node> (); | 154 Ptr<Node> txNode = CreateObject<Node> (); |
155 AddInternetStack6 (txNode); | 155 AddInternetStack6 (txNode); |
156 Ptr<SimpleNetDevice> txDev; | 156 Ptr<SimpleNetDevice> txDev; |
157 { | 157 { |
158 txDev = CreateObject<SimpleNetDevice> (); | 158 txDev = CreateObject<SimpleNetDevice> (); |
159 txDev->SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ())); | 159 txDev->SetAddress (Mac48Address::ConvertFrom (Mac48Address::Allocate ())); |
160 txNode->AddDevice (txDev); | 160 txNode->AddDevice (txDev); |
161 | 161 |
162 Ptr<sixlowpan::SixLowPanNetDevice> txSix = CreateObject<sixlowpan::SixLowPan
NetDevice> (); | 162 Ptr<SixLowPanNetDevice> txSix = CreateObject<SixLowPanNetDevice> (); |
163 txSix->SetAttribute ("ForceEtherType", BooleanValue (true) ); | 163 txSix->SetAttribute ("ForceEtherType", BooleanValue (true) ); |
164 txNode->AddDevice (txSix); | 164 txNode->AddDevice (txSix); |
165 txSix->SetNetDevice (txDev); | 165 txSix->SetNetDevice (txDev); |
166 | 166 |
167 Ptr<Ipv6> ipv6 = txNode->GetObject<Ipv6> (); | 167 Ptr<Ipv6> ipv6 = txNode->GetObject<Ipv6> (); |
168 ipv6->AddInterface (txDev); | 168 ipv6->AddInterface (txDev); |
169 uint32_t netdev_idx = ipv6->AddInterface (txSix); | 169 uint32_t netdev_idx = ipv6->AddInterface (txSix); |
170 Ipv6InterfaceAddress ipv6Addr = Ipv6InterfaceAddress (Ipv6Address ("2001:010
0::2"), Ipv6Prefix (64)); | 170 Ipv6InterfaceAddress ipv6Addr = Ipv6InterfaceAddress (Ipv6Address ("2001:010
0::2"), Ipv6Prefix (64)); |
171 ipv6->AddAddress (netdev_idx, ipv6Addr); | 171 ipv6->AddAddress (netdev_idx, ipv6Addr); |
172 ipv6->SetUp (netdev_idx); | 172 ipv6->SetUp (netdev_idx); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 205 |
206 //----------------------------------------------------------------------------- | 206 //----------------------------------------------------------------------------- |
207 class SixlowpanIphcTestSuite : public TestSuite | 207 class SixlowpanIphcTestSuite : public TestSuite |
208 { | 208 { |
209 public: | 209 public: |
210 SixlowpanIphcTestSuite () : TestSuite ("sixlowpan-iphc", UNIT) | 210 SixlowpanIphcTestSuite () : TestSuite ("sixlowpan-iphc", UNIT) |
211 { | 211 { |
212 AddTestCase (new SixlowpanIphcImplTest, TestCase::QUICK); | 212 AddTestCase (new SixlowpanIphcImplTest, TestCase::QUICK); |
213 } | 213 } |
214 } g_sixlowpanIphcTestSuite; | 214 } g_sixlowpanIphcTestSuite; |
LEFT | RIGHT |