A Discrete-Event Network Simulator
API
bs-net-device.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2007,2008,2009 INRIA, UDcast
4  *
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
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Authors: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr>
19  * Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
20  * <amine.ismail@UDcast.com>
21  */
22 
23 #include <cmath>
24 
25 #include "ns3/simulator.h"
26 #include "ns3/node.h"
27 #include "bs-uplink-scheduler.h"
28 #include "bs-net-device.h"
29 #include "wimax-phy.h"
30 #include "ns3/packet-burst.h"
31 #include "ss-record.h"
32 #include "bs-scheduler.h"
33 #include "wimax-mac-queue.h"
34 #include "burst-profile-manager.h"
35 #include "ss-manager.h"
36 #include "ns3/trace-source-accessor.h"
37 #include "ns3/pointer.h"
38 #include "ns3/enum.h"
39 #include "ns3/uinteger.h"
40 #include "service-flow.h"
41 #include "service-flow-manager.h"
42 #include "connection-manager.h"
43 #include "bs-link-manager.h"
44 #include "bandwidth-manager.h"
45 #include "ns3/ipv4-address.h"
46 #include "ns3/llc-snap-header.h"
47 
48 namespace ns3 {
49 
50 NS_LOG_COMPONENT_DEFINE ("BaseStationNetDevice");
51 
52 NS_OBJECT_ENSURE_REGISTERED (BaseStationNetDevice);
53 
55 {
56  static TypeId tid = TypeId ("ns3::BaseStationNetDevice")
57 
59 
60  .SetGroupName("Wimax")
61 
62  .AddConstructor<BaseStationNetDevice> ()
63 
64  .AddAttribute ("BSScheduler",
65  "Downlink Scheduler for BS",
66  PointerValue (),
68  MakePointerChecker<BSScheduler> ())
69 
70  .AddAttribute ("InitialRangInterval",
71  "Time between Initial Ranging regions assigned by the BS. Maximum is 2s",
72  TimeValue (Seconds (0.05)),
75  MakeTimeChecker ())
76 
77  .AddAttribute ("DcdInterval",
78  "Time between transmission of DCD messages. Maximum value is 10s.",
79  TimeValue (Seconds (3)),
81  MakeTimeChecker ())
82 
83  .AddAttribute ("UcdInterval",
84  "Time between transmission of UCD messages. Maximum value is 10s.",
85  TimeValue (Seconds (3)),
87  MakeTimeChecker ())
88 
89  .AddAttribute ("IntervalT8",
90  "Wait for DSA/DSC Acknowledge timeout. Maximum 300ms.",
91  TimeValue (Seconds (0.05)),
93  MakeTimeChecker ())
94 
95  .AddAttribute ("RangReqOppSize",
96  "The ranging opportunity size in symbols",
97  UintegerValue (8),
100  MakeUintegerChecker<uint8_t> (1, 256))
101 
102  .AddAttribute ("BwReqOppSize",
103  "The bandwidth request opportunity size in symbols",
104  UintegerValue (2),
106  MakeUintegerChecker<uint8_t> (1, 256))
107 
108  .AddAttribute ("MaxRangCorrectionRetries",
109  "Number of retries on contention Ranging Requests",
110  UintegerValue (16),
113  MakeUintegerChecker<uint8_t> (1, 16))
114 
115  .AddAttribute ("SSManager",
116  "The ss manager attached to this device.",
117  PointerValue (),
119  MakePointerChecker<SSManager> ())
120 
121  .AddAttribute ("Scheduler",
122  "The BS scheduler attached to this device.",
123  PointerValue (),
125  MakePointerChecker<BSScheduler> ())
126 
127  .AddAttribute ("LinkManager",
128  "The link manager attached to this device.",
129  PointerValue (),
131  MakePointerChecker<BSLinkManager> ())
132 
133  .AddAttribute ("UplinkScheduler",
134  "The uplink scheduler attached to this device.",
135  PointerValue (),
138  MakePointerChecker<UplinkScheduler> ())
139 
140  .AddAttribute ("BsIpcsPacketClassifier",
141  "The uplink IP packet classifier attached to this device.",
142  PointerValue (),
144  MakePointerChecker<IpcsClassifier> ())
145 
146  .AddAttribute ("ServiceFlowManager",
147  "The service flow manager attached to this device.",
148  PointerValue (),
151  MakePointerChecker<ServiceFlowManager> ())
152 
153  .AddTraceSource ("BSTx",
154  "A packet has been received from higher layers "
155  "and is being processed in preparation "
156  "for queueing for transmission.",
158  "ns3::Packet::TracedCallback")
159 
160  .AddTraceSource ("BSTxDrop",
161  "A packet has been dropped in the MAC layer "
162  "before being queued for transmission.",
164  "ns3::Packet::TracedCallback")
165 
166  .AddTraceSource ("BSPromiscRx",
167  "A packet has been received by this device, "
168  "has been passed up from the physical layer "
169  "and is being forwarded up the local protocol stack. "
170  "This is a promiscuous trace,",
172  "ns3::Packet::TracedCallback")
173 
174  .AddTraceSource ("BSRx",
175  "A packet has been received by this device, "
176  "has been passed up from the physical layer "
177  "and is being forwarded up the local protocol stack. "
178  "This is a non-promiscuous trace,",
180  "ns3::Packet::TracedCallback")
181 
182  .AddTraceSource ("BSRxDrop",
183  "A packet has been dropped in the MAC layer "
184  "after it has been passed up from the physical layer.",
186  "ns3::Packet::TracedCallback");
187  return tid;
188 }
189 
191 {
193 }
194 
195 void
197 {
198 
199  m_initialRangInterval = Seconds (0.05); // maximum is 2
200  m_dcdInterval = Seconds (3); // maximum is 10
201  m_ucdInterval = Seconds (3); // maximum is 10
202  m_intervalT8 = MilliSeconds (50); // maximum is 300 milliseconds
205  m_rangReqOppSize = 8; // 8 symbols = 2 (preamble) + 2 (RNG-REQ) + 4 (round-trip propagation time)
206  m_bwReqOppSize = 2; // 2 symbols = 1 (preamble) + 1 (bandwidth request header)
207  m_nrDlSymbols = 0;
208  m_nrUlSymbols = 0;
209  m_nrDlMapSent = 0;
210  m_nrUlMapSent = 0;
211  m_nrDcdSent = 0;
212  m_nrUcdSent = 0;
217  m_nrDlFrames = 0;
218  m_nrUlFrames = 0;
219  m_nrSsRegistered = 0;
220  m_nrDlAllocations = 0;
221  m_nrUlAllocations = 0;
225  m_rangingOppNumber = 0;
227  m_psDuration = Seconds (0);
229  m_linkManager = CreateObject<BSLinkManager> (this);
230  m_cidFactory = new CidFactory ();
231  m_ssManager = CreateObject<SSManager> ();
232  m_bsClassifier = CreateObject<IpcsClassifier> ();
233  m_serviceFlowManager = CreateObject<BsServiceFlowManager> (this);
234 
235 }
236 
238 {
240  this->SetNode (node);
241  this->SetPhy (phy);
242 }
243 
246  Ptr<UplinkScheduler> uplinkScheduler,
247  Ptr<BSScheduler> bsScheduler)
248 {
250  this->SetNode (node);
251  this->SetPhy (phy);
252  m_uplinkScheduler = uplinkScheduler;
253  m_scheduler = bsScheduler;
254 }
255 
257 {
258 }
259 
260 void
262 {
263  delete m_cidFactory;
264 
265  m_linkManager = 0;
266  m_ssManager = 0;
267  m_bsClassifier = 0;
269  m_uplinkScheduler = 0;
270  m_cidFactory = 0;
271  m_ssManager = 0;
272  m_uplinkScheduler = 0;
273  m_scheduler = 0;
274 
276 }
277 
278 void
280 {
281  m_bsClassifier = bsc;
282 }
283 
286 {
287  return m_bsClassifier;
288 }
289 
290 void
292 {
293  m_initialRangInterval = initialRangInterval;
294 }
295 
296 Time
298 {
299  return m_initialRangInterval;
300 }
301 
302 void
304 {
305  m_dcdInterval = dcdInterval;
306 }
307 
308 Time
310 {
311  return m_dcdInterval;
312 }
313 
314 void
316 {
317  m_ucdInterval = ucdInterval;
318 }
319 
320 Time
322 {
323  return m_ucdInterval;
324 }
325 
326 void
328 {
329  m_intervalT8 = interval;
330 }
331 
332 Time
334 {
335  return m_intervalT8;
336 }
337 
338 void
340 {
341  m_maxRangCorrectionRetries = maxRangCorrectionRetries;
342 }
343 
344 uint8_t
346 {
348 }
349 
350 void
351 BaseStationNetDevice::SetMaxInvitedRangRetries (uint8_t maxInvitedRangRetries)
352 {
353  m_maxInvitedRangRetries = maxInvitedRangRetries;
354 }
355 
356 uint8_t
358 {
360 }
361 
362 void
364 {
365  m_rangReqOppSize = rangReqOppSize;
366 }
367 
368 uint8_t
370 {
371  return m_rangReqOppSize;
372 }
373 
374 void
376 {
377  m_bwReqOppSize = bwReqOppSize;
378 }
379 
380 uint8_t
382 {
383  return m_bwReqOppSize;
384 }
385 
386 void
388 {
389  m_nrDlSymbols = nrDlSymbols;
390 }
391 
392 uint32_t
394 {
395  return m_nrDlSymbols;
396 }
397 
398 void
400 {
401  m_nrUlSymbols = nrUlSymbols;
402 }
403 
404 uint32_t
406 {
407  return m_nrUlSymbols;
408 }
409 
410 uint32_t
412 {
413  return m_nrDcdSent;
414 }
415 
416 uint32_t
418 {
419  return m_nrUcdSent;
420 }
421 
422 Time
424 {
425  return m_dlSubframeStartTime;
426 }
427 
428 Time
430 {
431  return m_ulSubframeStartTime;
432 }
433 
434 uint8_t
436 {
437  return m_rangingOppNumber;
438 }
439 
442 {
443  return m_ssManager;
444 }
445 
446 void
448 {
449  m_ssManager = ssm;
450 }
451 
454 {
455  return m_serviceFlowManager;
456 }
457 
458 void
460 {
461  m_serviceFlowManager = sfm;
462 }
463 
466 {
467  return m_uplinkScheduler;
468 }
469 
470 void
472 {
473  m_uplinkScheduler = uls;
474 }
475 
478 {
479  return m_linkManager;
480 }
481 
482 void
484 {
485  m_linkManager = lm;
486 }
487 
488 void
490 {
491  m_scheduler = bss;
492 }
495 {
496  return m_scheduler;
497 }
498 
499 Time
501 {
502  return m_psDuration;
503 }
504 
505 Time
507 {
508  return m_symbolDuration;
509 }
510 
511 void
513 {
515  GetConnectionManager ()->SetCidFactory (m_cidFactory);
516  GetPhy ()->SetPhyParameters ();
517  GetPhy ()->SetDataRates ();
518  SetTtg (GetPhy ()->GetTtg ());
519  SetRtg (GetPhy ()->GetRtg ());
520  m_psDuration = GetPhy ()->GetPsDuration ();
521  m_symbolDuration = GetPhy ()->GetSymbolDuration ();
522  GetBandwidthManager ()->SetSubframeRatio ();
523 
525  GetPhy ()->SetSimplex (m_linkManager->SelectDlChannel ());
527 
528  /* shall actually be 2 symbols = 1 (preamble) + 1 (bandwidth request header)*/
529  m_bwReqOppSize = 6;
530  m_uplinkScheduler->InitOnce ();
531 }
532 
533 void
535 {
536 }
537 
538 void
540 {
541  //setting DL/UL subframe allocation for this frame
542  uint32_t symbolsPerFrame = GetPhy ()->GetSymbolsPerFrame ();
543  SetNrDlSymbols ((symbolsPerFrame / 2) - static_cast<uint32_t> (std::ceil (GetTtg ()*m_psDuration.GetSeconds ()/m_symbolDuration.GetSeconds ())));
544  SetNrUlSymbols ((symbolsPerFrame / 2) - static_cast<uint32_t> (std::ceil (GetRtg ()*m_psDuration.GetSeconds ()/m_symbolDuration.GetSeconds ())));
545 
547 
548  NS_LOG_INFO ("----------------------frame" << GetNrFrames () + 1 << "----------------------");
549 
550  StartDlSubFrame ();
551 }
552 
553 void
555 {
556  m_dlSubframeStartTime = Simulator::Now (); // same as m_frameStartTime
557 
558  NS_LOG_DEBUG ("DL frame started : " << m_frameStartTime.GetSeconds ());
559 
560  SetNrFrames (GetNrFrames () + 1);
563  m_uplinkScheduler->Schedule ();
565  m_scheduler->Schedule ();
566  SendBursts ();
569  this);
570 }
571 
572 void
574 {
575  m_nrDlFrames++;
578 }
579 
580 void
582 {
584 
585  NS_LOG_INFO ("UL frame started : " << m_ulSubframeStartTime.GetSeconds ());
586 
592  this);
593 }
594 
595 void
597 {
598  m_nrUlFrames++;
601 }
602 
603 void
605 {
606  StartFrame ();
607 }
608 
609 bool
611  const Mac48Address &source,
612  const Mac48Address &dest,
613  uint16_t protocolNumber)
614 {
615  Ptr<PacketBurst> burst = Create<PacketBurst> ();
616  ServiceFlow *serviceFlow = 0;
617 
618  NS_LOG_INFO ("BS (" << source << "):");
619  NS_LOG_INFO ("\tSending packet...");
620  NS_LOG_INFO ("\t\tDestination: " << dest);
621  NS_LOG_INFO ("\t\tPaket Size: " << packet->GetSize ());
622  NS_LOG_INFO ("\t\tProtocol: " << protocolNumber);
623 
624 
625  if (protocolNumber == 2048)
626  {
627  serviceFlow = m_bsClassifier->Classify (packet, GetServiceFlowManager (), ServiceFlow::SF_DIRECTION_DOWN);
628  }
629 
630  if (protocolNumber != 2048 || serviceFlow == 0)
631  {
632  serviceFlow = *GetServiceFlowManager ()->GetServiceFlows (ServiceFlow::SF_TYPE_ALL).begin ();
633  }
634 
635  if (serviceFlow == 0)
636  {
637  NS_LOG_INFO ("No Service Flow!!");
638  m_bsTxDropTrace (packet);
639  return false;
640  }
641  if (serviceFlow->GetIsEnabled ())
642  {
643  if (!Enqueue (packet, MacHeaderType (), serviceFlow->GetConnection ()))
644  {
645  NS_LOG_INFO ("Enqueue Error!!");
646  m_bsTxDropTrace (packet);
647  return false;
648  }
649  }
650  else
651  {
652  m_bsTxDropTrace (packet);
653  NS_LOG_INFO ("Service Flow is not enabled");
654  return false;
655  }
656  m_bsTxTrace (packet);
657 
658  return true;
659 }
660 
661 bool
663 {
664  NS_ASSERT_MSG (connection != 0,
665  "BS: Can not enqueue packet on the selected connection: the connection is not initialized");
666 
667  GenericMacHeader hdr;
668  hdr.SetLen (packet->GetSize () + hdr.GetSerializedSize ());
669 
670  hdr.SetCid (connection->GetCid ());
671 
672  return connection->Enqueue (packet, hdrType, hdr);
673 }
674 
675 void
677 {
678  GenericMacHeader gnrcMacHdr;
679  BandwidthRequestHeader bwRequestHdr;
680  ManagementMessageType msgType;
681  RngReq rngReq;
682  Cid cid;
683  uint8_t type = 0;
684  GrantManagementSubheader grantMgmntSubhdr;
685  Mac48Address source;
686  LlcSnapHeader llc;
687  Ptr<WimaxConnection> connection = 0;
688  FragmentationSubheader fragSubhdr;
689  bool fragmentation = false; // it becomes true when there is a fragmentation subheader
690 
691  packet->RemoveHeader (gnrcMacHdr);
692  if (gnrcMacHdr.GetHt () == MacHeaderType::HEADER_TYPE_GENERIC)
693  {
694  if (gnrcMacHdr.check_hcs () == false)
695  {
696  // The header is noisy
697  m_bsRxDropTrace (packet);
698  NS_LOG_INFO ("Header HCS ERROR");
699  return;
700  }
701 
702  cid = gnrcMacHdr.GetCid ();
703 
704  // checking for subheaders (only grant management subheader is implemented)
705  type = gnrcMacHdr.GetType ();
706  if (type)
707  {
708  // checking 1st bit, see Table 6
709  if (type & 1)
710  {
711  packet->RemoveHeader (grantMgmntSubhdr);
712  }
713  // Check if there is a fragmentation Subheader
714  uint8_t tmpType = type;
715  if (((tmpType >> 2) & 1) == 1)
716  {
717  // a TRANSPORT packet with fragmentation subheader has been received!
718  NS_LOG_INFO ("FRAG_DEBUG: DoReceive -> the packet is a fragment" << std::endl);
719  fragmentation = true;
720  }
721  }
722 
723  if (cid.IsInitialRanging ()) // initial ranging connection
724  {
725  packet->RemoveHeader (msgType);
726  switch (msgType.GetType ())
727  {
729  {
730  packet->RemoveHeader (rngReq);
731  m_linkManager->ProcessRangingRequest (cid, rngReq);
732  break;
733  }
735  // from other base station, ignore
736  break;
737  default:
738  NS_FATAL_ERROR ("Invalid message type");
739  }
740  }
741  else if (m_cidFactory->IsBasic (cid)) // basic management connection
742  {
743  source = m_ssManager->GetMacAddress (cid);
744  m_traceBSRx (packet, source, cid);
745  packet->RemoveHeader (msgType);
746  switch (msgType.GetType ())
747  {
749  {
750  packet->RemoveHeader (rngReq);
751  m_linkManager->ProcessRangingRequest (cid, rngReq);
752  break;
753  }
755  // from other base station, ignore
756  break;
757  default:
758  NS_FATAL_ERROR ("Invalid message type");
759  }
760  }
761  else if (m_cidFactory->IsPrimary (cid)) // primary management connection
762  {
763  source = m_ssManager->GetMacAddress (cid);
764  m_traceBSRx (packet, source, cid);
765  packet->RemoveHeader (msgType);
766  switch (msgType.GetType ())
767  {
769  // not yet implemented
770  break;
772  // from other base station, ignore
773  break;
775  {
776  DsaReq dsaReq;
777  packet->RemoveHeader (dsaReq);
778  GetServiceFlowManager ()->AllocateServiceFlows (dsaReq, cid);
779  break;
780  }
782 
783  /*from other base station, as DSA initiated
784  from BS is not supported, ignore*/
785  break;
787  {
788  Simulator::Cancel (GetServiceFlowManager ()->GetDsaAckTimeoutEvent ());
789  DsaAck dsaAck;
790  packet->RemoveHeader (dsaAck);
791  GetServiceFlowManager ()->ProcessDsaAck (dsaAck, cid);
792  break;
793  }
794  default:
795  NS_FATAL_ERROR ("Invalid message type");
796  }
797  }
798  else if (cid.IsBroadcast ()) // broadcast connection
799  {
800  // from other base station, ignore
801  // or perhaps data packet (using other protocol) for BS, handle later
802  return;
803  }
804  else // transport connection
805  {
806  // If fragmentation is true, the packet is a fragment.
807  Ptr<Packet> C_Packet = packet->Copy ();
808  if (!fragmentation)
809  {
810  C_Packet->RemoveHeader (llc);
811  source = m_ssManager->GetMacAddress (cid);
812  m_bsRxTrace (packet);
813  ForwardUp (packet->Copy (), source, Mac48Address ("ff:ff:ff:ff:ff:ff"));
814  }
815  else
816  {
817  NS_LOG_INFO ( "FRAG_DEBUG: BS DoReceive, the Packet is a fragment" << std::endl);
818  packet->RemoveHeader (fragSubhdr);
819  uint32_t fc = fragSubhdr.GetFc ();
820  NS_LOG_INFO ("\t fragment size = " << packet->GetSize () << std::endl);
821  if (fc == 2)
822  {
823  // This is the latest fragment.
824  // Take the fragment queue, defragment a packet and send it to the upper layer
825  NS_LOG_INFO ("\t Received the latest fragment" << std::endl);
826  GetConnectionManager ()->GetConnection (cid)
827  ->FragmentEnqueue (packet);
829  GetConnection (cid)->GetFragmentsQueue ();
830  Ptr<Packet> fullPacket = Create<Packet> ();
831 
832  // DEFRAGMENTATION
833  NS_LOG_INFO ("\t BS PACKET DEFRAGMENTATION" << std::endl);
834  for (std::list<Ptr<const Packet> >::const_iterator iter = fragmentsQueue.begin ();
835  iter != fragmentsQueue.end (); ++iter)
836  {
837  // Create the whole Packet
838  fullPacket->AddAtEnd (*iter);
839  }
840  GetConnectionManager ()->GetConnection (cid)
841  ->ClearFragmentsQueue ();
842 
843  NS_LOG_INFO ("\t fullPacket size = " << fullPacket->GetSize () << std::endl);
844  source = m_ssManager->GetMacAddress (cid);
845  m_bsRxTrace (fullPacket);
846  ForwardUp (fullPacket->Copy (), source, Mac48Address ("ff:ff:ff:ff:ff:ff"));
847  }
848  else
849  {
850  // This is the first or middle fragment.
851  // Take the fragment queue, store the fragment into the queue
852  NS_LOG_INFO ("\t Received the first or the middle fragment" << std::endl);
853  GetConnectionManager ()->GetConnection (cid)
854  ->FragmentEnqueue (packet);
855  }
856  }
857  }
858  }
859  else
860  {
861  // bandwidth request header
862  packet->AddHeader (gnrcMacHdr);
863  packet->RemoveHeader (bwRequestHdr);
865  "A bandwidth request should be carried by a bandwidth header type");
866  if (bwRequestHdr.check_hcs () == false)
867  {
868  // The header is noisy
869  NS_LOG_INFO ("BS:Header HCS ERROR");
870  return;
871  }
872  cid = bwRequestHdr.GetCid ();
873  source = m_ssManager->GetMacAddress (cid);
874  m_traceBSRx (packet, source, cid);
875  GetBandwidthManager ()->ProcessBandwidthRequest (bwRequestHdr);
876  }
877 
878 }
879 
880 void
882 {
883  Ptr<Packet> dlmap, ulmap;
884  bool sendDcd = false, sendUcd = false, updateDcd = false, updateUcd = false;
885 
886  uint16_t currentNrSsRegistered = m_ssManager->GetNRegisteredSSs ();
887 
888  if (m_nrSsRegistered == currentNrSsRegistered)
889  {
890  m_uplinkScheduler->GetChannelDescriptorsToUpdate (updateDcd, updateUcd, sendDcd, sendUcd);
891  }
892  else
893  {
894  sendDcd = sendUcd = true;
895  }
896 
897  m_nrSsRegistered = currentNrSsRegistered;
898 
899  /*either DCD and UCD must be created first because CCC is set during their
900  creation, or CCC must be calculated first so that it could be set during
901  creation of DL-MAP and UL-MAP and then set duirng creation of DCD and UCD*/
902 
903  if (sendDcd)
904  {
905  m_dcdConfigChangeCount += 1 % 256;
906  }
907 
908  if (sendUcd)
909  {
910  m_ucdConfigChangeCount += 1 % 256;
911  }
912 
913  dlmap = CreateDlMap ();
915  m_nrDlMapSent++;
916 
917  ulmap = CreateUlMap ();
919  m_nrUlMapSent++;
920 
921  CreateDescriptorMessages (sendDcd, sendUcd);
922 }
923 
924 void
926 {
927  Ptr<Packet> dcd, ucd;
928 
929  if (sendDcd)
930  {
931  dcd = CreateDcd ();
933  m_nrDcdSent++;
935  }
936  else
937  {
939  }
940 
941  if (sendUcd)
942  {
943  ucd = CreateUcd ();
945  m_nrUcdSent++;
947  }
948  else
949  {
951  }
952 }
953 
954 /*
955  Sends bursts in the downlink subframe. i.e., creates the downlink subframe. The first burst
956  is broadcast burst with MAC management messages. The rest of the bursts contain data packets.
957  */
958 void
960 {
961  Time txTime = Seconds (0);
962  std::pair<OfdmDlMapIe*, Ptr<PacketBurst> > pair;
964  std::list<std::pair<OfdmDlMapIe*, Ptr<PacketBurst> > > *downlinkBursts = m_scheduler->GetDownlinkBursts ();
965  Ptr<PacketBurst> burst;
966  OfdmDlMapIe *dlMapIe;
967  Cid cid;
968 
969  while (downlinkBursts->size ())
970  {
971  pair = downlinkBursts->front ();
972  burst = pair.second;
973  dlMapIe = pair.first;
974  cid = dlMapIe->GetCid ();
975  uint8_t diuc = dlMapIe->GetDiuc ();
976 
977  if (cid != GetInitialRangingConnection ()->GetCid () && cid != GetBroadcastConnection ()->GetCid ())
978  {
979  if (m_serviceFlowManager->GetServiceFlow (cid) != 0)
980  {
981  modulationType = GetBurstProfileManager ()->GetModulationType (diuc, WimaxNetDevice::DIRECTION_DOWNLINK);
982  }
983  else
984  {
985  modulationType = GetBurstProfileManager ()->GetModulationType (diuc, WimaxNetDevice::DIRECTION_DOWNLINK);
986  }
987  }
988  else
989  {
990  modulationType = WimaxPhy::MODULATION_TYPE_BPSK_12;
991  }
992 
993  Simulator::Schedule (txTime, &WimaxNetDevice::ForwardDown, this, burst, modulationType);
994  txTime += GetPhy ()->GetTransmissionTime (burst->GetSize (), modulationType);
995  downlinkBursts->pop_front ();
996  delete dlMapIe;
997  }
998 }
999 
1002 {
1003  m_nrDlAllocations = 0;
1004 
1005  DlMap dlmap;
1007  dlmap.SetBaseStationId (GetMacAddress ());
1008 
1009  std::list<std::pair<OfdmDlMapIe*, Ptr<PacketBurst> > > *downlinkBursts = m_scheduler->GetDownlinkBursts ();
1010 
1011  for (std::list<std::pair<OfdmDlMapIe*, Ptr<PacketBurst> > >::iterator iter = downlinkBursts->begin (); iter
1012  != downlinkBursts->end (); ++iter)
1013  {
1014  iter->first->SetPreamblePresent (0);
1015  iter->first->SetStartTime (0);
1016  dlmap.AddDlMapElement (*(iter->first));
1017  }
1018 
1019  OfdmDlMapIe dlMapIeEnd;
1020 
1021  dlMapIeEnd.SetCid (Cid::InitialRanging ());
1023  dlMapIeEnd.SetPreamblePresent (0);
1024  dlMapIeEnd.SetStartTime (0);
1025 
1026  dlmap.AddDlMapElement (dlMapIeEnd);
1027  m_nrDlAllocations = downlinkBursts->size ();
1028 
1029  Ptr<Packet> p = Create<Packet> ();
1030  p->AddHeader (dlmap);
1032  return p;
1033 }
1034 
1037 {
1038  Dcd dcd;
1039  OfdmDcdChannelEncodings chnlEncodings;
1040 
1041  chnlEncodings.SetBsEirp (0);
1042  chnlEncodings.SetEirxPIrMax (0);
1043  chnlEncodings.SetFrequency (GetPhy ()->GetFrequency ());
1044  chnlEncodings.SetChannelNr (0);
1045  chnlEncodings.SetTtg (GetTtg ());
1046  chnlEncodings.SetRtg (GetRtg ());
1047  chnlEncodings.SetBaseStationId (GetMacAddress ());
1048  chnlEncodings.SetFrameDurationCode (GetPhy ()->GetFrameDurationCode ());
1049  chnlEncodings.SetFrameNumber (GetNrFrames ());
1050 
1052  dcd.SetChannelEncodings (chnlEncodings);
1053 
1054  SetDlBurstProfiles (&dcd);
1055  SetCurrentDcd (dcd);
1056 
1057  Ptr<Packet> p = Create<Packet> ();
1058  p->AddHeader (dcd);
1060  return p;
1061 }
1062 
1065 {
1067  m_rangingOppNumber = 0;
1068  m_nrUlAllocations = 0;
1069 
1070  UlMap ulmap;
1072  ulmap.SetAllocationStartTime (m_uplinkScheduler->CalculateAllocationStartTime ());
1073 
1074  std::list<OfdmUlMapIe> uplinkAllocations = m_uplinkScheduler->GetUplinkAllocations ();
1075 
1076  for (std::list<OfdmUlMapIe>::iterator iter = uplinkAllocations.begin (); iter != uplinkAllocations.end (); ++iter)
1077  {
1078  ulmap.AddUlMapElement (*iter);
1079  }
1080 
1081  m_nrUlAllocations = uplinkAllocations.size ();
1082 
1083  Ptr<Packet> p = Create<Packet> ();
1084  p->AddHeader (ulmap);
1086  return p;
1087 }
1088 
1091 {
1092  Ucd ucd;
1094  ucd.SetRangingBackoffStart (3); // setting to 7. i.e., 2^3 = 8 -> 0-7
1095  ucd.SetRangingBackoffEnd (6); // setting to 63. i.e., 2^6 = 64 -> 0-63
1096  ucd.SetRequestBackoffStart (3);
1097  ucd.SetRequestBackoffEnd (6);
1098 
1099  OfdmUcdChannelEncodings chnlEncodings;
1100 
1101  chnlEncodings.SetBwReqOppSize (m_bwReqOppSize * GetPhy ()->GetPsPerSymbol ());
1102  chnlEncodings.SetRangReqOppSize (m_rangReqOppSize * GetPhy ()->GetPsPerSymbol ());
1103 
1104  chnlEncodings.SetFrequency (GetPhy ()->GetFrequency ());
1105  chnlEncodings.SetSbchnlReqRegionFullParams (0);
1106  chnlEncodings.SetSbchnlFocContCodes (0);
1107 
1108  ucd.SetChannelEncodings (chnlEncodings);
1109 
1110  SetUlBurstProfiles (&ucd);
1111  SetCurrentUcd (ucd);
1112 
1113  Ptr<Packet> p = Create<Packet> ();
1114  p->AddHeader (ucd);
1116  return p;
1117 }
1118 
1119 void
1121 {
1122  for (int i = 0; i < GetBurstProfileManager ()->GetNrBurstProfilesToDefine (); ++i)
1123  {
1124  OfdmDlBurstProfile brstProfile;
1125  brstProfile.SetType (0);
1126  brstProfile.SetLength (0);
1127  brstProfile.SetDiuc (i + 1); // DIUC will be between 1-11, see Table 237
1128  brstProfile.SetFecCodeType (i);
1129  dcd->AddDlBurstProfile (brstProfile);
1130  }
1131 }
1132 
1133 void
1135 {
1136  for (int i = 0; i < GetBurstProfileManager ()->GetNrBurstProfilesToDefine (); ++i)
1137  {
1138  OfdmUlBurstProfile brstProfile;
1139  brstProfile.SetType (0);
1140  brstProfile.SetLength (0);
1141  // UIUC will be between 5-12, see Table 246. UIUC 1 (initial ranging) is not included
1142  brstProfile.SetUiuc (i + 5);
1143  brstProfile.SetFecCodeType (i);
1144 
1145  ucd->AddUlBurstProfile (brstProfile);
1146  }
1147 }
1148 
1151 {
1152  Ptr<WimaxConnection> connection = 0;
1153  if (cid.IsInitialRanging ())
1154  {
1155  return GetInitialRangingConnection ();
1156  }
1157  else if (cid.IsBroadcast ())
1158  {
1159  connection = GetBroadcastConnection ();
1160  }
1161  else
1162  {
1163  connection = GetConnectionManager ()->GetConnection (cid);
1164  }
1165 
1166  NS_ASSERT_MSG (connection != 0, "BS: Invalid connection=0");
1167  return connection;
1168 }
1169 
1170 void
1172 {
1173  uint16_t symbolsToAllocation = 0;
1174  std::list<OfdmUlMapIe> uplinkAllocations = m_uplinkScheduler->GetUplinkAllocations ();
1175  for (std::list<OfdmUlMapIe>::iterator iter = uplinkAllocations.begin (); iter != uplinkAllocations.end (); ++iter)
1176  {
1177  OfdmUlMapIe uplinkAllocation = *iter;
1178 
1179  if (uplinkAllocation.GetUiuc () == OfdmUlBurstProfile::UIUC_END_OF_MAP)
1180  {
1181  break;
1182  }
1183 
1184  symbolsToAllocation = uplinkAllocation.GetStartTime ();
1185  MarkUplinkAllocationStart (Seconds (symbolsToAllocation * m_symbolDuration.GetSeconds ()));
1186  MarkUplinkAllocationEnd (Seconds ((symbolsToAllocation + uplinkAllocation.GetDuration ())
1187  * m_symbolDuration.GetSeconds ()), uplinkAllocation.GetCid (), uplinkAllocation.GetUiuc ());
1188  }
1189 }
1190 
1191 void
1193 {
1195 }
1196 
1197 void
1198 BaseStationNetDevice::MarkUplinkAllocationEnd (Time allocationEndTime, Cid cid, uint8_t uiuc)
1199 {
1200  Simulator::Schedule (allocationEndTime, &BaseStationNetDevice::UplinkAllocationEnd, this, cid, uiuc);
1201 }
1202 
1203 void
1205 {
1207 
1208  NS_LOG_DEBUG ("--UL allocation " << (uint32_t) m_ulAllocationNumber << " started : "
1209  << Simulator::Now ().GetSeconds ());
1210 
1211 }
1212 
1213 void
1215 {
1216  NS_LOG_DEBUG ("--UL allocation " << (uint32_t) m_ulAllocationNumber << " ended : " << Simulator::Now ().GetSeconds ());
1217 
1218  if (m_cidFactory->IsBasic (cid))
1219  {
1220  m_linkManager->VerifyInvitedRanging (cid, uiuc);
1221  }
1222 }
1223 
1224 void
1226 {
1227  Simulator::Schedule (rangingOppStartTime, &BaseStationNetDevice::RangingOppStart, this);
1228 }
1229 
1230 void
1232 {
1234 
1235  NS_LOG_DEBUG ("Ranging TO " << (uint32_t) m_rangingOppNumber << ": " << Simulator::Now ().GetSeconds ());
1236 }
1237 
1238 } // namespace ns3
void SetUcdInterval(Time ucdInterval)
This class implements the OFDM UCD channel encodings as described by "IEEE Standard for Local and met...
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Definition: packet.cc:280
Ptr< WimaxConnection > GetInitialRangingConnection(void) const
Get the initial ranging connection.
uint8_t m_rangReqOppSize
in symbols
void RangingOppStart(void)
Ranging opp start.
uint8_t m_rangingOppNumber
current ranging TO number
void SetRtg(uint16_t rtg)
Set receive/transmit transition gap.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
uint16_t GetTtg(void) const
Get transmission/receive transition gap.
void SetUcdCount(uint8_t ucdCount)
Set UCD count.
void SetNrDlSymbols(uint32_t dlSymbols)
This class implements DL-MAP as described by "IEEE Standard for Local and metropolitan area networks ...
uint32_t GetSerializedSize(void) const
Time GetInitialRangingInterval(void) const
This class implements the DSA-ACK message described by "IEEE Standard for Local and metropolitan area...
Definition: mac-messages.h:572
void SetRtg(uint8_t rtg)
Set RTG field.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
void StartDlSubFrame(void)
Start DL subframe function.
uint16_t GetRtg(void) const
Get receive/transmit transition gap.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:831
bool IsInitialRanging(void) const
Definition: cid.cc:66
void SetEirxPIrMax(uint16_t rss_ir_max)
Set EIRX IR MAX field.
NS_ASSERT_MSG(false, "Ipv4AddressGenerator::MaskToIndex(): Impossible")
uint16_t m_nrSsRegistered
number SS registered
void SetLength(uint8_t length)
Set length field.
void MarkRangingOppStart(Time rangingOppStartTime)
Mark ranging opp start.
void SetBsEirp(uint16_t bs_eirp)
Set BS EIRP field.
Time GetUcdInterval(void) const
Mac Management messages Section 6.3.2.3 MAC Management messages page 42, Table 14 page 43...
Definition: mac-messages.h:43
uint8_t GetHt(void) const
Get HT field.
void EndUlSubFrame(void)
End UL subframe function.
Time GetDlSubframeStartTime(void) const
uint16_t GetStartTime(void) const
Get start time.
void SetRangingBackoffEnd(uint8_t rangingBackoffEnd)
Set ranging backoff end.
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:355
This class implements the ranging request message described by "IEEE Standard for Local and metropoli...
Definition: mac-messages.h:642
Ptr< BSLinkManager > GetLinkManager(void) const
void SetLinkManager(Ptr< BSLinkManager > linkManager)
void ForwardUp(Ptr< Packet > packet, const Mac48Address &source, const Mac48Address &dest)
Forward a packet to the next layer above the device.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1022
void CreateDescriptorMessages(bool sendDcd, bool sendUcd)
creates the channel descriptor MAC management messages DCD and UCD
TracedCallback< Ptr< const Packet > > m_bsRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:278
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:162
uint8_t GetMaxInvitedRangRetries(void) const
This class implements the UL burst profile as described by "IEEE Standard for Local and metropolitan ...
Time m_initialRangInterval
in seconds
static void Cancel(const EventId &id)
Set the cancel bit on this event: the event&#39;s associated function will not be invoked when it expires...
Definition: simulator.cc:346
void SetBSScheduler(Ptr< BSScheduler > bsSchedule)
Cid GetCid(void) const
Get CID field.
Ptr< SSManager > GetSSManager(void) const
void EndFrame(void)
End frame function.
Ptr< Packet > CreateUcd(void)
Create UCD.
void SetChannelNr(uint8_t channelNr)
Set channel number field.
void SetMaxInvitedRangRetries(uint8_t maxInvitedRangRetries)
void SetIntervalT8(Time interval)
Ptr< BurstProfileManager > GetBurstProfileManager(void) const
Get the burst profile manager.
void SetBsClassifier(Ptr< IpcsClassifier > classifier)
void SetType(uint8_t type)
Set type field.
void SetLength(uint8_t length)
Set length.
void UplinkAllocationEnd(Cid cid, uint8_t uiuc)
Uplink allocation end.
uint8_t GetRangingOppNumber(void) const
void SetDiuc(uint8_t diuc)
Set DIUC field.
This class implements the Generic mac Header as described by IEEE Standard for Local and metropolitan...
Ptr< BsServiceFlowManager > GetServiceFlowManager(void) const
void SetChannelEncodings(OfdmUcdChannelEncodings channelEncodings)
Set channel encodings.
uint8_t GetUiuc(void) const
Get UIUC.
void SetStartTime(uint16_t startTime)
Set start time field.
Time GetUlSubframeStartTime(void) const
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
phy
Definition: third.py:86
uint16_t m_nrUlAllocations
number UL allocations
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:446
void SetPreamblePresent(uint8_t preamblePresent)
Set preamble present field.
void SetFrameDurationCode(uint8_t frameDurationCode)
Set frame duration code field.
uint32_t m_nrUlFrames
number UL frames
void SetSbchnlReqRegionFullParams(uint8_t sbchnlReqRegionFullParams)
Set SB channel reguest region full parameters.
Cid GetCid(void) const
Get CID field.
void SetBaseStationId(Mac48Address baseStationID)
Set base station ID field.
void AddAtEnd(Ptr< const Packet > packet)
Concatenate the input packet at the end of the current packet.
Definition: packet.cc:335
void SetRequestBackoffStart(uint8_t requestBackoffStart)
Set request backoff start.
Ptr< Packet > CreateUlMap(void)
Create UL map.
uint32_t m_framesSinceLastDcd
frames since last DCD
void MarkUplinkAllocationStart(Time allocationStartTime)
Mark uplink allocation start.
TracedCallback< Ptr< const Packet > > m_bsRxDropTrace
The trace source fired when packets coming into the "top" of the device are dropped at the MAC layer ...
void SetDiuc(uint8_t diuc)
Set DIUC field.
bool Enqueue(Ptr< Packet > packet, const MacHeaderType &hdrType, Ptr< WimaxConnection > connection)
Enqueue a packet into a connection queue.
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:220
uint8_t m_bwReqOppSize
in symbols
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay.
Definition: simulator.h:1381
uint32_t m_nrDlMapSent
number DL map sent
void SetSbchnlFocContCodes(uint8_t sbchnlFocContCodes)
Set SB channel for control codes.
void SetCid(Cid cid)
Set CID field.
void SetCurrentDcd(Dcd dcd)
Set the current DCD.
void Stop(void)
Stop device.
void SetRangReqOppSize(uint8_t rangReqOppSize)
AttributeValue implementation for Time.
Definition: nstime.h:1076
void SetTtg(uint16_t ttg)
Set transmission/receive transition gap.
TracedCallback< Ptr< const Packet > > m_bsTxDropTrace
The trace source fired when packets coming into the "top" of the device are dropped at the MAC layer ...
void SetFecCodeType(uint8_t fecCodeType)
Set FEC code type.
static Cid InitialRanging(void)
Definition: cid.cc:82
void SetTtg(uint8_t ttg)
Set TTG field.
Hold an unsigned integer type.
Definition: uinteger.h:44
void SetDcdCount(uint8_t dcdCount)
Set DCD count field.
bool IsPrimary(Cid cid) const
This function determines if the CID is primary.
Definition: cid-factory.cc:105
void SetUiuc(uint8_t uiuc)
Set UIUC.
This class implements the UCD message as described by "IEEE Standard for Local and metropolitan area ...
void SetAllocationStartTime(uint32_t allocationStartTime)
Set allocation start time.
static TypeId GetTypeId(void)
Get the type ID.
Ptr< BandwidthManager > GetBandwidthManager(void) const
Get the bandwidth manager on the device.
void SetRangingBackoffStart(uint8_t rangingBackoffStart)
Set ranging backoff start.
uint32_t m_nrDlSymbols
number of DL symbols
bool IsBasic(Cid cid) const
This function determines if the CID is basic.
Definition: cid-factory.cc:111
uint16_t m_nrDlAllocations
number DL allocations
void SetInitialRangingInterval(Time initialRangInterval)
This class implements the grant management sub-header as described by IEEE Standard for Local and met...
uint32_t m_nrDlFrames
number DL frames
uint32_t m_allocationStartTime
allocation start time
Ptr< UplinkScheduler > GetUplinkScheduler(void) const
Time GetPsDuration(void) const
Time GetSymbolDuration(void) const
Ptr< BSLinkManager > m_linkManager
the link manager
void SetBwReqOppSize(uint16_t bwReqOppSize)
Set BW request opp size.
void AddUlBurstProfile(OfdmUlBurstProfile ulBurstProfile)
Add UL burst profile.
This class implements Downlink channel descriptor as described by "IEEE Standard for Local and metrop...
This class Represents the HT (Header Type) field of generic MAC and bandwidth request headers...
Ptr< IpcsClassifier > m_bsClassifier
the base station classifier
virtual void DoDispose(void)
Destructor implementation.
Ptr< Packet > CreateDlMap(void)
Create DL map.
void SetFrameNumber(uint32_t frameNumber)
Set frame number field.
#define list
void SendBursts(void)
Send burst function.
Ptr< WimaxPhy > GetPhy(void) const
Get the physical layer object.
uint8_t GetFc(void) const
Get FC field.
uint8_t GetHt(void) const
Get HT field.
Time m_symbolDuration
symbol duration
void SetChannelEncodings(OfdmDcdChannelEncodings channelEncodings)
Set channel encodings field.
uint8_t GetType(void) const
Get type field.
Definition: mac-messages.cc:56
Hold together all WiMAX-related objects in a NetDevice.
Mac48Address GetMacAddress(void) const
Get the MAC address.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Hold objects of type Ptr<T>.
Definition: pointer.h:36
Ptr< ConnectionManager > GetConnectionManager(void) const
Get the connection manager of the device.
void EndDlSubFrame(void)
End DL subframe function.
This class implements the bandwidth-request mac Header as described by IEEE Standard for Local and me...
void SetFrequency(uint32_t frequency)
Set frequency field.
TracedCallback< Ptr< const Packet >, Mac48Address, Cid > m_traceBSRx
the base station receive trace callback
Cid class.
Definition: cid.h:37
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
Definition: packet.cc:121
void AddDlBurstProfile(OfdmDlBurstProfile dlBurstProfile)
Add DL burst profile field.
uint32_t GetNrFrames(void) const
Get the number of frames.
an EUI-48 address
Definition: mac48-address.h:43
void SetRangReqOppSize(uint16_t rangReqOppSize)
Set range request opp size.
Ptr< BSScheduler > m_scheduler
the base station scheduler
This class implements service flows as described by the IEEE-802.16 standard.
Definition: service-flow.h:39
static EventId ScheduleNow(MEM mem_ptr, OBJ obj)
Schedule an event to expire Now.
Definition: simulator.h:1570
std::list< Ptr< const Packet > > FragmentsQueue
Definition of Fragments Queue data type.
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:1077
Time m_intervalT8
in milliseconds, wait for DSA/DSC Acknowledge timeout
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:249
uint32_t GetNrDcdSent(void) const
Time m_ucdInterval
in seconds
This class implements the OFDM DCD channel encodings as described by "IEEE Standard for Local and met...
void SetDcdInterval(Time dcdInterval)
TracedCallback< Ptr< const Packet > > m_bsPromiscRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
void SetPhy(Ptr< WimaxPhy > phy)
Set the physical layer object.
uint32_t m_nrUcdSent
number UCD sent
void CreateMapMessages(void)
creates the MAC management messages DL-MAP and UL-MAP
bool DoSend(Ptr< Packet > packet, const Mac48Address &source, const Mac48Address &dest, uint16_t protocolNumber)
Send packet.
TracedCallback< Ptr< const Packet > > m_bsTxTrace
The trace source fired when packets come into the "top" of the device at the L3/L2 transition...
Ptr< SSManager > m_ssManager
the SS manager
Time GetIntervalT8(void) const
void SetUplinkScheduler(Ptr< UplinkScheduler > ulScheduler)
void DoReceive(Ptr< Packet > packet)
Receive packet.
This class implements the fragmentation sub-header as described by IEEE Standard for Local and metrop...
void StartUlSubFrame(void)
Start UL subframe function.
Time m_psDuration
ps duration
Time GetDcdInterval(void) const
uint8_t GetDiuc(void) const
Get DIUC field.
void SetDlBurstProfiles(Dcd *dcd)
Send DL burst profiles.
Ptr< IpcsClassifier > GetBsClassifier(void) const
Time m_dcdInterval
in seconds
ModulationType
ModulationType enumeration.
Definition: wimax-phy.h:49
void Start(void)
Start device.
void SetFrequency(uint32_t frequency)
Set frequency.
void SetNrFrames(uint32_t nrFrames)
Set the number of frames.
void SetMaxRangingCorrectionRetries(uint8_t maxRangCorrectionRetries)
uint32_t m_dcdConfigChangeCount
DCD config change count.
uint32_t GetNrDlSymbols(void) const
uint8_t m_maxRangCorrectionRetries
maximum range correction retries
void SetConfigurationChangeCount(uint8_t ucdCount)
Set configuration change count.
void SetCurrentUcd(Ucd ucd)
Set the current UCD.
This class implements the UL-MAP_IE message as described by "IEEE Standard for Local and metropolitan...
uint32_t m_nrUlMapSent
number UL map sent
uint8_t m_ulAllocationNumber
to see UL burst number
Time m_dlSubframeStartTime
DL subframe start time.
void ForwardDown(Ptr< PacketBurst > burst, WimaxPhy::ModulationType modulationType)
Forward a packet down the stack.
void SetBwReqOppSize(uint8_t bwReqOppSize)
Ptr< BSScheduler > GetBSScheduler(void) const
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:270
void StartFrame(void)
Start frame function.
void SetRequestBackoffEnd(uint8_t requestBackoffEnd)
Set request backoff end.
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1014
void CreateDefaultConnections(void)
Creates the initial ranging and broadcast connections.
uint32_t m_framesSinceLastUcd
frames since last UCD
void MarkUplinkAllocationEnd(Time allocationEndTime, Cid cid, uint8_t uiuc)
Mark uplink allocation end.
Ptr< BsServiceFlowManager > m_serviceFlowManager
the service flow manager
Time m_ulSubframeStartTime
UL subframe start time.
Ptr< UplinkScheduler > m_uplinkScheduler
the uplink scheduler
void SetUlBurstProfiles(Ucd *ucd)
Send UL burst profiles.
uint32_t GetNrUcdSent(void) const
Ptr< WimaxConnection > GetConnection(Cid cid)
uint32_t GetNrUlSymbols(void) const
uint8_t GetMaxRangingCorrectionRetries(void) const
uint8_t GetType(void) const
Get type field.
void SetSSManager(Ptr< SSManager > ssManager)
uint32_t m_nrDcdSent
number DCD sent
void SetBaseStationId(Mac48Address baseStationId)
Set base station ID field.
uint32_t m_ucdConfigChangeCount
UCD config change count.
void SetState(uint8_t state)
Set the device state.
bool check_hcs(void) const
Check HCS.
uint16_t GetDuration(void) const
Get duration.
void SetCid(Cid cid)
Set CID function.
void InitBaseStationNetDevice(void)
initializes the BS net device and sets its parameters to the default values
Cid GetCid(void) const
Get CID.
bool check_hcs(void) const
Check HCS.
void AddDlMapElement(OfdmDlMapIe dlMapElement)
Add DL Map element field.
void SetServiceFlowManager(Ptr< BsServiceFlowManager >)
Set service flow manager.
This class is used exclusively by the BS to allocate CIDs to new connections.
Definition: cid-factory.h:45
virtual void DoDispose(void)
Destructor implementation.
void MarkUplinkAllocations(void)
Mark uplink allocations.
void SetNrUlSymbols(uint32_t ulSymbols)
CidFactory * m_cidFactory
the CID factory
virtual void SetNode(Ptr< Node > node)
Set node pointer.
This class implements the DSA-REQ message described by "IEEE Standard for Local and metropolitan area...
Definition: mac-messages.h:373
uint32_t m_nrUlSymbols
number of UL symbols
uint8_t GetRangReqOppSize(void) const
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:45
This class implements the UL-MAP_IE message as described by "IEEE Standard for Local and metropolitan...
void UplinkAllocationStart(void)
Uplink allocation start.
void AddUlMapElement(OfdmUlMapIe ulMapElement)
Add UL map element.
a unique identifier for an interface.
Definition: type-id.h:58
Ptr< WimaxConnection > GetBroadcastConnection(void) const
Get the broadcast connection.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:915
bool IsBroadcast(void) const
Definition: cid.cc:56
void SetReceiveCallback(void)
Set receive callback function.
Cid GetCid(void) const
Set CID field.
static Time m_frameStartTime
temp, to determine the frame start time at SS side, shall actually be determined by frame start pream...
This class implements the OFDM DL-MAP information element as described by "IEEE Standard for Local an...
This class implements the OFDM Downlink burst profile descriptor as described by "IEEE Standard for L...
uint8_t m_maxInvitedRangRetries
maximum invited range retries
void SetConfigurationChangeCount(uint8_t configurationChangeCount)
Set configuration change count field.
void AddHeader(const Header &header)
Add header to this packet.
Definition: packet.cc:256
void SetFecCodeType(uint8_t fecCodeType)
Set FEC code type.
Header for the LLC/SNAP encapsulation.
void SetLen(uint16_t len)
Set length field.
uint8_t GetBwReqOppSize(void) const
static uint8_t m_direction
downlink or uplink
void SetType(uint8_t type)
Set type.
Ptr< Packet > CreateDcd(void)
Create DCD.