A Discrete-Event Network Simulator
API
ss-net-device.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007,2008,2009 INRIA, UDcast
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Authors: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr>
18  * Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
19  * <amine.ismail@UDcast.com>
20  */
21 
22 #include "ss-net-device.h"
23 
24 #include "bandwidth-manager.h"
25 #include "burst-profile-manager.h"
26 #include "connection-manager.h"
27 #include "dl-mac-messages.h"
28 #include "service-flow-manager.h"
29 #include "service-flow-record.h"
30 #include "service-flow.h"
31 #include "ss-link-manager.h"
32 #include "ss-scheduler.h"
33 #include "ul-mac-messages.h"
34 #include "wimax-mac-queue.h"
35 #include "wimax-phy.h"
36 
37 #include "ns3/config.h"
38 #include "ns3/enum.h"
39 #include "ns3/node.h"
40 #include "ns3/packet-burst.h"
41 #include "ns3/pointer.h"
42 #include "ns3/simulator.h"
43 #include "ns3/trace-source-accessor.h"
44 
45 #include <algorithm>
46 
47 namespace ns3
48 {
49 
50 NS_LOG_COMPONENT_DEFINE("SubscriberStationNetDevice");
51 
52 NS_OBJECT_ENSURE_REGISTERED(SubscriberStationNetDevice);
53 
54 Time
56 {
57  return (MicroSeconds(500000));
58 }
59 
60 TypeId
62 {
63  static TypeId tid =
64  TypeId("ns3::SubscriberStationNetDevice")
65 
67  .SetGroupName("Wimax")
68 
69  .AddConstructor<SubscriberStationNetDevice>()
70 
71  .AddAttribute("BasicConnection",
72  "Basic connection",
73  PointerValue(),
75  MakePointerChecker<WimaxConnection>())
76 
77  .AddAttribute("PrimaryConnection",
78  "Primary connection",
79  PointerValue(),
81  MakePointerChecker<WimaxConnection>())
82 
83  .AddAttribute("LostDlMapInterval",
84  "Time since last received DL-MAP message before downlink synchronization "
85  "is considered lost. Maximum is 600ms",
86  TimeValue(Seconds(0.5)),
90 
91  .AddAttribute("LostUlMapInterval",
92  "Time since last received UL-MAP before uplink synchronization is "
93  "considered lost, maximum is 600.",
94  TimeValue(MilliSeconds(500)),
98 
99  .AddAttribute("MaxDcdInterval",
100  "Maximum time between transmission of DCD messages. Maximum is 10s",
101  TimeValue(Seconds(10)),
104  MakeTimeChecker())
105 
106  .AddAttribute("MaxUcdInterval",
107  "Maximum time between transmission of UCD messages. Maximum is 10s",
108  TimeValue(Seconds(10)),
111  MakeTimeChecker())
112 
113  .AddAttribute("IntervalT1",
114  "Wait for DCD timeout. Maximum is 5*maxDcdInterval",
115  TimeValue(Seconds(50)),
118  MakeTimeChecker())
119 
120  .AddAttribute("IntervalT2",
121  "Wait for broadcast ranging timeout, i.e., wait for initial ranging "
122  "opportunity. Maximum is 5*Ranging interval",
123  TimeValue(Seconds(10)),
126  MakeTimeChecker())
127 
128  .AddAttribute("IntervalT3",
129  "ranging Response reception timeout following the transmission of a "
130  "ranging request. Maximum is 200ms",
131  TimeValue(Seconds(0.2)),
134  MakeTimeChecker())
135 
136  .AddAttribute("IntervalT7",
137  "wait for DSA/DSC/DSD Response timeout. Maximum is 1s",
138  TimeValue(Seconds(0.1)),
141  MakeTimeChecker())
142 
143  .AddAttribute("IntervalT12",
144  "Wait for UCD descriptor.Maximum is 5*MaxUcdInterval",
145  TimeValue(Seconds(10)),
148  MakeTimeChecker())
149 
150  .AddAttribute(
151  "IntervalT20",
152  "Time the SS searches for preambles on a given channel. Minimum is 2 MAC frames",
153  TimeValue(Seconds(0.5)),
156  MakeTimeChecker())
157 
158  .AddAttribute("IntervalT21",
159  "time the SS searches for (decodable) DL-MAP on a given channel",
160  TimeValue(Seconds(10)),
163  MakeTimeChecker())
164 
165  .AddAttribute(
166  "MaxContentionRangingRetries",
167  "Number of retries on contention Ranging Requests",
168  UintegerValue(16),
171  MakeUintegerChecker<uint8_t>(1, 16))
172 
173  .AddAttribute("SSScheduler",
174  "The ss scheduler attached to this device.",
175  PointerValue(),
178  MakePointerChecker<SSScheduler>())
179 
180  .AddAttribute("LinkManager",
181  "The ss link manager attached to this device.",
182  PointerValue(),
185  MakePointerChecker<SSLinkManager>())
186 
187  .AddAttribute("Classifier",
188  "The ss classifier attached to this device.",
189  PointerValue(),
192  MakePointerChecker<IpcsClassifier>())
193 
194  .AddTraceSource(
195  "SSTxDrop",
196  "A packet has been dropped in the MAC layer before being queued for transmission.",
198  "ns3::Packet::TracedCallback")
199 
200  .AddTraceSource(
201  "SSPromiscRx",
202  "A packet has been received by this device, has been passed up from the physical "
203  "layer "
204  "and is being forwarded up the local protocol stack. This is a promiscuous trace,",
206  "ns3::Packet::TracedCallback")
207 
208  .AddTraceSource("SSRx",
209  "A packet has been received by this device, has been passed up from "
210  "the physical layer "
211  "and is being forwarded up the local protocol stack. This is a "
212  "non-promiscuous trace,",
214  "ns3::Packet::TracedCallback")
215 
216  .AddTraceSource("SSRxDrop",
217  "A packet has been dropped in the MAC layer after it has been passed "
218  "up from the physical "
219  "layer.",
221  "ns3::Packet::TracedCallback");
222  return tid;
223 }
224 
226 {
228 }
229 
230 void
232 {
238  m_intervalT2 = Seconds(5 * 2); // shall be 5 * RangingInterval, if ranging interval=see T2 at
239  // page 638) means Initial Ranging Interval=see page 637)
240  m_intervalT3 = MilliSeconds(200);
241  m_intervalT7 = Seconds(0.1); // maximum is 1
243  m_intervalT21 = Seconds(11);
245  m_dcdCount = 0;
246  m_baseStationId = Mac48Address("00:00:00:00:00:00");
247  m_ucdCount = 0;
249  m_nrDlMapElements = 0;
250  m_nrUlMapElements = 0;
251  m_nrDlMapRecvd = 0;
252  m_nrUlMapRecvd = 0;
253  m_nrDcdRecvd = 0;
254  m_nrUcdRecvd = 0;
258 
259  m_basicConnection = nullptr;
260  m_primaryConnection = nullptr;
261 
264  m_classifier = CreateObject<IpcsClassifier>();
265  m_linkManager = CreateObject<SSLinkManager>(this);
266  m_scheduler = CreateObject<SSScheduler>(this);
267  m_serviceFlowManager = CreateObject<SsServiceFlowManager>(this);
268 }
269 
271 {
273  this->SetNode(node);
274  this->SetPhy(phy);
275 }
276 
278 {
279 }
280 
281 void
283 {
284  delete m_dlBurstProfile;
285  delete m_ulBurstProfile;
286  m_scheduler = nullptr;
287  m_serviceFlowManager = nullptr;
288  m_basicConnection = nullptr;
289  m_primaryConnection = nullptr;
290  m_classifier = nullptr;
291  m_dlBurstProfile = nullptr;
292  m_ulBurstProfile = nullptr;
293 
294  m_linkManager = nullptr;
295 
299 
301 }
302 
303 void
305 {
306  m_lostDlMapInterval = lostDlMapInterval;
307 }
308 
309 Time
311 {
312  return m_lostDlMapInterval;
313 }
314 
315 void
317 {
318  m_lostUlMapInterval = lostUlMapInterval;
319 }
320 
321 Time
323 {
324  return m_lostUlMapInterval;
325 }
326 
327 void
329 {
330  m_maxDcdInterval = maxDcdInterval;
331 }
332 
333 Time
335 {
336  return m_maxDcdInterval;
337 }
338 
339 void
341 {
342  m_maxUcdInterval = maxUcdInterval;
343 }
344 
345 Time
347 {
348  return m_maxUcdInterval;
349 }
350 
351 void
353 {
354  m_intervalT1 = interval;
355 }
356 
357 Time
359 {
360  return m_intervalT1;
361 }
362 
363 void
365 {
366  m_intervalT2 = interval;
367 }
368 
369 Time
371 {
372  return m_intervalT2;
373 }
374 
375 void
377 {
378  m_intervalT3 = interval;
379 }
380 
381 Time
383 {
384  return m_intervalT3;
385 }
386 
387 void
389 {
390  m_intervalT7 = interval;
391 }
392 
393 Time
395 {
396  return m_intervalT7;
397 }
398 
399 void
401 {
402  m_intervalT12 = interval;
403 }
404 
405 Time
407 {
408  return m_intervalT12;
409 }
410 
411 void
413 {
414  m_intervalT20 = interval;
415 }
416 
417 Time
419 {
420  return m_intervalT20;
421 }
422 
423 void
425 {
426  m_intervalT21 = interval;
427 }
428 
429 Time
431 {
432  return m_intervalT21;
433 }
434 
435 void
437 {
438  m_maxContentionRangingRetries = maxContentionRangingRetries;
439 }
440 
441 uint8_t
443 {
445 }
446 
447 void
449 {
450  m_basicConnection = basicConnection;
451  uint32_t nodeId = GetNode()->GetId();
452  uint32_t ifaceId = GetIfIndex();
453 
455  {
456  std::ostringstream oss;
457  oss << "/NodeList/" << nodeId << "/DeviceList/" << ifaceId
458  << "/$ns3::SubscriberStationNetDevice/BasicConnection/TxQueue/Enqueue";
460  }
462  {
463  std::ostringstream oss;
464  oss << "/NodeList/" << nodeId << "/DeviceList/" << ifaceId
465  << "/$ns3::SubscriberStationNetDevice/BasicConnection/TxQueue/Dequeue";
467  }
469  {
470  std::ostringstream oss;
471  oss << "/NodeList/" << nodeId << "/DeviceList/" << ifaceId
472  << "/$ns3::SubscriberStationNetDevice/BasicConnection/TxQueue/Drop";
474  }
475 }
476 
479 {
480  return m_basicConnection;
481 }
482 
483 void
485 {
486  m_primaryConnection = primaryConnection;
487 
488  uint32_t nodeId = GetNode()->GetId();
489  uint32_t ifaceId = GetIfIndex();
490 
492  {
493  std::ostringstream oss;
494  oss << "/NodeList/" << nodeId << "/DeviceList/" << ifaceId
495  << "/$ns3::SubscriberStationNetDevice/PrimaryConnection/TxQueue/Enqueue";
497  }
499  {
500  std::ostringstream oss;
501  oss << "/NodeList/" << nodeId << "/DeviceList/" << ifaceId
502  << "/$ns3::SubscriberStationNetDevice/PrimaryConnection/TxQueue/Dequeue";
504  }
506  {
507  std::ostringstream oss;
508  oss << "/NodeList/" << nodeId << "/DeviceList/" << ifaceId
509  << "/$ns3::SubscriberStationNetDevice/PrimaryConnection/TxQueue/Drop";
511  }
512 }
513 
516 {
517  return m_primaryConnection;
518 }
519 
520 Cid
522 {
523  return m_basicConnection->GetCid();
524 }
525 
526 Cid
528 {
529  return m_primaryConnection->GetCid();
530 }
531 
532 void
534 {
535  m_modulationType = modulationType;
536 }
537 
540 {
541  return m_modulationType;
542 }
543 
544 void
546  bool areManagementConnectionsAllocated)
547 {
548  m_areManagementConnectionsAllocated = areManagementConnectionsAllocated;
549 }
550 
551 bool
553 {
555 }
556 
557 void
559 {
560  m_areServiceFlowsAllocated = areServiceFlowsAllocated;
561 }
562 
563 bool
565 {
567 }
568 
571 {
572  return m_scheduler;
573 }
574 
575 void
577 {
578  m_scheduler = scheduler;
579 }
580 
581 bool
583 {
584  return !GetServiceFlowManager()->GetServiceFlows(ServiceFlow::SF_TYPE_ALL).empty();
585 }
586 
589 {
590  return m_classifier;
591 }
592 
593 void
595 {
596  m_classifier = classifier;
597 }
598 
601 {
602  return m_linkManager;
603 }
604 
605 void
607 {
608  m_linkManager = linkManager;
609 }
610 
613 {
614  return m_serviceFlowManager;
615 }
616 
617 void
619 {
620  m_serviceFlowManager = sfm;
621 }
622 
623 void
625 {
627 
628  GetPhy()->SetPhyParameters();
629  GetPhy()->SetDataRates();
630  m_intervalT20 = Seconds(4 * GetPhy()->GetFrameDuration().GetSeconds());
631 
634 }
635 
636 void
638 {
640 }
641 
642 void
644 {
645  GetServiceFlowManager()->AddServiceFlow(sf);
646 }
647 
648 void
650 {
651  GetServiceFlowManager()->AddServiceFlow(sf);
652 }
653 
654 bool
656  const Mac48Address& source,
657  const Mac48Address& dest,
658  uint16_t protocolNumber)
659 {
660  NS_LOG_INFO("SS (" << source << "):");
661  NS_LOG_INFO("\tSending packet...");
662  NS_LOG_INFO("\t\tDestination: " << dest);
663  NS_LOG_INFO("\t\tPacket Size: " << packet->GetSize());
664  NS_LOG_INFO("\t\tProtocol: " << protocolNumber);
665 
666  ServiceFlow* serviceFlow = nullptr;
667 
668  if (IsRegistered())
669  {
670  NS_LOG_DEBUG("SS (Basic CID: " << m_basicConnection->GetCid() << ")");
671  }
672  else
673  {
674  NS_LOG_DEBUG("SS (" << GetMacAddress() << ")");
675  NS_LOG_INFO("\tCan't send packet! (NotRegitered with the network)");
676  return false;
677  }
678 
679  NS_LOG_DEBUG("packet to send, size : " << packet->GetSize() << ", destination : " << dest);
680 
681  if (GetServiceFlowManager()->GetNrServiceFlows() == 0)
682  {
683  NS_LOG_INFO("\tCan't send packet! (No service Flow)");
684  return false;
685  }
686 
687  if (protocolNumber == 2048)
688  {
689  serviceFlow =
691  }
692 
693  if ((protocolNumber != 2048) || (serviceFlow == nullptr))
694  {
695  serviceFlow = *GetServiceFlowManager()->GetServiceFlows(ServiceFlow::SF_TYPE_ALL).begin();
696  NS_LOG_INFO("\tNo service flows matches...using the default one.");
697  }
698 
699  NS_LOG_INFO("\tPacket classified in the service flow SFID = "
700  << serviceFlow->GetSfid() << " CID = " << serviceFlow->GetCid());
701  if (serviceFlow->GetIsEnabled())
702  {
703  if (!Enqueue(packet, MacHeaderType(), serviceFlow->GetConnection()))
704  {
705  NS_LOG_INFO("\tEnqueue ERROR!!");
706  m_ssTxDropTrace(packet);
707  return false;
708  }
709  else
710  {
711  m_ssTxTrace(packet);
712  }
713  }
714  else
715  {
716  NS_LOG_INFO("Error!! The Service Flow is not enabled");
717  m_ssTxDropTrace(packet);
718  return false;
719  }
720 
721  return true;
722 }
723 
724 bool
726  const MacHeaderType& hdrType,
727  Ptr<WimaxConnection> connection)
728 {
729  NS_ASSERT_MSG(connection,
730  "SS: Can not enqueue the packet: the selected connection is nor initialized");
731 
732  GenericMacHeader hdr;
733 
735  {
736  hdr.SetLen(packet->GetSize() + hdr.GetSerializedSize());
737  hdr.SetCid(connection->GetCid());
738  }
739 
740  if (connection->GetType() == Cid::TRANSPORT)
741  {
742  if (connection->GetSchedulingType() == ServiceFlow::SF_TYPE_UGS && m_scheduler->GetPollMe())
743  {
745  "Error while equeuing packet: incorrect header type");
746 
747  GrantManagementSubheader grantMgmntSubhdr;
748  grantMgmntSubhdr.SetPm(true);
749  packet->AddHeader(grantMgmntSubhdr);
750  }
751  }
752  NS_LOG_INFO("ServiceFlowManager: enqueuing packet");
753  return connection->Enqueue(packet, hdrType, hdr);
754 }
755 
756 void
758  uint16_t nrSymbols,
759  Ptr<WimaxConnection> connection,
760  MacHeaderType::HeaderType packetType)
761 {
762  WimaxPhy::ModulationType modulationType;
763 
766  {
767  modulationType = WimaxPhy::MODULATION_TYPE_BPSK_12;
768  }
769  else
770  {
771  modulationType = GetBurstProfileManager()->GetModulationType(uiuc, DIRECTION_UPLINK);
772  }
773  Ptr<PacketBurst> burst =
774  m_scheduler->Schedule(nrSymbols, modulationType, packetType, connection);
775 
776  if (burst->GetNPackets() == 0)
777  {
778  return;
779  }
780 
781  if (IsRegistered())
782  {
783  NS_LOG_DEBUG("SS (Basic CID: " << m_basicConnection->GetCid() << ")");
784  }
785  else
786  {
787  NS_LOG_DEBUG("SS (" << GetMacAddress() << ")");
788  }
789 
790  if (connection->GetType() == Cid::TRANSPORT)
791  {
792  ServiceFlowRecord* record = connection->GetServiceFlow()->GetRecord();
793  record->UpdatePktsSent(burst->GetNPackets());
794  record->UpdateBytesSent(burst->GetSize());
795 
796  NS_LOG_DEBUG(" sending burst"
797  << ", SFID: " << connection->GetServiceFlow()->GetSfid() << ", pkts sent: "
798  << record->GetPktsSent() << ", pkts rcvd: " << record->GetPktsRcvd()
799  << ", bytes sent: " << record->GetBytesSent()
800  << ", bytes rcvd: " << record->GetBytesRcvd());
801  }
802  else
803  {
804  }
805  ForwardDown(burst, modulationType);
806 }
807 
808 void
810 {
811  GenericMacHeader gnrcMacHdr;
812  ManagementMessageType msgType;
813  RngRsp rngrsp;
814  Cid cid;
815  uint32_t pktSize = packet->GetSize();
816  packet->RemoveHeader(gnrcMacHdr);
817  FragmentationSubheader fragSubhdr;
818  bool fragmentation = false; // it becomes true when there is a fragmentation subheader
819 
820  if (gnrcMacHdr.GetHt() == MacHeaderType::HEADER_TYPE_GENERIC)
821  {
822  if (gnrcMacHdr.check_hcs() == false)
823  {
824  // The header is noisy
825  NS_LOG_INFO("Header HCS ERROR");
826  m_ssRxDropTrace(packet);
827  return;
828  }
829 
830  cid = gnrcMacHdr.GetCid();
831 
832  // checking for subheaders
833  uint8_t type = gnrcMacHdr.GetType();
834  if (type)
835  {
836  // Check if there is a fragmentation Subheader
837  uint8_t tmpType = type;
838  if (((tmpType >> 2) & 1) == 1)
839  {
840  // a TRANSPORT packet with fragmentation subheader has been received!
841  fragmentation = true;
842  NS_LOG_INFO("SS DoReceive -> the packet is a fragment" << std::endl);
843  }
844  }
845 
846  if (cid == GetBroadcastConnection()->GetCid() && !fragmentation)
847  {
848  packet->RemoveHeader(msgType);
849  switch (msgType.GetType())
850  {
853  {
854  Simulator::Cancel(m_linkManager->GetDlMapSyncTimeoutEvent());
855  }
856 
858  {
860  }
861 
862  m_linkManager->ScheduleScanningRestart(m_lostDlMapInterval,
864  false,
866 
868  {
870  }
871 
872  m_linkManager->ScheduleScanningRestart(m_intervalT1,
874  false,
876 
878  {
880  }
881 
882  m_linkManager->ScheduleScanningRestart(m_intervalT12,
884  true,
886 
887  DlMap dlmap;
888  packet->RemoveHeader(dlmap);
889  ProcessDlMap(dlmap);
890  break;
891  }
894  {
896  m_linkManager->ScheduleScanningRestart(m_lostUlMapInterval,
898  true,
900  }
901 
902  UlMap ulmap;
903  packet->RemoveHeader(ulmap);
904 
905  ProcessUlMap(ulmap);
906 
908  {
909  if (m_linkManager->GetRangingIntervalFound())
910  {
912  {
914  }
915  m_linkManager->PerformBackoff();
916  }
917  }
918  break;
919  }
922  {
924  }
925 
927  {
929  m_linkManager->ScheduleScanningRestart(m_intervalT1,
931  false,
933  }
934 
935  Dcd dcd;
936  // number of burst profiles is set to number of DL-MAP IEs after processing DL-MAP,
937  // not a very good solution dcd.SetNrDlBurstProfiles (m_nrDlMapElements);
938  dcd.SetNrDlBurstProfiles(7);
939  packet->RemoveHeader(dcd);
940 
941  ProcessDcd(dcd);
942  break;
943  }
945  Ucd ucd;
946  // number of burst profiles is set to number of UL-MAP IEs after processing UL-MAP,
947  // not a very good solution ucd.SetNrUlBurstProfiles (m_nrUlMapElements);
948  ucd.SetNrUlBurstProfiles(7);
949  packet->RemoveHeader(ucd);
950 
951  ProcessUcd(ucd);
952 
954  {
956  m_linkManager->ScheduleScanningRestart(m_intervalT12,
958  true,
960  }
961 
963  {
964  /*state indicating that SS has completed scanning, synchronization and parameter
965  acquisition successfully and now waiting for UL-MAP to start initial ranging.*/
967 
968  m_linkManager->ScheduleScanningRestart(m_intervalT2,
970  false,
972  m_linkManager->ScheduleScanningRestart(m_lostUlMapInterval,
974  true,
976  }
977  break;
978  }
979  default:
980  NS_FATAL_ERROR("Invalid management message type");
981  }
982  }
983  else if (GetInitialRangingConnection() && cid == GetInitialRangingConnection()->GetCid() &&
984  !fragmentation)
985  {
986  m_traceSSRx(packet, GetMacAddress(), cid);
987  packet->RemoveHeader(msgType);
988  switch (msgType.GetType())
989  {
991  // intended for base station, ignore
992  break;
995  "SS: Error while receiving a ranging response message: SS state "
996  "should be at least SS_STATE_WAITING_REG_RANG_INTRVL");
997  packet->RemoveHeader(rngrsp);
998  m_linkManager->PerformRanging(cid, rngrsp);
999  break;
1000  default:
1001  NS_LOG_ERROR("Invalid management message type");
1002  }
1003  }
1004  else if (m_basicConnection && cid == m_basicConnection->GetCid() && !fragmentation)
1005  {
1006  m_traceSSRx(packet, GetMacAddress(), cid);
1007  packet->RemoveHeader(msgType);
1008  switch (msgType.GetType())
1009  {
1011  // intended for base station, ignore
1012  break;
1015  "SS: Error while receiving a ranging response message: SS state "
1016  "should be SS_STATE_WAITING_RNG_RSP");
1017  packet->RemoveHeader(rngrsp);
1018  m_linkManager->PerformRanging(cid, rngrsp);
1019  break;
1020  default:
1021  NS_LOG_ERROR("Invalid management message type");
1022  }
1023  }
1024  else if (m_primaryConnection && cid == m_primaryConnection->GetCid() && !fragmentation)
1025  {
1026  m_traceSSRx(packet, GetMacAddress(), cid);
1027  packet->RemoveHeader(msgType);
1028  switch (msgType.GetType())
1029  {
1031  // not yet implemented
1032  break;
1034  // intended for base station, ignore
1035  break;
1037  /*from other station as DSA initiation
1038  by BS is not supported, ignore*/
1039  break;
1041  Simulator::Cancel(GetServiceFlowManager()->GetDsaRspTimeoutEvent());
1042  DsaRsp dsaRsp;
1043  packet->RemoveHeader(dsaRsp);
1044  GetServiceFlowManager()->ProcessDsaRsp(dsaRsp);
1045  break;
1046  }
1048  /*from other station as DSA initiation
1049  by BS is not supported, ignore*/
1050  break;
1051  default:
1052  NS_LOG_ERROR("Invalid management message type");
1053  }
1054  }
1055  else if (GetConnectionManager()->GetConnection(cid)) // transport connection
1056  {
1057  ServiceFlow* serviceFlow = GetConnectionManager()->GetConnection(cid)->GetServiceFlow();
1058  ServiceFlowRecord* record = serviceFlow->GetRecord();
1059 
1060  record->UpdatePktsRcvd(1);
1061  record->UpdateBytesRcvd(pktSize);
1062 
1063  // If fragmentation is true, the packet is a fragment.
1064  if (!fragmentation)
1065  {
1066  m_ssRxTrace(packet);
1067  ForwardUp(packet,
1069  GetMacAddress()); // source shall be BS's address or sender SS's?
1070  }
1071  else
1072  {
1073  NS_LOG_INFO("FRAG_DEBUG: SS DoReceive, the Packet is a fragment" << std::endl);
1074  packet->RemoveHeader(fragSubhdr);
1075  uint32_t fc = fragSubhdr.GetFc();
1076  NS_LOG_INFO("\t fragment size = " << packet->GetSize() << std::endl);
1077 
1078  if (fc == 2)
1079  {
1080  // This is the latest fragment.
1081  // Take the fragment queue, defragment a packet and send it to the upper layer
1082  NS_LOG_INFO("\t Received the latest fragment" << std::endl);
1083  GetConnectionManager()->GetConnection(cid)->FragmentEnqueue(packet);
1084 
1085  WimaxConnection::FragmentsQueue fragmentsQueue =
1086  GetConnectionManager()->GetConnection(cid)->GetFragmentsQueue();
1087 
1088  Ptr<Packet> fullPacket = Create<Packet>();
1089 
1090  // DEFRAGMENTATION
1091  NS_LOG_INFO("\t SS PACKET DEFRAGMENTATION" << std::endl);
1092  for (std::list<Ptr<const Packet>>::const_iterator iter = fragmentsQueue.begin();
1093  iter != fragmentsQueue.end();
1094  ++iter)
1095  {
1096  // Create the whole Packet
1097  fullPacket->AddAtEnd(*iter);
1098  }
1099  GetConnectionManager()->GetConnection(cid)->ClearFragmentsQueue();
1100  NS_LOG_INFO("\t fullPacket size = " << fullPacket->GetSize() << std::endl);
1101 
1102  m_ssRxTrace(fullPacket);
1103  ForwardUp(fullPacket,
1105  GetMacAddress()); // source shall be BS's address or sender SS's?
1106  }
1107  else
1108  {
1109  // This is the first or middle fragment.
1110  // Take the fragment queue, store the fragment into the queue
1111  NS_LOG_INFO("\t Received the first or the middle fragment" << std::endl);
1112  GetConnectionManager()->GetConnection(cid)->FragmentEnqueue(packet);
1113  }
1114  }
1115  }
1116  else if (cid.IsMulticast())
1117  {
1118  m_traceSSRx(packet, GetMacAddress(), cid);
1119  ForwardUp(packet,
1121  GetMacAddress()); // source shall be BS's address or sender SS's?
1122  }
1123  else if (IsPromisc())
1124  {
1125  NotifyPromiscTrace(packet);
1126  m_ssPromiscRxTrace(packet);
1127 
1128  // not for me, ignore
1129  }
1130  else
1131  {
1132  // not for me drop
1133  }
1134  }
1135  else
1136  {
1137  // from other SS, ignore
1138  }
1139 }
1140 
1141 void
1143 {
1144  m_nrDlMapRecvd++;
1145  m_dcdCount = dlmap.GetDcdCount();
1147  std::list<OfdmDlMapIe> dlMapElements = dlmap.GetDlMapElements();
1148 
1149  for (std::list<OfdmDlMapIe>::iterator iter = dlMapElements.begin(); iter != dlMapElements.end();
1150  ++iter)
1151  {
1152  if (iter->GetDiuc() == OfdmDlBurstProfile::DIUC_END_OF_MAP)
1153  {
1154  break;
1155  }
1156 
1157  if (iter->GetCid() == m_basicConnection->GetCid())
1158  {
1159  /*here the SS shall actually acquire the start time it shall start receiving the burst
1160  at. start time is used for power saving which is not implemented here, furthermore
1161  there is no need since the simulator architecture automatically callbacks the receive
1162  function. shall acquire the DIUC (burst profile) as well to decode the burst, again not
1163  required again because the callback mechanism automatically passes it as parameter.*/
1164  }
1165 
1166 #if 0 /* a template for future implementation following */
1167  uint8_t temp = iter->GetDiuc ();
1168  temp = iter->GetPreamblePresent ();
1169  temp = iter->GetStartTime ();
1170 #endif
1171  }
1172 }
1173 
1174 void
1176 {
1177  m_nrUlMapRecvd++;
1178  m_ucdCount = ulmap.GetUcdCount();
1180  std::list<OfdmUlMapIe> ulMapElements = ulmap.GetUlMapElements();
1181  m_linkManager->SetRangingIntervalFound(false);
1182 
1183  for (std::list<OfdmUlMapIe>::iterator iter = ulMapElements.begin(); iter != ulMapElements.end();
1184  ++iter)
1185  {
1186  OfdmUlMapIe ulMapIe = *iter;
1187 
1189  {
1190  break;
1191  }
1192 
1193  Cid cid = ulMapIe.GetCid();
1194 
1196  cid == GetBroadcastConnection()->GetCid())
1197  {
1198  m_linkManager->SetRangingIntervalFound(true);
1199  }
1200 
1202  {
1203  Time timeToAllocation = GetTimeToAllocation(
1204  Seconds(ulMapIe.GetStartTime() * GetPhy()->GetSymbolDuration().GetSeconds()));
1205 
1206  if (ulMapIe.GetUiuc() ==
1207  OfdmUlBurstProfile::UIUC_INITIAL_RANGING) // invited ranging interval
1208 
1209  {
1210  m_linkManager->IncrementNrInvitedPollsRecvd();
1212  "SS: Error while processing UL MAP: SS state should be "
1213  "SS_STATE_WAITING_INV_RANG_INTRVL");
1214  Simulator::Schedule(timeToAllocation,
1216  m_linkManager,
1217  ulMapIe.GetUiuc(),
1218  ulMapIe.GetDuration());
1219  }
1220  else if (ulMapIe.GetUiuc() == OfdmUlBurstProfile::UIUC_REQ_REGION_FULL) // unicast poll
1221 
1222  {
1223  Simulator::Schedule(timeToAllocation,
1226  ulMapIe.GetUiuc(),
1227  ulMapIe.GetDuration());
1228  }
1229  else // regular allocation/grant for data, for UGS flows or in response of requests for
1230  // non-UGS flows
1231 
1232  {
1233  Ptr<WimaxConnection> connection = nullptr;
1234  Simulator::Schedule(timeToAllocation,
1236  this,
1237  ulMapIe.GetUiuc(),
1238  ulMapIe.GetDuration(),
1239  connection,
1241  }
1242  }
1243  else
1244  {
1246  cid == GetBroadcastConnection()->GetCid()) // regular ranging interval
1247 
1248  {
1249  if (GetCurrentUcd().GetChannelEncodings().GetRangReqOppSize() != 0)
1250  {
1251  m_linkManager->SetNrRangingTransOpps(
1252  (ulMapIe.GetDuration() * GetPhy()->GetPsPerSymbol()) /
1253  GetCurrentUcd().GetChannelEncodings().GetRangReqOppSize());
1254  }
1255 
1258  {
1259  m_linkManager->StartContentionResolution();
1260  }
1261  }
1262  }
1263  }
1264 }
1265 
1266 void
1268 {
1269  m_nrDcdRecvd++;
1270  if (dcd.GetConfigurationChangeCount() == GetCurrentDcd().GetConfigurationChangeCount())
1271  {
1272  return; // nothing new in DCD so don't read
1273  }
1274  SetCurrentDcd(dcd);
1275  OfdmDcdChannelEncodings dcdChnlEncodings = dcd.GetChannelEncodings();
1276 
1277  // parameters for initial ranging
1278  m_linkManager->SetBsEirp(dcdChnlEncodings.GetBsEirp());
1279  m_linkManager->SetEirXPIrMax(dcdChnlEncodings.GetEirxPIrMax());
1280 
1281  GetPhy()->GetFrameDuration(dcdChnlEncodings.GetFrameDurationCode());
1282 
1283  std::vector<OfdmDlBurstProfile> dlBurstProfiles = dcd.GetDlBurstProfiles();
1284 
1285  for (std::vector<OfdmDlBurstProfile>::iterator iter = dlBurstProfiles.begin();
1286  iter != dlBurstProfiles.end();
1287  ++iter)
1288  {
1289  OfdmDlBurstProfile brstProfile = *iter;
1290 
1291  /*NS-2 does this, may be not correct, assumes DIUC/UIUC to
1292  modulation type mapping in DCD/UCD may change over time*/
1293  if (brstProfile.GetFecCodeType() == m_modulationType)
1294  {
1296  m_dlBurstProfile->SetDiuc(brstProfile.GetDiuc());
1297  }
1298  }
1299 }
1300 
1301 void
1303 {
1304  m_nrUcdRecvd++;
1305  if (!m_linkManager->IsUlChannelUsable())
1306  {
1307  m_linkManager->StartScanning(EVENT_NONE, false);
1308  return;
1309  }
1310 
1311  if (ucd.GetConfigurationChangeCount() == GetCurrentUcd().GetConfigurationChangeCount())
1312  {
1313  return; // nothing new in UCD so don't read
1314  }
1315  SetCurrentUcd(ucd);
1316  m_linkManager->SetRangingCW((uint8_t)std::pow(2.0, (double)ucd.GetRangingBackoffStart()) -
1317  1); // initializing ranging CW
1318  OfdmUcdChannelEncodings ucdChnlEncodings = ucd.GetChannelEncodings();
1319 
1320  std::vector<OfdmUlBurstProfile> ulBurstProfiles = ucd.GetUlBurstProfiles();
1321 
1322  for (std::vector<OfdmUlBurstProfile>::iterator iter = ulBurstProfiles.begin();
1323  iter != ulBurstProfiles.end();
1324  ++iter)
1325  {
1326  OfdmUlBurstProfile brstProfile = *iter;
1327 
1328  /*NS-2 does this, may be not correct, assumes DIUC/UIUC to
1329  modulation type mapping in DCD/UCD may change over time*/
1330  if (brstProfile.GetFecCodeType() == m_modulationType)
1331  {
1333  m_ulBurstProfile->SetUiuc(brstProfile.GetUiuc());
1334  }
1335  }
1336 }
1337 
1338 /*temporarily assuming registered if ranging is complete,
1339  shall actually consider the registration step also */
1340 bool
1342 {
1343  return GetState() >= SS_STATE_REGISTERED;
1344 }
1345 
1346 Time
1348 {
1349  Time timeAlreadyElapsed = Simulator::Now() - m_frameStartTime;
1350  Time timeToUlSubframe =
1351  Seconds(m_allocationStartTime * GetPhy()->GetPsDuration().GetSeconds()) -
1352  timeAlreadyElapsed;
1353  return timeToUlSubframe + deferTime;
1354 }
1355 
1356 void
1358 {
1359  if (GetState() == SS_STATE_STOPPED)
1360  {
1361  Simulator::Cancel(eventId); // cancelling this event (already scheduled in function call)
1362  return;
1363  }
1364 
1365  event = eventId;
1366 }
1367 
1368 void
1370 {
1372 }
1373 
1374 void
1376 {
1378 }
1379 
1380 void
1382 {
1383  m_asciiTxQueueDropCb = cb;
1384 }
1385 
1386 } // namespace ns3
void SendBandwidthRequest(uint8_t uiuc, uint16_t allocationSize)
Send bandwidth request.
void Nullify()
Discard the implementation, set it to null.
Definition: callback.h:578
bool IsNull() const
Check for null implementation.
Definition: callback.h:572
Cid class.
Definition: cid.h:37
@ TRANSPORT
Definition: cid.h:46
bool IsMulticast() const
Definition: cid.cc:51
uint16_t GetEirxPIrMax() const
Get EIRX IR MAX field.
uint16_t GetBsEirp() const
Get BS EIRP field.
This class implements Downlink channel descriptor as described by "IEEE Standard for Local and metrop...
void SetNrDlBurstProfiles(uint8_t nrDlBurstProfiles)
Set number DL burst profile field.
std::vector< OfdmDlBurstProfile > GetDlBurstProfiles() const
Get DL burst profile field.
OfdmDcdChannelEncodings GetChannelEncodings() const
Get channel encodings field.
uint8_t GetConfigurationChangeCount() const
Get configuration change count field.
This class implements DL-MAP as described by "IEEE Standard for Local and metropolitan area networks ...
Mac48Address GetBaseStationId() const
Get base station ID field.
std::list< OfdmDlMapIe > GetDlMapElements() const
Get DL Map elements field.
uint8_t GetDcdCount() const
Get DCD count field.
This class implements the DSA-RSP message described by "IEEE Standard for Local and metropolitan area...
Definition: mac-messages.h:490
An identifier for simulation events.
Definition: event-id.h:55
bool IsRunning() const
This method is syntactic sugar for !IsExpired().
Definition: event-id.cc:76
This class implements the fragmentation sub-header as described by IEEE Standard for Local and metrop...
uint8_t GetFc() const
Get FC field.
This class implements the Generic mac Header as described by IEEE Standard for Local and metropolitan...
uint8_t GetType() const
Get type field.
bool check_hcs() const
Check HCS.
uint8_t GetHt() const
Get HT field.
uint32_t GetSerializedSize() const override
void SetLen(uint16_t len)
Set length field.
void SetCid(Cid cid)
Set CID field.
Cid GetCid() const
Get CID field.
This class implements the grant management sub-header as described by IEEE Standard for Local and met...
void SetPm(uint8_t pm)
Set PM field.
an EUI-48 address
Definition: mac48-address.h:46
This class Represents the HT (Header Type) field of generic MAC and bandwidth request headers.
HeaderType
Header type enumeration.
uint8_t GetType() const
Get type field.
Mac Management messages Section 6.3.2.3 MAC Management messages page 42, Table 14 page 43.
Definition: mac-messages.h:44
uint8_t GetType() const
Get type field.
Definition: mac-messages.cc:58
uint32_t GetId() const
Definition: node.cc:117
This class implements the OFDM DCD channel encodings as described by "IEEE Standard for Local and met...
uint8_t GetFrameDurationCode() const
Get frame duration code field.
This class implements the OFDM Downlink burst profile descriptor as described by "IEEE Standard for L...
uint8_t GetFecCodeType() const
void SetFecCodeType(uint8_t fecCodeType)
Set FEC code type.
void SetDiuc(uint8_t diuc)
Set DIUC field.
This class implements the OFDM UCD channel encodings as described by "IEEE Standard for Local and met...
This class implements the UL burst profile as described by "IEEE Standard for Local and metropolitan ...
void SetUiuc(uint8_t uiuc)
Set UIUC.
void SetFecCodeType(uint8_t fecCodeType)
Set FEC code type.
uint8_t GetFecCodeType() const
Get FEC code type.
uint8_t GetUiuc() const
Get UIUC.
This class implements the UL-MAP_IE message as described by "IEEE Standard for Local and metropolitan...
uint16_t GetDuration() const
Get duration.
Cid GetCid() const
Get CID.
uint8_t GetUiuc() const
Get UIUC.
uint16_t GetStartTime() const
Get start time.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Definition: packet.cc:294
void AddAtEnd(Ptr< const Packet > packet)
Concatenate the input packet at the end of the current packet.
Definition: packet.cc:354
void AddHeader(const Header &header)
Add header to this packet.
Definition: packet.cc:268
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:863
Hold objects of type Ptr<T>.
Definition: pointer.h:37
This class implements the ranging response message described by "IEEE Standard for Local and metropol...
Definition: mac-messages.h:125
This class implements service flows as described by the IEEE-802.16 standard.
Definition: service-flow.h:43
uint32_t GetSfid() const
Get SFID.
uint16_t GetCid() const
Get CID.
bool GetIsEnabled() const
Get is enabled flag.
ServiceFlowRecord * GetRecord() const
Get service flow record.
Ptr< WimaxConnection > GetConnection() const
Can return a null connection is this service flow has not been associated yet to a connection.
this class implements a structure to manage some parameters and statistics related to a service flow
uint32_t GetPktsSent() const
void UpdateBytesRcvd(uint32_t bytesRcvd)
update the number of received bytes by adding bytesRcvd
void UpdatePktsSent(uint32_t pktsSent)
update the number of sent packets by adding pktsSent
void UpdateBytesSent(uint32_t bytesSent)
update the number of sent bytes by adding bytesSent
void UpdatePktsRcvd(uint32_t pktsRcvd)
update the number of received packets by adding pktsRcvd
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:568
static void Cancel(const EventId &id)
Set the cancel bit on this event: the event's associated function will not be invoked when it expires...
Definition: simulator.cc:276
static Time Now()
Return the current simulation virtual time.
Definition: simulator.cc:199
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
Definition: simulator.h:606
SubscriberStationNetDevice subclass of WimaxNetDevice.
Definition: ss-net-device.h:50
void Start() override
Start the device.
Time m_intervalT2
in seconds, wait for broadcast ranging timeout, i.e., wait for initial ranging opportunity
Time m_lostDlMapInterval
in milliseconds, time since last received DL-MAP before downlink synchronization is considered lost,...
Time m_lostUlMapInterval
in milliseconds, time since last received UL-MAP before uplink synchronization is considered lost,...
void DoReceive(Ptr< Packet > packet) override
Receive a packet.
Ptr< SSLinkManager > m_linkManager
link manager
Ptr< WimaxConnection > m_primaryConnection
primary connection
void SetAsciiTxQueueDropCallback(AsciiTraceCallback cb)
Set the Drop callback for ASCII tracing.
TracedCallback< Ptr< const Packet > > m_ssPromiscRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
double m_allocationStartTime
allocation start time
EventId m_dcdWaitTimeoutEvent
DCD wait timeout event.
void SetIntervalT21(Time interval21)
OfdmUlBurstProfile * m_ulBurstProfile
UL burst profile.
void SetIntervalT20(Time interval20)
Ptr< SSScheduler > m_scheduler
the scheduler
void SetIpcsPacketClassifier(Ptr< IpcsClassifier > classifier)
Sets the packet classifier to be used.
void SetIntervalT1(Time interval1)
void AddServiceFlow(ServiceFlow *sf) const
adds a new service flow
Time m_intervalT21
in seconds, time the SS searches for (decodable) DL-MAP on a given channel
void SetMaxDcdInterval(Time maxDcdInterval)
void SetAreManagementConnectionsAllocated(bool areManagementConnectionsAllocated)
Ptr< IpcsClassifier > m_classifier
the classifier
uint32_t m_nrUlMapRecvd
number UL map received
AsciiTraceCallback m_asciiTxQueueDropCb
Bound callback to perform ASCII logging for Drop events.
WimaxPhy::ModulationType m_modulationType
modulation type
uint8_t GetMaxContentionRangingRetries() const
uint32_t m_nrDcdRecvd
number DCD received
void SetAsciiTxQueueDequeueCallback(AsciiTraceCallback cb)
Set the Dequeue callback for ASCII tracing.
void SetScheduler(Ptr< SSScheduler > ssScheduler)
AsciiTraceCallback m_asciiTxQueueEnqueueCb
Bound callback to perform ASCII logging for Enqueue events.
bool DoSend(Ptr< Packet > packet, const Mac48Address &source, const Mac48Address &dest, uint16_t protocolNumber) override
Send a packet.
Ptr< SSScheduler > GetScheduler() const
void SetBasicConnection(Ptr< WimaxConnection > basicConnection)
AsciiTraceCallback m_asciiTxQueueDequeueCb
Bound callback to perform ASCII logging for Dequeue events.
bool m_areManagementConnectionsAllocated
are management connections allocated
Time m_intervalT20
in seconds, time the SS searches for preambles on a given channel
Ptr< IpcsClassifier > GetIpcsClassifier() const
void SetLostUlMapInterval(Time lostUlMapInterval)
Time m_intervalT1
in seconds, wait for DCD timeout
void SetPrimaryConnection(Ptr< WimaxConnection > primaryConnection)
void ProcessUcd(const Ucd &ucd)
Process UCD.
void SetTimer(EventId eventId, EventId &event)
Set timer.
Ptr< WimaxConnection > GetBasicConnection() const
uint8_t m_maxContentionRangingRetries
maximum contention ranging retries
static TypeId GetTypeId()
Get the type ID.
EventId m_ucdWaitTimeoutEvent
UCD wait timeout event.
TracedCallback< Ptr< const Packet > > m_ssRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
EventId m_rangOppWaitTimeoutEvent
range opp wait timeout event
TracedCallback< Ptr< const Packet > > m_ssTxDropTrace
The trace source fired when packets coming into the "top" of the device are dropped at the MAC layer ...
Mac48Address m_baseStationId
base station ID
void SetMaxContentionRangingRetries(uint8_t maxContentionRangingRetries)
void ProcessDlMap(const DlMap &dlmap)
Process DL map.
void ProcessDcd(const Dcd &dcd)
Process DCD.
void SetIntervalT2(Time interval2)
Time m_maxUcdInterval
in seconds, maximum time between transmission of UCD messages
Time GetTimeToAllocation(Time deferTime)
Get time to allocation.
static Time GetDefaultLostDlMapInterval()
Get default lost DL map interval.
void SetIntervalT12(Time interval12)
void SetIntervalT3(Time interval3)
TracedCallback< Ptr< const Packet > > m_ssRxDropTrace
The trace source fired when packets coming into the "top" of the device are dropped at the MAC layer ...
bool m_areServiceFlowsAllocated
are service flows allocated
void SetAsciiTxQueueEnqueueCallback(AsciiTraceCallback cb)
Set the Enqueue callback for ASCII tracing.
bool GetAreManagementConnectionsAllocated() const
bool Enqueue(Ptr< Packet > packet, const MacHeaderType &hdrType, Ptr< WimaxConnection > connection) override
Enqueue a packet into a connection queue.
EventId m_lostDlMapEvent
lost DL map event
void SetLostDlMapInterval(Time lostDlMapInterval)
Ptr< SsServiceFlowManager > m_serviceFlowManager
the service flow manager
Time m_intervalT12
in seconds, wait for UCD descriptor
void SetLinkManager(Ptr< SSLinkManager > linkManager)
sets the link manager to be used
void SetIntervalT7(Time interval7)
Time m_maxDcdInterval
in seconds, maximum time between transmission of DCD messages
TracedCallback< Ptr< const Packet >, Mac48Address, const Cid & > m_traceSSRx
trace SS receive callback
Time m_intervalT3
in milliseconds, ranging Response reception timeout following the transmission of a ranging request
Ptr< SSLinkManager > GetLinkManager() const
void Stop() override
Stop the device.
WimaxPhy::ModulationType GetModulationType() const
void SetServiceFlowManager(Ptr< SsServiceFlowManager > sfm)
Sets the service flow manager to be installed on the device.
uint32_t m_nrDlMapRecvd
number DL map received
void SetAreServiceFlowsAllocated(bool areServiceFlowsAllocated)
void ProcessUlMap(const UlMap &ulmap)
Process UL map.
Ptr< WimaxConnection > m_basicConnection
basic connection
Ptr< SsServiceFlowManager > GetServiceFlowManager() const
OfdmDlBurstProfile * m_dlBurstProfile
DL burst profile.
uint16_t m_nrDlMapElements
number DL Map elements
TracedCallback< Ptr< const Packet > > m_ssTxTrace
The trace source fired when packets come into the "top" of the device at the L3/L2 transition,...
uint32_t m_nrUcdRecvd
number UCD received
void InitSubscriberStationNetDevice()
initializes the net device and sets the parameters to the default values
Ptr< WimaxConnection > GetPrimaryConnection() const
void SetModulationType(WimaxPhy::ModulationType modulationType)
Set the most efficient modulation and coding scheme (MCS) supported by the device.
void DoDispose() override
Destructor implementation.
void SendBurst(uint8_t uiuc, uint16_t nrSymbols, Ptr< WimaxConnection > connection, MacHeaderType::HeaderType packetType=MacHeaderType::HEADER_TYPE_GENERIC)
Sends a burst on the uplink frame.
uint16_t m_nrUlMapElements
number UL Map elements
Time m_intervalT7
in seconds, wait for DSA/DSC/DSD Response timeout
void SetMaxUcdInterval(Time maxUcdInterval)
EventId m_lostUlMapEvent
lost UL map event
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
double GetSeconds() const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:402
AttributeValue implementation for Time.
Definition: nstime.h:1423
a unique identifier for an interface.
Definition: type-id.h:60
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:935
This class implements the UCD message as described by "IEEE Standard for Local and metropolitan area ...
void SetNrUlBurstProfiles(uint8_t nrUlBurstProfiles)
Set NR UL burst profiles.
std::vector< OfdmUlBurstProfile > GetUlBurstProfiles() const
Get UL burst profiles.
uint8_t GetConfigurationChangeCount() const
Get configuration change count.
OfdmUcdChannelEncodings GetChannelEncodings() const
Get channel encodings.
uint8_t GetRangingBackoffStart() const
Get ranging backoff start.
Hold an unsigned integer type.
Definition: uinteger.h:45
This class implements the UL-MAP_IE message as described by "IEEE Standard for Local and metropolitan...
std::list< OfdmUlMapIe > GetUlMapElements() const
Get UL map elements.
uint32_t GetAllocationStartTime() const
Get allocation start time.
uint8_t GetUcdCount() const
Get UCD count.
std::list< Ptr< const Packet > > FragmentsQueue
Definition of Fragments Queue data type.
Hold together all WiMAX-related objects in a NetDevice.
void DoDispose() override
Destructor implementation.
Ptr< ConnectionManager > GetConnectionManager() const
Get the connection manager of the device.
uint32_t GetIfIndex() const override
Get interface index.
Ucd GetCurrentUcd() const
Get the current UCD.
void SetPhy(Ptr< WimaxPhy > phy)
Set the physical layer object.
uint8_t GetState() const
Get the device state.
void SetCurrentUcd(Ucd ucd)
Set the current UCD.
Ptr< Node > GetNode() const override
Get node pointer.
static Time m_frameStartTime
temp, to determine the frame start time at SS side, shall actually be determined by frame start pream...
void SetState(uint8_t state)
Set the device state.
Ptr< WimaxConnection > GetInitialRangingConnection() const
Get the initial ranging connection.
Ptr< WimaxPhy > GetPhy() const
Get the physical layer object.
Ptr< BandwidthManager > GetBandwidthManager() const
Get the bandwidth manager on the device.
Ptr< WimaxConnection > GetBroadcastConnection() const
Get the broadcast connection.
bool IsPromisc()
Check if device is promiscious.
void CreateDefaultConnections()
Creates the initial ranging and broadcast connections.
void SetCurrentDcd(Dcd dcd)
Set the current DCD.
void SetReceiveCallback()
Set receive callback function.
Mac48Address GetMacAddress() const
Get the MAC address.
void SetNode(Ptr< Node > node) override
Set node pointer.
void NotifyPromiscTrace(Ptr< Packet > p)
Notify promiscious trace of a packet arrival.
void ForwardUp(Ptr< Packet > packet, const Mac48Address &source, const Mac48Address &dest)
Forward a packet to the next layer above the device.
Ptr< BurstProfileManager > GetBurstProfileManager() const
Get the burst profile manager.
Dcd GetCurrentDcd() const
Get the current DCD.
void ForwardDown(Ptr< PacketBurst > burst, WimaxPhy::ModulationType modulationType)
Forward a packet down the stack.
ModulationType
ModulationType enumeration.
Definition: wimax-phy.h:54
@ MODULATION_TYPE_BPSK_12
Definition: wimax-phy.h:55
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:86
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: pointer.h:231
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: nstime.h:1424
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: uinteger.h:46
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:975
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:179
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
Definition: log.h:254
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:275
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1360
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1336
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1348
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
Definition: nstime.h:848
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:535
phy
Definition: third.py:82
#define list
uint32_t pktSize
packet size used for the simulation (in bytes)