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) 2006, 2009 INRIA | 3 * Copyright (c) 2006, 2009 INRIA |
4 * Copyright (c) 2009 MIRKO BANCHI | 4 * Copyright (c) 2009 MIRKO BANCHI |
5 * | 5 * |
6 * This program is free software; you can redistribute it and/or modify | 6 * This program is free software; you can redistribute it and/or modify |
7 * it under the terms of the GNU General Public License version 2 as· | 7 * it under the terms of the GNU General Public License version 2 as· |
8 * published by the Free Software Foundation; | 8 * published by the Free Software Foundation; |
9 * | 9 * |
10 * This program is distributed in the hope that it will be useful, | 10 * This program is distributed in the hope that it will be useful, |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 } | 351 } |
352 | 352 |
353 void | 353 void |
354 QadhocWifiMac::ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to
) | 354 QadhocWifiMac::ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to
) |
355 { | 355 { |
356 NS_LOG_FUNCTION (this << packet << from); | 356 NS_LOG_FUNCTION (this << packet << from); |
357 m_forwardUp (packet, from, to); | 357 m_forwardUp (packet, from, to); |
358 } | 358 } |
359 | 359 |
360 void | 360 void |
361 QadhocWifiMac::Receive (Ptr<Packet> packet, WifiMacHeader const *hdr) | 361 QadhocWifiMac::Receive (Ptr<Packet> packet, const WifiMacHeader *hdr) |
362 { | 362 { |
363 NS_LOG_FUNCTION (this << packet << hdr); | 363 NS_LOG_FUNCTION (this << packet << hdr); |
364 NS_ASSERT (!hdr->IsCtl ()); | 364 NS_ASSERT (!hdr->IsCtl ()); |
365 Mac48Address from = hdr->GetAddr2 (); | 365 Mac48Address from = hdr->GetAddr2 (); |
366 Mac48Address to = hdr->GetAddr1 (); | 366 Mac48Address to = hdr->GetAddr1 (); |
367 if (hdr->IsData ()) | 367 if (hdr->IsData ()) |
368 { | 368 { |
369 if (hdr->IsQosData () && hdr->IsQosAmsdu ()) | 369 if (hdr->IsQosData () && hdr->IsQosAmsdu ()) |
370 { | 370 { |
371 NS_LOG_DEBUG ("Received A-MSDU from"<<from); | 371 NS_LOG_DEBUG ("Received A-MSDU from"<<from); |
372 DeaggregateAmsduAndForward (packet, hdr); | 372 DeaggregateAmsduAndForward (packet, hdr); |
373 } | 373 } |
374 else | 374 else |
375 { | 375 { |
376 ForwardUp (packet, from, to); | 376 ForwardUp (packet, from, to); |
377 } | 377 } |
378 } | 378 } |
379 else if (hdr->IsMgt ()) | 379 else if (hdr->IsMgt ()) |
380 { | 380 { |
381 if (hdr->IsAction ()) | 381 if (hdr->IsAction ()) |
382 { | 382 { |
383 MgtActionFrameHeader actHdr; | 383 WifiActionHeader actionHdr; |
384 packet->PeekHeader (actHdr); | 384 packet->RemoveHeader (actionHdr); |
385 if (actHdr.IsAddBaRequest ()) | 385 if (actionHdr.GetCategory () == WifiActionHeader::BLOCK_ACK && |
| 386 actionHdr.GetAction().blockAck == WifiActionHeader::BLOCK_ACK_ADDB
A_REQUEST) |
386 { | 387 { |
387 MgtAddBaRequestHeader reqHdr; | 388 MgtAddBaRequestHeader reqHdr; |
388 packet->RemoveHeader (reqHdr); | 389 packet->RemoveHeader (reqHdr); |
389 SendAddBaResponse (&reqHdr, hdr->GetAddr2 ()); | 390 SendAddBaResponse (&reqHdr, hdr->GetAddr2 ()); |
390 } | 391 } |
391 else if (actHdr.IsAddBaResponse ()) | 392 else if (actionHdr.GetCategory () == WifiActionHeader::BLOCK_ACK && |
| 393 actionHdr.GetAction().blockAck == WifiActionHeader::BLOCK_ACK
_ADDBA_REQUEST) |
392 { | 394 { |
393 MgtAddBaResponseHeader respHdr; | 395 MgtAddBaResponseHeader respHdr; |
394 packet->RemoveHeader (respHdr); | 396 packet->RemoveHeader (respHdr); |
395 m_queues[QosUtilsMapTidToAc (respHdr.GetTid ())]->GotAddBaResponse
(&respHdr, hdr->GetAddr2 ()); | 397 m_queues[QosUtilsMapTidToAc (respHdr.GetTid ())]->GotAddBaResponse
(&respHdr, hdr->GetAddr2 ()); |
396 } | 398 } |
397 else if (actHdr.IsDelBa ()) | 399 else if (actionHdr.GetCategory () == WifiActionHeader::BLOCK_ACK && |
| 400 actionHdr.GetAction().blockAck == WifiActionHeader::BLOCK_ACK
_DELBA) |
398 { | 401 { |
399 MgtDelBaHeader delBaHdr; | 402 MgtDelBaHeader delBaHdr; |
400 packet->RemoveHeader (delBaHdr); | 403 packet->RemoveHeader (delBaHdr); |
401 if (delBaHdr.IsByOriginator ()) | 404 if (delBaHdr.IsByOriginator ()) |
402 { | 405 { |
403 /* Delba frame was sent by originator, this means that an ingo
ing established | 406 /* Delba frame was sent by originator, this means that an ingo
ing established |
404 agreement exists in MacLow */ | 407 agreement exists in MacLow */ |
405 m_low->DestroyBlockAckAgreement (hdr->GetAddr2 (), delBaHdr
.GetTid ()); } | 408 m_low->DestroyBlockAckAgreement (hdr->GetAddr2 (), delBaHdr
.GetTid ()); } |
406 else | 409 else |
407 { | 410 { |
408 /* We must notify correct queue tear down of agreement */ | 411 /* We must notify correct queue tear down of agreement */ |
409 AccessClass ac = QosUtilsMapTidToAc (delBaHdr.GetTid ()); | 412 AccessClass ac = QosUtilsMapTidToAc (delBaHdr.GetTid ()); |
410 m_queues[ac]->GotDelBaFrame (&delBaHdr, hdr->GetAddr2 ()); | 413 m_queues[ac]->GotDelBaFrame (&delBaHdr, hdr->GetAddr2 ()); |
411 } | 414 } |
412 } | 415 } |
413 } | 416 } |
414 } | 417 } |
415 } | 418 } |
416 | 419 |
417 void | 420 void |
418 QadhocWifiMac::DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket, | 421 QadhocWifiMac::DeaggregateAmsduAndForward (Ptr<Packet> aggregatedPacket, |
419 WifiMacHeader const *hdr) | 422 const WifiMacHeader *hdr) |
420 { | 423 { |
421 DeaggregatedMsdus packets = MsduAggregator::Deaggregate (aggregatedPacket); | 424 DeaggregatedMsdus packets = MsduAggregator::Deaggregate (aggregatedPacket); |
422 for (DeaggregatedMsdusCI i = packets.begin (); i != packets.end (); ++i) | 425 for (DeaggregatedMsdusCI i = packets.begin (); i != packets.end (); ++i) |
423 { | 426 { |
424 ForwardUp ((*i).first, (*i).second.GetSourceAddr (), | 427 ForwardUp ((*i).first, (*i).second.GetSourceAddr (), |
425 (*i).second.GetDestinationAddr ()); | 428 (*i).second.GetDestinationAddr ()); |
426 } | 429 } |
427 } | 430 } |
428 | 431 |
429 Ptr<EdcaTxopN> | 432 Ptr<EdcaTxopN> |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 edca->SetAccessClass (ac); | 464 edca->SetAccessClass (ac); |
462 edca->CompleteConfig (); | 465 edca->CompleteConfig (); |
463 m_queues.insert (std::make_pair(ac, edca)); | 466 m_queues.insert (std::make_pair(ac, edca)); |
464 } | 467 } |
465 | 468 |
466 void· | 469 void· |
467 QadhocWifiMac::FinishConfigureStandard (enum WifiPhyStandard standard) | 470 QadhocWifiMac::FinishConfigureStandard (enum WifiPhyStandard standard) |
468 { | 471 { |
469 switch (standard) | 472 switch (standard) |
470 { | 473 { |
| 474 case WIFI_PHY_STANDARD_80211p_CCH: |
| 475 ConfigureCCHDcf (m_queues[AC_BK], 15, 511, AC_BK); |
| 476 ConfigureCCHDcf (m_queues[AC_BE], 15, 511, AC_BE); |
| 477 ConfigureCCHDcf (m_queues[AC_VI], 15, 511, AC_VI); |
| 478 ConfigureCCHDcf (m_queues[AC_VO], 15, 511, AC_VO); |
| 479 break; |
| 480 case WIFI_PHY_STANDARD_80211p_SCH: |
| 481 ConfigureDcf (m_queues[AC_BK], 15, 511, AC_BK); |
| 482 ConfigureDcf (m_queues[AC_BE], 15, 511, AC_BE); |
| 483 ConfigureDcf (m_queues[AC_VI], 15, 511, AC_VI); |
| 484 ConfigureDcf (m_queues[AC_VO], 15, 511, AC_VO); |
| 485 break; |
471 case WIFI_PHY_STANDARD_holland: | 486 case WIFI_PHY_STANDARD_holland: |
472 // fall through | 487 // fall through |
473 case WIFI_PHY_STANDARD_80211a: | 488 case WIFI_PHY_STANDARD_80211a: |
474 // fall through | 489 // fall through |
475 case WIFI_PHY_STANDARD_80211_10Mhz: | 490 case WIFI_PHY_STANDARD_80211_10Mhz: |
476 // fall through | 491 // fall through |
477 case WIFI_PHY_STANDARD_80211_5Mhz: | 492 case WIFI_PHY_STANDARD_80211_5Mhz: |
478 ConfigureDcf (m_queues[AC_BK], 15, 1023, AC_BK); | 493 ConfigureDcf (m_queues[AC_BK], 15, 1023, AC_BK); |
479 ConfigureDcf (m_queues[AC_BE], 15, 1023, AC_BE); | 494 ConfigureDcf (m_queues[AC_BE], 15, 1023, AC_BE); |
480 ConfigureDcf (m_queues[AC_VI], 15, 1023, AC_VI); | 495 ConfigureDcf (m_queues[AC_VI], 15, 1023, AC_VI); |
481 ConfigureDcf (m_queues[AC_VO], 15, 1023, AC_VO); | 496 ConfigureDcf (m_queues[AC_VO], 15, 1023, AC_VO); |
482 break; | 497 break; |
483 case WIFI_PHY_STANDARD_80211b: | 498 case WIFI_PHY_STANDARD_80211b: |
484 ConfigureDcf (m_queues[AC_BK], 31, 1023, AC_BK); | 499 ConfigureDcf (m_queues[AC_BK], 31, 1023, AC_BK); |
485 ConfigureDcf (m_queues[AC_BE], 31, 1023, AC_BE); | 500 ConfigureDcf (m_queues[AC_BE], 31, 1023, AC_BE); |
486 ConfigureDcf (m_queues[AC_VI], 31, 1023, AC_VI); | 501 ConfigureDcf (m_queues[AC_VI], 31, 1023, AC_VI); |
487 ConfigureDcf (m_queues[AC_VO], 31, 1023, AC_VO); | 502 ConfigureDcf (m_queues[AC_VO], 31, 1023, AC_VO); |
488 break; | 503 break; |
489 default: | 504 default: |
490 NS_ASSERT (false); | 505 NS_ASSERT (false); |
491 break; | 506 break; |
492 } | 507 } |
493 } | 508 } |
494 | 509 |
| 510 |
495 void | 511 void |
496 QadhocWifiMac::SendAddBaResponse (const MgtAddBaRequestHeader *reqHdr, Mac48Addr
ess originator) | 512 QadhocWifiMac::SendAddBaResponse (const MgtAddBaRequestHeader *reqHdr, Mac48Addr
ess originator) |
497 { | 513 { |
498 NS_LOG_FUNCTION (this); | 514 NS_LOG_FUNCTION (this); |
499 WifiMacHeader hdr; | 515 WifiMacHeader hdr; |
500 hdr.SetAction (); | 516 hdr.SetAction (); |
501 hdr.SetAddr1 (originator); | 517 hdr.SetAddr1 (originator); |
502 hdr.SetAddr2 (m_low->GetAddress ()); | 518 hdr.SetAddr2 (m_low->GetAddress ()); |
503 hdr.SetAddr3 (GetBssid ()); | 519 hdr.SetAddr3 (m_low->GetAddress ()); |
504 hdr.SetDsNotFrom (); | 520 hdr.SetDsNotFrom (); |
505 hdr.SetDsNotTo (); | 521 hdr.SetDsNotTo (); |
506 | 522 |
507 MgtAddBaResponseHeader respHdr; | 523 MgtAddBaResponseHeader respHdr; |
508 StatusCode code; | 524 StatusCode code; |
509 code.SetSuccess (); | 525 code.SetSuccess (); |
510 respHdr.SetStatusCode (code); | 526 respHdr.SetStatusCode (code); |
511 //Here a control about queues type? | 527 //Here a control about queues type? |
512 respHdr.SetAmsduSupport (reqHdr->IsAmsduSupported ()); | 528 respHdr.SetAmsduSupport (reqHdr->IsAmsduSupported ()); |
513 | 529 |
(...skipping 10 matching lines...) Expand all Loading... |
524 We assume that receiver has no limit on reception. | 540 We assume that receiver has no limit on reception. |
525 However we assume that a receiver sets a bufferSize in order to satisfy | 541 However we assume that a receiver sets a bufferSize in order to satisfy |
526 next equation: | 542 next equation: |
527 (bufferSize + 1) % 16 = 0 | 543 (bufferSize + 1) % 16 = 0 |
528 So if a recipient is able to buffer a packet, it should be also able to buf
fer | 544 So if a recipient is able to buffer a packet, it should be also able to buf
fer |
529 all possible packet's fragments. | 545 all possible packet's fragments. |
530 See section 7.3.1.14 in IEEE802.11e for more details. */ | 546 See section 7.3.1.14 in IEEE802.11e for more details. */ |
531 respHdr.SetBufferSize (1023); | 547 respHdr.SetBufferSize (1023); |
532 respHdr.SetTimeout (reqHdr->GetTimeout ()); | 548 respHdr.SetTimeout (reqHdr->GetTimeout ()); |
533 | 549 |
| 550 WifiActionHeader actionHdr; |
| 551 WifiActionHeader::ActionValue action; |
| 552 action.blockAck = WifiActionHeader::BLOCK_ACK_ADDBA_RESPONSE; |
| 553 actionHdr.SetAction (WifiActionHeader::BLOCK_ACK, action); |
| 554 |
534 Ptr<Packet> packet = Create<Packet> (); | 555 Ptr<Packet> packet = Create<Packet> (); |
535 packet->AddHeader (respHdr); | 556 packet->AddHeader (respHdr); |
| 557 packet->AddHeader (actionHdr); |
536 ·· | 558 ·· |
537 /* ns3::MacLow have to buffer all correctly received packet for this block ack
session */ | 559 /* ns3::MacLow have to buffer all correctly received packet for this block ack
session */ |
538 m_low->CreateBlockAckAgreement (&respHdr, originator, reqHdr->GetStartingSeque
nce ()); | 560 m_low->CreateBlockAckAgreement (&respHdr, originator, reqHdr->GetStartingSeque
nce ()); |
539 | 561 |
540 //Better a management queue?· | 562 //Better a management queue?· |
541 m_queues[QosUtilsMapTidToAc (reqHdr->GetTid ())]->PushFront (packet, hdr); | 563 m_queues[QosUtilsMapTidToAc (reqHdr->GetTid ())]->PushFront (packet, hdr); |
542 } | 564 } |
543 | |
544 } //namespace ns3 | 565 } //namespace ns3 |
LEFT | RIGHT |