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) 2009-2010 TELEMATICS LAB - Poliotecnico di Bari | 3 * Copyright (c) 2009-2010 TELEMATICS LAB - Poliotecnico di Bari |
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 WimaxConnection *connectionTx = new WimaxConnection (cid, Cid::TRANSPORT); | 68 WimaxConnection *connectionTx = new WimaxConnection (cid, Cid::TRANSPORT); |
69 WimaxConnection *connectionRx = new WimaxConnection (cid, Cid::TRANSPORT); | 69 WimaxConnection *connectionRx = new WimaxConnection (cid, Cid::TRANSPORT); |
70 | 70 |
71 // A Packet of 1000 bytes has been created. | 71 // A Packet of 1000 bytes has been created. |
72 // It will be fragmentated into 4 fragments and then defragmentated into fullP
acket. | 72 // It will be fragmentated into 4 fragments and then defragmentated into fullP
acket. |
73 Ptr<Packet> packet = Create<Packet> (1000); | 73 Ptr<Packet> packet = Create<Packet> (1000); |
74 Ptr<Packet> fragment; | 74 Ptr<Packet> fragment; |
75 Ptr<Packet> fullPacket = Create<Packet> (); | 75 Ptr<Packet> fullPacket = Create<Packet> (); |
76 | 76 |
77 // Enqueued packet | 77 // Enqueued packet |
78 hdr.SetLen ((uint16_t)(packet->GetSize () + hdr.GetSerializedSize ())); | 78 hdr.SetLen (static_cast<uint16_t> (packet->GetSize () + hdr.GetSerializedSize
())); |
79 hdr.SetCid (connectionTx->GetCid ()); | 79 hdr.SetCid (connectionTx->GetCid ()); |
80 MacHeaderType::HeaderType packetType = MacHeaderType::HEADER_TYPE_GENERIC; | 80 MacHeaderType::HeaderType packetType = MacHeaderType::HEADER_TYPE_GENERIC; |
81 | 81 |
82 connectionTx->Enqueue (packet, (uint8_t)packetType, hdr); | 82 connectionTx->Enqueue (packet, static_cast<uint8_t> (packetType), hdr); |
83 | 83 |
84 uint32_t availableByteForFragment = 280; | 84 uint32_t availableByteForFragment = 280; |
85 for (int i = 0; i < 4; i++) | 85 for (int i = 0; i < 4; i++) |
86 { | 86 { |
87 // dequeue a fragment | 87 // dequeue a fragment |
88 if (connectionTx->GetQueue ()->GetFirstPacketRequiredByte (packetType) > a
vailableByteForFragment) | 88 if (connectionTx->GetQueue ()->GetFirstPacketRequiredByte (packetType) > a
vailableByteForFragment) |
89 { | 89 { |
90 fragment = connectionTx->Dequeue (packetType, availableByteForFragment
); | 90 fragment = connectionTx->Dequeue (packetType, availableByteForFragment
); |
91 } | 91 } |
92 else | 92 else |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 Ns3WimaxFragmentationTestSuite (); | 154 Ns3WimaxFragmentationTestSuite (); |
155 }; | 155 }; |
156 | 156 |
157 Ns3WimaxFragmentationTestSuite::Ns3WimaxFragmentationTestSuite () | 157 Ns3WimaxFragmentationTestSuite::Ns3WimaxFragmentationTestSuite () |
158 : TestSuite ("wimax-fragmentation", UNIT) | 158 : TestSuite ("wimax-fragmentation", UNIT) |
159 { | 159 { |
160 AddTestCase (new Ns3WimaxFragmentationTestCase, TestCase::QUICK); | 160 AddTestCase (new Ns3WimaxFragmentationTestCase, TestCase::QUICK); |
161 } | 161 } |
162 | 162 |
163 static Ns3WimaxFragmentationTestSuite ns3WimaxFragmentationTestSuite; ///< the t
est suite | 163 static Ns3WimaxFragmentationTestSuite ns3WimaxFragmentationTestSuite; ///< the t
est suite |
LEFT | RIGHT |