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 * This program is free software; you can redistribute it and/or modify | 3 * This program is free software; you can redistribute it and/or modify |
4 * it under the terms of the GNU General Public License version 2 as | 4 * it under the terms of the GNU General Public License version 2 as |
5 * published by the Free Software Foundation; | 5 * published by the Free Software Foundation; |
6 * | 6 * |
7 * This program is distributed in the hope that it will be useful, | 7 * This program is distributed in the hope that it will be useful, |
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
10 * GNU General Public License for more details. | 10 * GNU General Public License for more details. |
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
921 void | 921 void |
922 Ipv4DynamicGlobalRoutingTestCase::SendData (uint8_t index) | 922 Ipv4DynamicGlobalRoutingTestCase::SendData (uint8_t index) |
923 { | 923 { |
924 if (m_sendSocks[index].second == false) | 924 if (m_sendSocks[index].second == false) |
925 { | 925 { |
926 return; | 926 return; |
927 } | 927 } |
928 Ptr<Packet> packet = Create<Packet> (m_packetSize); | 928 Ptr<Packet> packet = Create<Packet> (m_packetSize); |
929 m_sendSocks[index].first->Send (packet); | 929 m_sendSocks[index].first->Send (packet); |
930 | 930 |
931 Time tNext (MicroSeconds (static_cast<uint64_t>(m_packetSize * 8 * 1e6 / m_dat
aRate.GetBitRate ()))); | 931 Time tNext (MicroSeconds (static_cast<uint64_t> (m_packetSize * 8 * 1e6 / m_da
taRate.GetBitRate ()))); |
932 Simulator::Schedule (tNext, &Ipv4DynamicGlobalRoutingTestCase::SendData, this,
index); | 932 Simulator::Schedule (tNext, &Ipv4DynamicGlobalRoutingTestCase::SendData, this,
index); |
933 } | 933 } |
934 | 934 |
935 void | 935 void |
936 Ipv4DynamicGlobalRoutingTestCase::ShutDownSock (uint8_t index) | 936 Ipv4DynamicGlobalRoutingTestCase::ShutDownSock (uint8_t index) |
937 { | 937 { |
938 m_sendSocks[index].second = false; | 938 m_sendSocks[index].second = false; |
939 m_sendSocks[index].first->Close (); | 939 m_sendSocks[index].first->Close (); |
940 m_sendSocks[index].first = 0; | 940 m_sendSocks[index].first = 0; |
941 } | 941 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 // 50 bytes at a rate of 2 Kb/s | 1014 // 50 bytes at a rate of 2 Kb/s |
1015 TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory"); | 1015 TypeId tid = TypeId::LookupByName ("ns3::UdpSocketFactory"); |
1016 uint16_t port = 9; // Discard port (RFC 863) | 1016 uint16_t port = 9; // Discard port (RFC 863) |
1017 | 1017 |
1018 std::pair<Ptr<Socket>, bool> sendSockA; | 1018 std::pair<Ptr<Socket>, bool> sendSockA; |
1019 sendSockA.first = Socket::CreateSocket (c.Get (1), tid); | 1019 sendSockA.first = Socket::CreateSocket (c.Get (1), tid); |
1020 sendSockA.first->Bind (); | 1020 sendSockA.first->Bind (); |
1021 sendSockA.first->Connect (InetSocketAddress (i5i6.GetAddress (1), port)); | 1021 sendSockA.first->Connect (InetSocketAddress (i5i6.GetAddress (1), port)); |
1022 sendSockA.second = true; | 1022 sendSockA.second = true; |
1023 m_sendSocks.push_back (sendSockA); | 1023 m_sendSocks.push_back (sendSockA); |
1024 Simulator::Schedule (Seconds (1.0), &Ipv4DynamicGlobalRoutingTestCase::SendDat
a, this, static_cast<uint8_t>(0)); | 1024 Simulator::Schedule (Seconds (1.0), &Ipv4DynamicGlobalRoutingTestCase::SendDat
a, this, static_cast<uint8_t> (0)); |
1025 Simulator::Schedule (Seconds (10.0), &Ipv4DynamicGlobalRoutingTestCase::ShutDo
wnSock, this, static_cast<uint8_t>(0)); | 1025 Simulator::Schedule (Seconds (10.0), &Ipv4DynamicGlobalRoutingTestCase::ShutDo
wnSock, this, static_cast<uint8_t> (0)); |
1026 | 1026 |
1027 std::pair<Ptr<Socket>, bool> sendSockB; | 1027 std::pair<Ptr<Socket>, bool> sendSockB; |
1028 sendSockB.first = Socket::CreateSocket (c.Get (1), tid); | 1028 sendSockB.first = Socket::CreateSocket (c.Get (1), tid); |
1029 sendSockB.first->Bind (); | 1029 sendSockB.first->Bind (); |
1030 sendSockB.first->Connect (InetSocketAddress (i1i6.GetAddress (1), port)); | 1030 sendSockB.first->Connect (InetSocketAddress (i1i6.GetAddress (1), port)); |
1031 sendSockB.second = true; | 1031 sendSockB.second = true; |
1032 m_sendSocks.push_back (sendSockB); | 1032 m_sendSocks.push_back (sendSockB); |
1033 Simulator::Schedule (Seconds (11.0), &Ipv4DynamicGlobalRoutingTestCase::SendDa
ta, this, static_cast<uint8_t>(1)); | 1033 Simulator::Schedule (Seconds (11.0), &Ipv4DynamicGlobalRoutingTestCase::SendDa
ta, this, static_cast<uint8_t> (1)); |
1034 Simulator::Schedule (Seconds (16.0), &Ipv4DynamicGlobalRoutingTestCase::ShutDo
wnSock, this, static_cast<uint8_t>(1)); | 1034 Simulator::Schedule (Seconds (16.0), &Ipv4DynamicGlobalRoutingTestCase::ShutDo
wnSock, this, static_cast<uint8_t> (1)); |
1035 | 1035 |
1036 | 1036 |
1037 // Create an optional packet sink to receive these packets | 1037 // Create an optional packet sink to receive these packets |
1038 Ptr<Socket> sink2 = Socket::CreateSocket (c.Get (6), tid); | 1038 Ptr<Socket> sink2 = Socket::CreateSocket (c.Get (6), tid); |
1039 sink2->Bind (Address (InetSocketAddress (Ipv4Address::GetAny (), port))); | 1039 sink2->Bind (Address (InetSocketAddress (Ipv4Address::GetAny (), port))); |
1040 sink2->Listen (); | 1040 sink2->Listen (); |
1041 sink2->ShutdownSend (); | 1041 sink2->ShutdownSend (); |
1042 | 1042 |
1043 sink2->SetRecvPktInfo (true); | 1043 sink2->SetRecvPktInfo (true); |
1044 sink2->SetRecvCallback (MakeCallback (&Ipv4DynamicGlobalRoutingTestCase::Handl
eRead, this)); | 1044 sink2->SetRecvCallback (MakeCallback (&Ipv4DynamicGlobalRoutingTestCase::Handl
eRead, this)); |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1263 AddTestCase (new LanTest, TestCase::QUICK); | 1263 AddTestCase (new LanTest, TestCase::QUICK); |
1264 AddTestCase (new TwoLinkTest, TestCase::QUICK); | 1264 AddTestCase (new TwoLinkTest, TestCase::QUICK); |
1265 AddTestCase (new TwoLanTest, TestCase::QUICK); | 1265 AddTestCase (new TwoLanTest, TestCase::QUICK); |
1266 AddTestCase (new BridgeTest, TestCase::QUICK); | 1266 AddTestCase (new BridgeTest, TestCase::QUICK); |
1267 AddTestCase (new TwoBridgeTest, TestCase::QUICK); | 1267 AddTestCase (new TwoBridgeTest, TestCase::QUICK); |
1268 AddTestCase (new Ipv4DynamicGlobalRoutingTestCase, TestCase::QUICK); | 1268 AddTestCase (new Ipv4DynamicGlobalRoutingTestCase, TestCase::QUICK); |
1269 AddTestCase (new Ipv4GlobalRoutingSlash32TestCase, TestCase::QUICK); | 1269 AddTestCase (new Ipv4GlobalRoutingSlash32TestCase, TestCase::QUICK); |
1270 } | 1270 } |
1271 | 1271 |
1272 static Ipv4GlobalRoutingTestSuite g_globalRoutingTestSuite; //!< Static variable
for test initialization | 1272 static Ipv4GlobalRoutingTestSuite g_globalRoutingTestSuite; //!< Static variable
for test initialization |
LEFT | RIGHT |