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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 //////////////////////////////////////////////////////// | 180 //////////////////////////////////////////////////////// |
181 // Set up loss model at node k1 | 181 // Set up loss model at node k1 |
182 // | 182 // |
183 | 183 |
184 std::list<uint32_t> sampleList; | 184 std::list<uint32_t> sampleList; |
185 switch (losses) | 185 switch (losses) |
186 { | 186 { |
187 case 0: | 187 case 0: |
188 break; | 188 break; |
189 case 1: | 189 case 1: |
190 // Force a loss for segment 4825:5360. TCP cwnd will be at 6 segments | 190 // Force a loss for 15th data packet. TCP cwnd will be at 14 segments |
191 // (3216 bytes) when duplicate acknowledgments start to come. | 191 // (14000 bytes) when duplicate acknowledgments start to come. |
192 sampleList.push_back (10); | 192 sampleList.push_back (16); |
193 break; | 193 break; |
194 case 2: | 194 case 2: |
195 sampleList.push_back (14); | 195 sampleList.push_back (16); |
196 sampleList.push_back (15); | 196 sampleList.push_back (17); |
197 break; | 197 break; |
198 case 3: | 198 case 3: |
199 sampleList.push_back (14); | 199 sampleList.push_back (16); |
200 sampleList.push_back (15); | 200 sampleList.push_back (17); |
201 sampleList.push_back (16); | 201 sampleList.push_back (18); |
202 break; | 202 break; |
203 case 4: | 203 case 4: |
204 sampleList.push_back (14); | |
205 sampleList.push_back (15); | |
206 sampleList.push_back (16); | 204 sampleList.push_back (16); |
207 sampleList.push_back (17); | 205 sampleList.push_back (17); |
| 206 sampleList.push_back (18); |
| 207 sampleList.push_back (19); |
208 break; | 208 break; |
209 default: | 209 default: |
210 NS_FATAL_ERROR ("Program fatal error: specified loss value not supported:
" << losses); | 210 NS_FATAL_ERROR ("Program fatal error: loss value " << losses << " not supp
orted."); |
211 break; | 211 break; |
212 } | 212 } |
213 | 213 |
214 Ptr<ReceiveListErrorModel> pem = CreateObject<ReceiveListErrorModel> (); | 214 Ptr<ReceiveListErrorModel> pem = CreateObject<ReceiveListErrorModel> (); |
215 pem->SetList (sampleList); | 215 pem->SetList (sampleList); |
216 dev1.Get (1)->SetAttribute ("ReceiveErrorModel", PointerValue (pem)); | 216 dev1.Get (1)->SetAttribute ("ReceiveErrorModel", PointerValue (pem)); |
217 | 217 |
218 // One can toggle the comment for the following line on or off to see the | 218 // One can toggle the comment for the following line on or off to see the |
219 // effects of finite send buffer modelling. One can also change the size of | 219 // effects of finite send buffer modelling. One can also change the size of |
220 // that buffer. | 220 // that buffer. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 currentTxBytes += amountSent; | 282 currentTxBytes += amountSent; |
283 } | 283 } |
284 if (needToClose) | 284 if (needToClose) |
285 { | 285 { |
286 NS_LOG_LOGIC ("Close socket at " << Simulator::Now ().GetSeconds ()); | 286 NS_LOG_LOGIC ("Close socket at " << Simulator::Now ().GetSeconds ()); |
287 localSocket->Close (); | 287 localSocket->Close (); |
288 needToClose = false; | 288 needToClose = false; |
289 } | 289 } |
290 } | 290 } |
291 | 291 |
LEFT | RIGHT |