A Discrete-Event Network Simulator
API
ss-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 "ns3/simulator.h"
24 #include "ns3/node.h"
25 #include "ns3/config.h"
26 #include "ss-net-device.h"
27 #include "wimax-phy.h"
28 #include "ns3/packet-burst.h"
29 #include <algorithm>
30 #include "dl-mac-messages.h"
31 #include "ul-mac-messages.h"
32 #include "ss-scheduler.h"
33 #include "wimax-mac-queue.h"
34 #include "ns3/trace-source-accessor.h"
35 #include "ns3/pointer.h"
36 #include "ns3/enum.h"
37 #include "service-flow.h"
38 #include "service-flow-record.h"
39 #include "service-flow-manager.h"
40 #include "connection-manager.h"
41 #include "burst-profile-manager.h"
42 #include "ss-link-manager.h"
43 #include "bandwidth-manager.h"
44 
45 namespace ns3 {
46 
47 NS_LOG_COMPONENT_DEFINE ("SubscriberStationNetDevice");
48 
49 NS_OBJECT_ENSURE_REGISTERED (SubscriberStationNetDevice);
50 
52 {
53  return (MicroSeconds (500000));
54 }
55 
56 TypeId
58 {
59  static TypeId
60  tid =
61  TypeId ("ns3::SubscriberStationNetDevice")
62 
64  .SetGroupName ("Wimax")
65 
66  .AddConstructor<SubscriberStationNetDevice> ()
67 
68  .AddAttribute ("BasicConnection",
69  "Basic connection",
70  PointerValue (),
72  MakePointerChecker<WimaxConnection> ())
73 
74  .AddAttribute ("PrimaryConnection",
75  "Primary connection",
76  PointerValue (),
78  MakePointerChecker<WimaxConnection> ())
79 
80  .AddAttribute ("LostDlMapInterval",
81  "Time since last received DL-MAP message before downlink synchronization is considered lost. Maximum is 600ms",
82  TimeValue (Seconds (0.5)),
85  MakeTimeChecker ())
86 
87  .AddAttribute ("LostUlMapInterval",
88  "Time since last received UL-MAP before uplink synchronization is considered lost, maximum is 600.",
89  TimeValue (MilliSeconds (500)),
92  MakeTimeChecker ())
93 
94  .AddAttribute ("MaxDcdInterval",
95  "Maximum time between transmission of DCD messages. Maximum is 10s",
96  TimeValue (Seconds (10)),
99  MakeTimeChecker ())
100 
101  .AddAttribute ("MaxUcdInterval",
102  "Maximum time between transmission of UCD messages. Maximum is 10s",
103  TimeValue (Seconds (10)),
106  MakeTimeChecker ())
107 
108  .AddAttribute ("IntervalT1",
109  "Wait for DCD timeout. Maximum is 5*maxDcdInterval",
110  TimeValue (Seconds (50)),
113  MakeTimeChecker ())
114 
115  .AddAttribute ("IntervalT2",
116  "Wait for broadcast ranging timeout, i.e., wait for initial ranging opportunity. Maximum is 5*Ranging interval",
117  TimeValue (Seconds (10)),
120  MakeTimeChecker ())
121 
122  .AddAttribute ("IntervalT3",
123  "ranging Response reception timeout following the transmission of a ranging request. Maximum is 200ms",
124  TimeValue (Seconds (0.2)),
127  MakeTimeChecker ())
128 
129  .AddAttribute ("IntervalT7",
130  "wait for DSA/DSC/DSD Response timeout. Maximum is 1s",
131  TimeValue (Seconds (0.1)),
134  MakeTimeChecker ())
135 
136  .AddAttribute ("IntervalT12",
137  "Wait for UCD descriptor.Maximum is 5*MaxUcdInterval",
138  TimeValue (Seconds (10)),
141  MakeTimeChecker ())
142 
143  .AddAttribute ("IntervalT20",
144  "Time the SS searches for preambles on a given channel. Minimum is 2 MAC frames",
145  TimeValue (Seconds (0.5)),
148  MakeTimeChecker ())
149 
150  .AddAttribute ("IntervalT21",
151  "time the SS searches for (decodable) DL-MAP on a given channel",
152  TimeValue (Seconds (10)),
155  MakeTimeChecker ())
156 
157  .AddAttribute ("MaxContentionRangingRetries",
158  "Number of retries on contention Ranging Requests",
159  UintegerValue (16),
162  MakeUintegerChecker<uint8_t> (1, 16))
163 
164  .AddAttribute ("SSScheduler",
165  "The ss scheduler attached to this device.",
166  PointerValue (),
169  MakePointerChecker<SSScheduler> ())
170 
171  .AddAttribute ("LinkManager",
172  "The ss link manager attached to this device.",
173  PointerValue (),
176  MakePointerChecker<SSLinkManager> ())
177 
178  .AddAttribute ("Classifier",
179  "The ss classifier attached to this device.",
180  PointerValue (),
183  MakePointerChecker<IpcsClassifier> ())
184 
185  .AddTraceSource ("SSTxDrop",
186  "A packet has been dropped in the MAC layer before being queued for transmission.",
188  "ns3::Packet::TracedCallback")
189 
190  .AddTraceSource ("SSPromiscRx",
191  "A packet has been received by this device, has been passed up from the physical layer "
192  "and is being forwarded up the local protocol stack. This is a promiscuous trace,",
194  "ns3::Packet::TracedCallback")
195 
196  .AddTraceSource ("SSRx",
197  "A packet has been received by this device, has been passed up from the physical layer "
198  "and is being forwarded up the local protocol stack. This is a non-promiscuous trace,",
200  "ns3::Packet::TracedCallback")
201 
202  .AddTraceSource ("SSRxDrop",
203  "A packet has been dropped in the MAC layer after it has been passed up from the physical "
204  "layer.",
206  "ns3::Packet::TracedCallback")
207  ;
208  return tid;
209 }
210 
212 {
213 
215 
216 }
217 
218 void
220 {
223  m_maxDcdInterval = Seconds (10);
224  m_maxUcdInterval = Seconds (10);
226  m_intervalT2 = Seconds (5 * 2); // shall be 5 * RangingInterval, if ranging interval=see T2 at page 638) means Initial Ranging Interval=see page 637)
227  m_intervalT3 = MilliSeconds (200);
228  m_intervalT7 = Seconds (0.1); // maximum is 1
230  m_intervalT21 = Seconds (11);
232  m_dcdCount = 0;
233  m_baseStationId = Mac48Address ("00:00:00:00:00:00");
234  m_ucdCount = 0;
236  m_nrDlMapElements = 0;
237  m_nrUlMapElements = 0;
238  m_nrDlMapRecvd = 0;
239  m_nrUlMapRecvd = 0;
240  m_nrDcdRecvd = 0;
241  m_nrUcdRecvd = 0;
245 
246  m_basicConnection = 0;
248 
251  m_classifier = CreateObject<IpcsClassifier> ();
252  m_linkManager = CreateObject<SSLinkManager> (this);
253  m_scheduler = CreateObject<SSScheduler> (this);
254  m_serviceFlowManager = CreateObject<SsServiceFlowManager> (this);
255 }
256 
258 {
260  this->SetNode (node);
261  this->SetPhy (phy);
262 }
263 
265 {
266 }
267 
268 void
270 {
271  delete m_dlBurstProfile;
272  delete m_ulBurstProfile;
273  m_scheduler = 0;
275  m_basicConnection = 0;
277  m_classifier = 0;
278  m_dlBurstProfile = 0;
279  m_ulBurstProfile = 0;
280 
281  m_linkManager = 0;
282 
286 
288 }
289 
290 void
292 {
293  m_lostDlMapInterval = lostDlMapInterval;
294 }
295 
296 Time
298 {
299  return m_lostDlMapInterval;
300 }
301 
302 void
304 {
305  m_lostUlMapInterval = lostUlMapInterval;
306 }
307 
308 Time
310 {
311  return m_lostUlMapInterval;
312 }
313 
314 void
316 {
317  m_maxDcdInterval = maxDcdInterval;
318 }
319 
320 Time
322 {
323  return m_maxDcdInterval;
324 }
325 
326 void
328 {
329  m_maxUcdInterval = maxUcdInterval;
330 }
331 
332 Time
334 {
335  return m_maxUcdInterval;
336 }
337 
338 void
340 {
341  m_intervalT1 = interval;
342 }
343 
344 Time
346 {
347  return m_intervalT1;
348 }
349 
350 void
352 {
353  m_intervalT2 = interval;
354 }
355 
356 Time
358 {
359  return m_intervalT2;
360 }
361 
362 void
364 {
365  m_intervalT3 = interval;
366 }
367 
368 Time
370 {
371  return m_intervalT3;
372 }
373 
374 void
376 {
377  m_intervalT7 = interval;
378 }
379 
380 Time
382 {
383  return m_intervalT7;
384 }
385 
386 void
388 {
389  m_intervalT12 = interval;
390 }
391 
392 Time
394 {
395  return m_intervalT12;
396 }
397 
398 void
400 {
401  m_intervalT20 = interval;
402 }
403 
404 Time
406 {
407  return m_intervalT20;
408 }
409 
410 void
412 {
413  m_intervalT21 = interval;
414 }
415 
416 Time
418 {
419  return m_intervalT21;
420 }
421 
422 void
424 {
425  m_maxContentionRangingRetries = maxContentionRangingRetries;
426 }
427 
428 uint8_t
430 {
432 }
433 
434 void
436 {
437  m_basicConnection = basicConnection;
438  uint32_t nodeId = GetNode ()->GetId ();
439  uint32_t ifaceId = GetIfIndex ();
440 
442  {
443  std::ostringstream oss;
444  oss << "/NodeList/" << nodeId << "/DeviceList/" << ifaceId << "/$ns3::SubscriberStationNetDevice/BasicConnection/TxQueue/Enqueue";
446  }
448  {
449  std::ostringstream oss;
450  oss << "/NodeList/" << nodeId << "/DeviceList/" << ifaceId << "/$ns3::SubscriberStationNetDevice/BasicConnection/TxQueue/Dequeue";
452  }
454  {
455  std::ostringstream oss;
456  oss << "/NodeList/" << nodeId << "/DeviceList/" << ifaceId << "/$ns3::SubscriberStationNetDevice/BasicConnection/TxQueue/Drop";
458  }
459 }
460 
463 {
464  return m_basicConnection;
465 }
466 
467 void
469 {
470  m_primaryConnection = primaryConnection;
471 
472  uint32_t nodeId = GetNode ()->GetId ();
473  uint32_t ifaceId = GetIfIndex ();
474 
476  {
477  std::ostringstream oss;
478  oss << "/NodeList/" << nodeId << "/DeviceList/" << ifaceId << "/$ns3::SubscriberStationNetDevice/PrimaryConnection/TxQueue/Enqueue";
480  }
482  {
483  std::ostringstream oss;
484  oss << "/NodeList/" << nodeId << "/DeviceList/" << ifaceId << "/$ns3::SubscriberStationNetDevice/PrimaryConnection/TxQueue/Dequeue";
486  }
488  {
489  std::ostringstream oss;
490  oss << "/NodeList/" << nodeId << "/DeviceList/" << ifaceId << "/$ns3::SubscriberStationNetDevice/PrimaryConnection/TxQueue/Drop";
492  }
493 }
494 
497 {
498  return m_primaryConnection;
499 }
500 
501 Cid
503 {
504  return m_basicConnection->GetCid ();
505 }
506 
507 Cid
509 {
510  return m_primaryConnection->GetCid ();
511 }
512 
513 void
515 {
516  m_modulationType = modulationType;
517 }
518 
521 {
522  return m_modulationType;
523 }
524 
525 void
527 {
528  m_areManagementConnectionsAllocated = areManagementConnectionsAllocated;
529 }
530 
531 bool
533 {
535 }
536 
537 void
539 {
540  m_areServiceFlowsAllocated = areServiceFlowsAllocated;
541 }
542 
543 bool
545 {
547 }
548 
551 {
552  return m_scheduler;
553 }
554 
555 void
557 {
558  m_scheduler = scheduler;
559 }
560 
561 bool
563 {
564  return GetServiceFlowManager ()->GetServiceFlows (ServiceFlow::SF_TYPE_ALL).size () > 0;
565 }
566 
569 {
570 
571  return m_classifier;
572 }
573 
574 void
576 {
577  m_classifier = classifier;
578 }
579 
582 {
583  return m_linkManager;
584 }
585 
586 void
588 {
589  m_linkManager = linkManager;
590 }
591 
594 {
595  return m_serviceFlowManager;
596 }
597 
598 void
600 {
601  m_serviceFlowManager = sfm;
602 }
603 
604 void
606 {
608 
609  GetPhy ()->SetPhyParameters ();
610  GetPhy ()->SetDataRates ();
611  m_intervalT20 = Seconds (4 * GetPhy ()->GetFrameDuration ().GetSeconds ());
612 
615 }
616 
617 void
619 {
621 }
622 
623 void
625 {
626  GetServiceFlowManager ()->AddServiceFlow (sf);
627 }
628 
629 void
631 {
632  GetServiceFlowManager ()->AddServiceFlow (sf);
633 }
634 
635 bool
637  const Mac48Address &source,
638  const Mac48Address &dest,
639  uint16_t protocolNumber)
640 {
641  NS_LOG_INFO ("SS (" << source << "):" );
642  NS_LOG_INFO ("\tSending packet..." );
643  NS_LOG_INFO ("\t\tDestination: " << dest );
644  NS_LOG_INFO ("\t\tPacket Size: " << packet->GetSize () );
645  NS_LOG_INFO ("\t\tProtocol: " << protocolNumber );
646 
647  ServiceFlow *serviceFlow = 0;
648 
649  if (IsRegistered ())
650  {
651  NS_LOG_DEBUG ("SS (Basic CID: " << m_basicConnection->GetCid () << ")");
652  }
653  else
654  {
655  NS_LOG_DEBUG ("SS (" << GetMacAddress () << ")");
656  NS_LOG_INFO ("\tCan't send packet! (NotRegitered with the network)");
657  return false;
658  }
659 
660  NS_LOG_DEBUG ("packet to send, size : " << packet->GetSize () << ", destination : " << dest);
661 
662  if (GetServiceFlowManager ()->GetNrServiceFlows () == 0)
663  {
664  NS_LOG_INFO ("\tCan't send packet! (No service Flow)");
665  return false;
666  }
667 
668  if (protocolNumber == 2048)
669  {
670  serviceFlow = m_classifier->Classify (packet, GetServiceFlowManager (), ServiceFlow::SF_DIRECTION_UP);
671  }
672 
673  if ((protocolNumber != 2048) || (serviceFlow == NULL))
674  {
675  serviceFlow = *GetServiceFlowManager ()->GetServiceFlows (ServiceFlow::SF_TYPE_ALL).begin ();
676  NS_LOG_INFO ("\tNo service flows matches...using the default one.");
677  }
678 
679  NS_LOG_INFO ("\tPacket classified in the service flow SFID = " << serviceFlow->GetSfid () << " CID = "
680  << serviceFlow->GetCid ());
681  if (serviceFlow->GetIsEnabled ())
682  {
683  if (!Enqueue (packet, MacHeaderType (), serviceFlow->GetConnection ()))
684  {
685  NS_LOG_INFO ("\tEnqueue ERROR!!" );
686  m_ssTxDropTrace (packet);
687  return false;
688  }
689  else
690  {
691  m_ssTxTrace (packet);
692  }
693  }
694  else
695  {
696  NS_LOG_INFO ("Error!! The Service Flow is not enabled" );
697  m_ssTxDropTrace (packet);
698  return false;
699  }
700 
701  return true;
702 }
703 
704 bool
706  const MacHeaderType &hdrType,
707  Ptr<WimaxConnection> connection)
708 {
709  NS_ASSERT_MSG (connection != 0, "SS: Can not enqueue the packet: the selected connection is nor initialized");
710 
711  GenericMacHeader hdr;
712 
714  {
715  hdr.SetLen (packet->GetSize () + hdr.GetSerializedSize ());
716  hdr.SetCid (connection->GetCid ());
717 
718  }
719 
720  if (connection->GetType () == Cid::TRANSPORT)
721  {
722 
723  if (connection->GetSchedulingType () == ServiceFlow::SF_TYPE_UGS && m_scheduler->GetPollMe ())
724  {
726  "Error while equeuing packet: incorrect header type");
727 
728  GrantManagementSubheader grantMgmntSubhdr;
729  grantMgmntSubhdr.SetPm (true);
730  packet->AddHeader (grantMgmntSubhdr);
731  }
732  }
733  NS_LOG_INFO ("ServiceFlowManager: enqueuing packet" );
734  return connection->Enqueue (packet, hdrType, hdr);
735 }
736 
737 void
739  uint16_t nrSymbols,
740  Ptr<WimaxConnection> connection,
741  MacHeaderType::HeaderType packetType)
742 {
743  WimaxPhy::ModulationType modulationType;
744 
746  {
747  modulationType = WimaxPhy::MODULATION_TYPE_BPSK_12;
748  }
749  else
750  {
751  modulationType = GetBurstProfileManager ()->GetModulationType (uiuc, DIRECTION_UPLINK);
752  }
753  Ptr<PacketBurst> burst = m_scheduler->Schedule (nrSymbols, modulationType, packetType, connection);
754 
755  if (burst->GetNPackets () == 0)
756  {
757  return;
758  }
759 
760  if (IsRegistered ())
761  {
762  NS_LOG_DEBUG ("SS (Basic CID: " << m_basicConnection->GetCid () << ")");
763  }
764  else
765  {
766  NS_LOG_DEBUG ("SS (" << GetMacAddress () << ")");
767  }
768 
769  if (connection->GetType () == Cid::TRANSPORT)
770  {
771  ServiceFlowRecord *record = connection->GetServiceFlow ()->GetRecord ();
772  record->UpdatePktsSent (burst->GetNPackets ());
773  record->UpdateBytesSent (burst->GetSize ());
774 
775  NS_LOG_DEBUG (" sending burst" << ", SFID: " << connection->GetServiceFlow ()->GetSfid () << ", pkts sent: "
776  << record->GetPktsSent () << ", pkts rcvd: " << record->GetPktsRcvd () << ", bytes sent: "
777  << record->GetBytesSent () << ", bytes rcvd: " << record->GetBytesRcvd () );
778 
779  }
780  else
781  {
782 
783  }
784  ForwardDown (burst, modulationType);
785 }
786 
787 void
789 {
790  GenericMacHeader gnrcMacHdr;
791  ManagementMessageType msgType;
792  RngRsp rngrsp;
793  Cid cid;
794  uint32_t pktSize = packet->GetSize ();
795  packet->RemoveHeader (gnrcMacHdr);
796  FragmentationSubheader fragSubhdr;
797  bool fragmentation = false; // it becomes true when there is a fragmentation subheader
798 
799  if (gnrcMacHdr.GetHt () == MacHeaderType::HEADER_TYPE_GENERIC)
800  {
801  if (gnrcMacHdr.check_hcs () == false)
802  {
803  // The header is noisy
804  NS_LOG_INFO ("Header HCS ERROR");
805  m_ssRxDropTrace (packet);
806  return;
807  }
808 
809  cid = gnrcMacHdr.GetCid ();
810 
811  // checking for subheaders
812  uint8_t type = gnrcMacHdr.GetType ();
813  if (type)
814  {
815  // Check if there is a fragmentation Subheader
816  uint8_t tmpType = type;
817  if (((tmpType >> 2) & 1) == 1)
818  {
819  // a TRANSPORT packet with fragmentation subheader has been received!
820  fragmentation = true;
821  NS_LOG_INFO ("SS DoReceive -> the packet is a fragment" << std::endl);
822  }
823  }
824 
825  if (cid == GetBroadcastConnection ()->GetCid () && !fragmentation)
826  {
827  packet->RemoveHeader (msgType);
828  switch (msgType.GetType ())
829  {
831  {
833  {
834  Simulator::Cancel (m_linkManager->GetDlMapSyncTimeoutEvent ());
835  }
836 
838  {
840  }
841 
842  m_linkManager->ScheduleScanningRestart (m_lostDlMapInterval, EVENT_LOST_DL_MAP, false, m_lostDlMapEvent);
843 
845  {
847  }
848 
849  m_linkManager->ScheduleScanningRestart (m_intervalT1,
851  false,
853 
855  {
857  }
858 
859  m_linkManager->ScheduleScanningRestart (m_intervalT12,
861  true,
863 
864  DlMap dlmap;
865  packet->RemoveHeader (dlmap);
866  ProcessDlMap (dlmap);
867  break;
868  }
870  {
872  {
874  m_linkManager->ScheduleScanningRestart (m_lostUlMapInterval,
876  true,
878  }
879 
880  UlMap ulmap;
881  packet->RemoveHeader (ulmap);
882 
883  ProcessUlMap (ulmap);
884 
886  {
887  if (m_linkManager->GetRangingIntervalFound ())
888  {
890  {
892  }
893  m_linkManager->PerformBackoff ();
894  }
895  }
896  break;
897  }
899  {
901  {
903  }
904 
906  {
908  m_linkManager->ScheduleScanningRestart (m_intervalT1,
910  false,
912  }
913 
914  Dcd dcd;
915  // number of burst profiles is set to number of DL-MAP IEs after processing DL-MAP, not a very good solution
916  // dcd.SetNrDlBurstProfiles (m_nrDlMapElements);
917  dcd.SetNrDlBurstProfiles (7);
918  packet->RemoveHeader (dcd);
919 
920  ProcessDcd (dcd);
921  break;
922  }
924  {
925  Ucd ucd;
926  // number of burst profiles is set to number of UL-MAP IEs after processing UL-MAP, not a very good solution
927  // ucd.SetNrUlBurstProfiles (m_nrUlMapElements);
928  ucd.SetNrUlBurstProfiles (7);
929  packet->RemoveHeader (ucd);
930 
931  ProcessUcd (ucd);
932 
934  {
936  m_linkManager->ScheduleScanningRestart (m_intervalT12,
938  true,
940  }
941 
943  {
944  /*state indicating that SS has completed scanning, synchronization and parameter acquisition
945  successfully and now waiting for UL-MAP to start initial ranging.*/
947 
948  m_linkManager->ScheduleScanningRestart (m_intervalT2,
950  false,
952  m_linkManager->ScheduleScanningRestart (m_lostUlMapInterval,
954  true,
956  }
957  break;
958  }
959  default:
960  NS_FATAL_ERROR ("Invalid management message type");
961  }
962  }
963  else if (GetInitialRangingConnection () != 0 && cid == GetInitialRangingConnection ()->GetCid () && !fragmentation)
964  {
965  m_traceSSRx (packet, GetMacAddress (), cid);
966  packet->RemoveHeader (msgType);
967  switch (msgType.GetType ())
968  {
970  // intended for base station, ignore
971  break;
974  "SS: Error while receiving a ranging response message: SS state should be at least SS_STATE_WAITING_REG_RANG_INTRVL");
975  packet->RemoveHeader (rngrsp);
976  m_linkManager->PerformRanging (cid, rngrsp);
977  break;
978  default:
979  NS_LOG_ERROR ("Invalid management message type");
980  }
981  }
982  else if (m_basicConnection != 0 && cid == m_basicConnection->GetCid () && !fragmentation)
983  {
984  m_traceSSRx (packet, GetMacAddress (), cid);
985  packet->RemoveHeader (msgType);
986  switch (msgType.GetType ())
987  {
989  // intended for base station, ignore
990  break;
993  "SS: Error while receiving a ranging response message: SS state should be SS_STATE_WAITING_RNG_RSP");
994  packet->RemoveHeader (rngrsp);
995  m_linkManager->PerformRanging (cid, rngrsp);
996  break;
997  default:
998  NS_LOG_ERROR ("Invalid management message type");
999  }
1000  }
1001  else if (m_primaryConnection != 0 && cid == m_primaryConnection->GetCid () && !fragmentation)
1002  {
1003  m_traceSSRx (packet, GetMacAddress (), cid);
1004  packet->RemoveHeader (msgType);
1005  switch (msgType.GetType ())
1006  {
1008  // not yet implemented
1009  break;
1011  // intended for base station, ignore
1012  break;
1014  /*from other station as DSA initiation
1015  by BS is not supported, ignore*/
1016  break;
1018  {
1019  Simulator::Cancel (GetServiceFlowManager ()->GetDsaRspTimeoutEvent ());
1020  DsaRsp dsaRsp;
1021  packet->RemoveHeader (dsaRsp);
1022  GetServiceFlowManager ()->ProcessDsaRsp (dsaRsp);
1023  break;
1024  }
1026  /*from other station as DSA initiation
1027  by BS is not supported, ignore*/
1028  break;
1029  default:
1030  NS_LOG_ERROR ("Invalid management message type");
1031  }
1032  }
1033  else if (GetConnectionManager ()->GetConnection (cid)) // transport connection
1034  {
1035  ServiceFlow *serviceFlow = GetConnectionManager ()->GetConnection (cid)->GetServiceFlow ();
1036  ServiceFlowRecord *record = serviceFlow->GetRecord ();
1037 
1038  record->UpdatePktsRcvd (1);
1039  record->UpdateBytesRcvd (pktSize);
1040 
1041  // If fragmentation is true, the packet is a fragment.
1042  if (!fragmentation)
1043  {
1044  m_ssRxTrace (packet);
1045  ForwardUp (packet, m_baseStationId, GetMacAddress ()); // source shall be BS's address or sender SS's?
1046  }
1047  else
1048  {
1049  NS_LOG_INFO ( "FRAG_DEBUG: SS DoReceive, the Packet is a fragment" << std::endl);
1050  packet->RemoveHeader (fragSubhdr);
1051  uint32_t fc = fragSubhdr.GetFc ();
1052  NS_LOG_INFO ( "\t fragment size = " << packet->GetSize () << std::endl);
1053 
1054  if (fc == 2)
1055  {
1056  // This is the latest fragment.
1057  // Take the fragment queue, defragment a packet and send it to the upper layer
1058  NS_LOG_INFO ( "\t Received the latest fragment" << std::endl);
1059  GetConnectionManager ()->GetConnection (cid)
1060  ->FragmentEnqueue (packet);
1061 
1063  GetConnection (cid)->GetFragmentsQueue ();
1064 
1065  Ptr<Packet> fullPacket = Create<Packet> ();
1066 
1067  // DEFRAGMENTATION
1068  NS_LOG_INFO ( "\t SS PACKET DEFRAGMENTATION" << std::endl);
1069  for (std::list<Ptr<const Packet> >::const_iterator iter = fragmentsQueue.begin ();
1070  iter != fragmentsQueue.end (); ++iter)
1071  {
1072  // Create the whole Packet
1073  fullPacket->AddAtEnd (*iter);
1074  }
1075  GetConnectionManager ()->GetConnection (cid)
1076  ->ClearFragmentsQueue ();
1077  NS_LOG_INFO ( "\t fullPacket size = " << fullPacket->GetSize () << std::endl);
1078 
1079  m_ssRxTrace (fullPacket);
1080  ForwardUp (fullPacket, m_baseStationId, GetMacAddress ()); // source shall be BS's address or sender SS's?
1081  }
1082  else
1083  {
1084  // This is the first or middle fragment.
1085  // Take the fragment queue, store the fragment into the queue
1086  NS_LOG_INFO ( "\t Received the first or the middle fragment" << std::endl);
1087  GetConnectionManager ()->GetConnection (cid)->FragmentEnqueue (packet);
1088  }
1089  }
1090  }
1091  else if (cid.IsMulticast ())
1092  {
1093  m_traceSSRx (packet, GetMacAddress (), cid);
1094  ForwardUp (packet, m_baseStationId, GetMacAddress ()); // source shall be BS's address or sender SS's?
1095  }
1096  else if (IsPromisc ())
1097  {
1098  NotifyPromiscTrace (packet);
1099  m_ssPromiscRxTrace (packet);
1100 
1101  // not for me, ignore
1102  }
1103  else
1104  {
1105  // not for me drop
1106  }
1107  }
1108  else
1109  {
1110  // from other SS, ignore
1111  }
1112 }
1113 
1114 void
1116 {
1117  m_nrDlMapRecvd++;
1118  m_dcdCount = dlmap.GetDcdCount ();
1119  m_baseStationId = dlmap.GetBaseStationId ();
1120  std::list<OfdmDlMapIe> dlMapElements = dlmap.GetDlMapElements ();
1121 
1122  for (std::list<OfdmDlMapIe>::iterator iter = dlMapElements.begin (); iter != dlMapElements.end (); ++iter)
1123  {
1124  if (iter->GetDiuc () == OfdmDlBurstProfile::DIUC_END_OF_MAP)
1125  {
1126  break;
1127  }
1128 
1129  if (iter->GetCid () == m_basicConnection->GetCid ())
1130  {
1131  /*here the SS shall actually acquire the start time it shall start receiving the burst at. start time is used for power saving
1132  which is not implemented here, furthermore there is no need since the simulator architecture automatically callbacks the receive
1133  function. shall acquire the DIUC (burst profile) as well to decode the burst, again not required again because the callback
1134  mechanism automatically passes it as parameter.*/
1135  }
1136 
1137 #if 0 /* a template for future implementation following */
1138  uint8_t temp = iter->GetDiuc ();
1139  temp = iter->GetPreamblePresent ();
1140  temp = iter->GetStartTime ();
1141 #endif
1142  }
1143 }
1144 
1145 void
1147 {
1148  m_nrUlMapRecvd++;
1149  m_ucdCount = ulmap.GetUcdCount ();
1151  std::list<OfdmUlMapIe> ulMapElements = ulmap.GetUlMapElements ();
1152  m_linkManager->SetRangingIntervalFound (false);
1153 
1154  for (std::list<OfdmUlMapIe>::iterator iter = ulMapElements.begin (); iter != ulMapElements.end (); ++iter)
1155  {
1156  OfdmUlMapIe ulMapIe = *iter;
1157 
1158  if (ulMapIe.GetUiuc () == OfdmUlBurstProfile::UIUC_END_OF_MAP)
1159  {
1160  break;
1161  }
1162 
1163  Cid cid = ulMapIe.GetCid ();
1164 
1165  if (ulMapIe.GetUiuc () == OfdmUlBurstProfile::UIUC_INITIAL_RANGING && cid == GetBroadcastConnection ()->GetCid ())
1166  {
1167  m_linkManager->SetRangingIntervalFound (true);
1168  }
1169 
1170  if (m_areManagementConnectionsAllocated && cid == m_basicConnection->GetCid ())
1171  {
1172 
1173  Time timeToAllocation = GetTimeToAllocation (Seconds (ulMapIe.GetStartTime ()
1174  * GetPhy ()->GetSymbolDuration ().GetSeconds ()));
1175 
1176  if (ulMapIe.GetUiuc () == OfdmUlBurstProfile::UIUC_INITIAL_RANGING) // invited ranging interval
1177 
1178  {
1179 
1180  m_linkManager->IncrementNrInvitedPollsRecvd ();
1182  "SS: Error while processing UL MAP: SS state should be SS_STATE_WAITING_INV_RANG_INTRVL");
1183  Simulator::Schedule (timeToAllocation,
1185  m_linkManager,
1186  ulMapIe.GetUiuc (),
1187  ulMapIe.GetDuration ());
1188  }
1189  else if (ulMapIe.GetUiuc () == OfdmUlBurstProfile::UIUC_REQ_REGION_FULL) // unicast poll
1190 
1191  {
1192 
1193  Simulator::Schedule (timeToAllocation,
1196  ulMapIe.GetUiuc (),
1197  ulMapIe.GetDuration ());
1198  }
1199  else // regular allocation/grant for data, for UGS flows or in response of requests for non-UGS flows
1200 
1201  {
1202 
1203  Ptr<WimaxConnection> connection = NULL;
1204  Simulator::Schedule (timeToAllocation,
1206  this,
1207  ulMapIe.GetUiuc (),
1208  ulMapIe.GetDuration (),
1209  connection,
1211  }
1212  }
1213  else
1214  {
1215  if (ulMapIe.GetUiuc () == OfdmUlBurstProfile::UIUC_INITIAL_RANGING && cid
1216  == GetBroadcastConnection ()->GetCid ()) // regular ranging interval
1217 
1218  {
1220  {
1221  m_linkManager->SetNrRangingTransOpps ((ulMapIe.GetDuration () * GetPhy ()->GetPsPerSymbol ())
1223 
1224  }
1225 
1227  {
1228  m_linkManager->StartContentionResolution ();
1229  }
1230 
1231  }
1232  }
1233  }
1234 }
1235 
1236 void
1238 {
1239  m_nrDcdRecvd++;
1241  {
1242  return; // nothing new in DCD so don't read
1243 
1244  }
1245  SetCurrentDcd (dcd);
1246  OfdmDcdChannelEncodings dcdChnlEncodings = dcd.GetChannelEncodings ();
1247 
1248  // parameters for initial ranging
1249  m_linkManager->SetBsEirp (dcdChnlEncodings.GetBsEirp ());
1250  m_linkManager->SetEirXPIrMax (dcdChnlEncodings.GetEirxPIrMax ());
1251 
1252  GetPhy ()->GetFrameDuration (dcdChnlEncodings.GetFrameDurationCode ());
1253 
1254  std::vector<OfdmDlBurstProfile> dlBurstProfiles = dcd.GetDlBurstProfiles ();
1255 
1256  for (std::vector<OfdmDlBurstProfile>::iterator iter = dlBurstProfiles.begin (); iter != dlBurstProfiles.end (); ++iter)
1257  {
1258  OfdmDlBurstProfile brstProfile = *iter;
1259 
1260  /*NS-2 does this, may be not correct, assumes DIUC/UIUC to
1261  modulation type mapping in DCD/UCD may change over time*/
1262  if (brstProfile.GetFecCodeType () == m_modulationType)
1263  {
1265  m_dlBurstProfile->SetDiuc (brstProfile.GetDiuc ());
1266  }
1267  }
1268 }
1269 
1270 void
1272 {
1273  m_nrUcdRecvd++;
1274  if (!m_linkManager->IsUlChannelUsable ())
1275  {
1276  m_linkManager->StartScanning (EVENT_NONE, false);
1277  return;
1278  }
1279 
1281  {
1282  return; // nothing new in UCD so don't read
1283 
1284  }
1285  SetCurrentUcd (ucd);
1286  m_linkManager->SetRangingCW ((uint8_t) std::pow ((double) 2, (double) ucd.GetRangingBackoffStart ()) - 1); // initializing ranging CW
1287  OfdmUcdChannelEncodings ucdChnlEncodings = ucd.GetChannelEncodings ();
1288 
1289  std::vector<OfdmUlBurstProfile> ulBurstProfiles = ucd.GetUlBurstProfiles ();
1290 
1291  for (std::vector<OfdmUlBurstProfile>::iterator iter = ulBurstProfiles.begin (); iter != ulBurstProfiles.end (); ++iter)
1292  {
1293  OfdmUlBurstProfile brstProfile = *iter;
1294 
1295  /*NS-2 does this, may be not correct, assumes DIUC/UIUC to
1296  modulation type mapping in DCD/UCD may change over time*/
1297  if (brstProfile.GetFecCodeType () == m_modulationType)
1298  {
1300  m_ulBurstProfile->SetUiuc (brstProfile.GetUiuc ());
1301  }
1302  }
1303 }
1304 
1305 /*temporarily assuming registered if ranging is complete,
1306  shall actually consider the registration step also */
1307 bool
1309 {
1310  return GetState () >= SS_STATE_REGISTERED;
1311 }
1312 
1313 Time
1315 {
1316  Time timeAlreadyElapsed = Simulator::Now () - m_frameStartTime;
1317  Time timeToUlSubframe = Seconds (m_allocationStartTime * GetPhy ()->GetPsDuration ().GetSeconds ())
1318  - timeAlreadyElapsed;
1319  return timeToUlSubframe + deferTime;
1320 }
1321 
1322 void
1324 {
1325  if (GetState () == SS_STATE_STOPPED)
1326  {
1327  Simulator::Cancel (eventId); // cancelling this event (already scheduled in function call)
1328  return;
1329  }
1330 
1331  event = eventId;
1332 }
1333 
1334 void
1336 {
1338 }
1339 
1340 void
1342 {
1344 }
1345 
1346 void
1348 {
1349  m_asciiTxQueueDropCb = cb;
1350 }
1351 
1352 } // namespace ns`
void SendBandwidthRequest(uint8_t uiuc, uint16_t allocationSize)
Send bandwidth request.
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
HeaderType
Header type enumeration.
Ptr< WimaxConnection > GetInitialRangingConnection(void) const
Get the initial ranging connection.
void SetIntervalT3(Time interval3)
This class implements the DSA-RSP message described by "IEEE Standard for Local and metropolitan ...
Definition: mac-messages.h:474
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:557
void SetTimer(EventId eventId, EventId &event)
Set timer.
uint32_t GetBytesSent(void) const
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
void SetIntervalT1(Time interval1)
static Time GetDefaultLostDlMapInterval()
Get default lost DL map interval.
This class implements DL-MAP as described by "IEEE Standard for Local and metropolitan area networks ...
Time m_intervalT21
in seconds, time the SS searches for (decodable) DL-MAP on a given channel
uint32_t GetSerializedSize(void) const
void SetLostDlMapInterval(Time lostDlMapInterval)
void ProcessUcd(const Ucd &ucd)
Process UCD.
void ProcessDcd(const Dcd &dcd)
Process DCD.
void SetIntervalT21(Time interval21)
uint32_t GetId(void) const
Definition: node.cc:109
Ptr< WimaxConnection > m_basicConnection
basic connection
This class implements the ranging response message described by "IEEE Standard for Local and metropol...
Definition: mac-messages.h:121
uint8_t GetUiuc(void) const
Get UIUC.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
Ptr< WimaxConnection > m_primaryConnection
primary connection
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:852
uint8_t GetDiuc(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 GetDcdCount(void) const
Get DCD count field.
virtual Ptr< Node > GetNode(void) const
Get node pointer.
this class implements a structure to manage some parameters and statistics related to a service flow ...
uint16_t GetStartTime(void) const
Get start time.
void SetIntervalT2(Time interval2)
void SetModulationType(WimaxPhy::ModulationType modulationType)
Set the most efficient modulation and coding scheme (MCS) supported by the device.
void SetPm(uint8_t pm)
Set PM field.
uint32_t GetPktsSent(void) const
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:380
uint8_t GetType(void) const
Get type field.
void ProcessDlMap(const DlMap &dlmap)
Process DL map.
EventId m_lostUlMapEvent
lost UL map event
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:205
void SetMaxDcdInterval(Time maxDcdInterval)
void SetAsciiTxQueueDequeueCallback(AsciiTraceCallback cb)
Set the Dequeue callback for ASCII tracing.
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1297
void SetAreManagementConnectionsAllocated(bool areManagementConnectionsAllocated)
uint32_t m_nrUcdRecvd
number UCD received
void SetLostUlMapInterval(Time lostUlMapInterval)
Ptr< IpcsClassifier > GetIpcsClassifier() const
uint8_t GetFrameDurationCode(void) const
Get frame duration code field.
uint8_t GetConfigurationChangeCount(void) const
Get configuration change count.
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
void SetAsciiTxQueueDropCallback(AsciiTraceCallback cb)
Set the Drop callback for ASCII tracing.
This class implements the UL burst profile as described by "IEEE Standard for Local and metropolitan ...
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:268
void SetScheduler(Ptr< SSScheduler > ssScheduler)
Time m_lostDlMapInterval
in milliseconds, time since last received DL-MAP before downlink synchronization is considered lost...
void SetMaxUcdInterval(Time maxUcdInterval)
void Start(void)
Start the device.
Cid GetCid(void) const
Get CID field.
Time GetLostDlMapInterval(void) const
std::list< OfdmDlMapIe > GetDlMapElements(void) const
Get DL Map elements field.
Mac48Address m_baseStationId
base station ID
Ptr< SsServiceFlowManager > GetServiceFlowManager(void) const
TracedCallback< Ptr< const Packet > > m_ssPromiscRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
Ptr< SSScheduler > m_scheduler
the scheduler
Ptr< BurstProfileManager > GetBurstProfileManager(void) const
Get the burst profile manager.
void ProcessUlMap(const UlMap &ulmap)
Process UL map.
uint32_t GetSfid(void) const
Get SFID.
bool m_areServiceFlowsAllocated
are service flows allocated
void SetDiuc(uint8_t diuc)
Set DIUC field.
bool GetIsEnabled(void) const
Get is enabled flag.
This class implements the Generic mac Header as described by IEEE Standard for Local and metropolitan...
uint8_t GetUiuc(void) const
Get UIUC.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Time m_intervalT3
in milliseconds, ranging Response reception timeout following the transmission of a ranging request ...
phy
Definition: third.py:93
void SetNrUlBurstProfiles(uint8_t nrUlBurstProfiles)
Set NR UL burst profiles.
void DoReceive(Ptr< Packet > packet)
Receive a packet.
TracedCallback< Ptr< const Packet > > m_ssRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
void AddAtEnd(Ptr< const Packet > packet)
Concatenate the input packet at the end of the current packet.
Definition: packet.cc:335
Ucd GetCurrentUcd(void) const
Get the current UCD.
Ptr< WimaxConnection > GetConnection(void) const
Can return a null connection is this service flow has not been associated yet to a connection...
void SetNrDlBurstProfiles(uint8_t nrDlBurstProfiles)
Set number DL burst profile field.
Time m_intervalT20
in seconds, time the SS searches for preambles on a given channel
uint32_t m_nrDlMapRecvd
number DL map received
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:227
Time m_intervalT7
in seconds, wait for DSA/DSC/DSD Response timeout
void SetIntervalT20(Time interval20)
void SetMaxContentionRangingRetries(uint8_t maxContentionRangingRetries)
uint8_t m_maxContentionRangingRetries
maximum contention ranging retries
void SetCid(Cid cid)
Set CID field.
void SetCurrentDcd(Dcd dcd)
Set the current DCD.
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
Definition: simulator.h:588
uint8_t GetConfigurationChangeCount(void) const
Get configuration change count field.
AttributeValue implementation for Time.
Definition: nstime.h:1353
double m_allocationStartTime
allocation start time
uint32_t m_nrDcdRecvd
number DCD received
void SetIntervalT12(Time interval12)
void SetFecCodeType(uint8_t fecCodeType)
Set FEC code type.
bool DoSend(Ptr< Packet > packet, const Mac48Address &source, const Mac48Address &dest, uint16_t protocolNumber)
Send a packet.
Hold an unsigned integer type.
Definition: uinteger.h:44
bool Enqueue(Ptr< Packet > packet, const MacHeaderType &hdrType, Ptr< WimaxConnection > connection)
Enqueue a packet into a connection queue.
void SetUiuc(uint8_t uiuc)
Set UIUC.
bool GetAreServiceFlowsAllocated(void) const
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 ...
This class implements the UCD message as described by "IEEE Standard for Local and metropolitan area ...
Time m_intervalT12
in seconds, wait for UCD descriptor
Ptr< SsServiceFlowManager > m_serviceFlowManager
the service flow manager
Ptr< BandwidthManager > GetBandwidthManager(void) const
Get the bandwidth manager on the device.
This class implements the grant management sub-header as described by IEEE Standard for Local and met...
TracedCallback< Ptr< const Packet > > m_ssTxTrace
The trace source fired when packets come into the "top" of the device at the L3/L2 transition...
void SetLinkManager(Ptr< SSLinkManager > linkManager)
sets the link manager to be used
uint16_t GetEirxPIrMax(void) const
Get EIRX IR MAX field.
EventId m_ucdWaitTimeoutEvent
UCD wait timeout event.
ServiceFlowRecord * GetRecord(void) const
Get service flow record.
Ptr< WimaxConnection > GetPrimaryConnection(void) const
Mac48Address GetBaseStationId(void) const
Get base station ID field.
bool IsPromisc(void)
Check if device is promiscious.
This class implements Downlink channel descriptor as described by "IEEE Standard for Local and metrop...
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.
This class Represents the HT (Header Type) field of generic MAC and bandwidth request headers...
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 ...
virtual void DoDispose(void)
Destructor implementation.
void Connect(std::string path, const CallbackBase &cb)
Definition: config.cc:920
#define list
Ptr< WimaxPhy > GetPhy(void) const
Get the physical layer object.
uint8_t GetFc(void) const
Get FC field.
void UpdatePktsRcvd(uint32_t pktsRcvd)
update the number of received packets by adding pktsRcvd
uint8_t GetHt(void) const
Get HT field.
Ptr< WimaxConnection > GetBasicConnection(void) const
Dcd GetCurrentDcd(void) const
Get the current DCD.
uint16_t GetBsEirp(void) const
Get BS EIRP field.
uint16_t GetCid(void) const
Get CID.
Time m_maxDcdInterval
in seconds, maximum time between transmission of DCD messages
Time GetLostUlMapInterval(void) const
uint8_t GetType(void) const
Get type field.
Definition: mac-messages.cc:56
EventId m_lostDlMapEvent
lost DL map event
AsciiTraceCallback m_asciiTxQueueDropCb
Bound callback to perform ASCII logging for Drop events.
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
uint32_t GetAllocationStartTime(void) const
Get allocation start time.
Ptr< ConnectionManager > GetConnectionManager(void) const
Get the connection manager of the device.
static TypeId GetTypeId(void)
Get the type ID.
Cid class.
Definition: cid.h:37
void DoDispose(void)
Destructor implementation.
Time m_lostUlMapInterval
in milliseconds, time since last received UL-MAP before uplink synchronization is considered lost...
Ptr< SSLinkManager > GetLinkManager(void) const
uint32_t GetPktsRcvd(void) const
std::list< OfdmUlMapIe > GetUlMapElements(void) const
Get UL map elements.
AsciiTraceCallback m_asciiTxQueueEnqueueCb
Bound callback to perform ASCII logging for Enqueue events.
uint8_t GetRangingBackoffStart(void) const
Get ranging backoff start.
OfdmUcdChannelEncodings GetChannelEncodings(void) const
Get channel encodings.
an EUI-48 address
Definition: mac48-address.h:43
This class implements service flows as described by the IEEE-802.16 standard.
Definition: service-flow.h:39
AsciiTraceCallback m_asciiTxQueueDequeueCb
Bound callback to perform ASCII logging for Dequeue events.
std::list< Ptr< const Packet > > FragmentsQueue
Definition of Fragments Queue data type.
Ptr< SSLinkManager > m_linkManager
link manager
void SetBasicConnection(Ptr< WimaxConnection > basicConnection)
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:1354
TracedCallback< Ptr< const Packet >, Mac48Address, const Cid & > m_traceSSRx
trace SS receive callback
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:195
This class implements the OFDM DCD channel encodings as described by "IEEE Standard for Local and met...
void SetPhy(Ptr< WimaxPhy > phy)
Set the physical layer object.
void SetAreServiceFlowsAllocated(bool areServiceFlowsAllocated)
bool GetAreManagementConnectionsAllocated(void) const
This class implements the fragmentation sub-header as described by IEEE Standard for Local and metrop...
#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:88
uint16_t m_nrDlMapElements
number DL Map elements
void NotifyPromiscTrace(Ptr< Packet > p)
Notify promiscious trace of a packet arrival.
void SetIpcsPacketClassifier(Ptr< IpcsClassifier > classifier)
Sets the packet classifier to be used.
ModulationType
ModulationType enumeration.
Definition: wimax-phy.h:49
EventId m_rangOppWaitTimeoutEvent
range opp wait timeout event
WimaxPhy::ModulationType GetModulationType(void) const
uint8_t GetMaxContentionRangingRetries(void) const
bool m_areManagementConnectionsAllocated
are management connections allocated
An identifier for simulation events.
Definition: event-id.h:53
Time m_intervalT2
in seconds, wait for broadcast ranging timeout, i.e., wait for initial ranging opportunity ...
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...
void ForwardDown(Ptr< PacketBurst > burst, WimaxPhy::ModulationType modulationType)
Forward a packet down the stack.
void SetAsciiTxQueueEnqueueCallback(AsciiTraceCallback cb)
Set the Enqueue callback for ASCII tracing.
Ptr< SSScheduler > GetScheduler(void) const
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1289
void SetIntervalT7(Time interval7)
void CreateDefaultConnections(void)
Creates the initial ranging and broadcast connections.
std::vector< OfdmUlBurstProfile > GetUlBurstProfiles(void) const
Get UL burst profiles.
bool IsRunning(void) const
This method is syntactic sugar for !IsExpired().
Definition: event-id.cc:71
bool IsMulticast(void) const
Definition: cid.cc:51
OfdmDlBurstProfile * m_dlBurstProfile
DL burst profile.
void Nullify(void)
Discard the implementation, set it to null.
Definition: callback.h:1391
uint8_t GetType(void) const
Get type field.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:533
virtual uint32_t GetIfIndex(void) const
Get interface index.
SubscriberStationNetDevice subclass of WimaxNetDevice.
Definition: ss-net-device.h:48
Time m_intervalT1
in seconds, wait for DCD timeout
Time m_maxUcdInterval
in seconds, maximum time between transmission of UCD messages
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1305
void SetState(uint8_t state)
Set the device state.
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR.
Definition: log.h:257
uint8_t GetFecCodeType(void) const
Get FEC code type.
uint16_t GetDuration(void) const
Get duration.
Ptr< IpcsClassifier > m_classifier
the classifier
void InitSubscriberStationNetDevice(void)
initializes the net device and sets the parameters to the default values
Cid GetCid(void) const
Get CID.
bool check_hcs(void) const
Check HCS.
uint8_t GetState(void) const
Get the device state.
WimaxPhy::ModulationType m_modulationType
modulation type
void UpdateBytesSent(uint32_t bytesSent)
update the number of sent bytes by adding bytesSent
Time GetTimeToAllocation(Time deferTime)
Get time to allocation.
bool IsNull(void) const
Check for null implementation.
Definition: callback.h:1386
virtual void SetNode(Ptr< Node > node)
Set node pointer.
OfdmUlBurstProfile * m_ulBurstProfile
UL burst profile.
uint32_t pktSize
packet size used for the simulation (in bytes)
Definition: wifi-bianchi.cc:83
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 AddServiceFlow(ServiceFlow *sf)
adds a new service flow
a unique identifier for an interface.
Definition: type-id.h:58
uint32_t GetBytesRcvd(void) const
uint16_t m_nrUlMapElements
number UL Map elements
void SetServiceFlowManager(Ptr< SsServiceFlowManager > sfm)
Sets the service flow manager to be installed on the device.
Ptr< WimaxConnection > GetBroadcastConnection(void) const
Get the broadcast connection.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
void SetReceiveCallback(void)
Set receive callback function.
uint32_t m_nrUlMapRecvd
number UL map received
static Time m_frameStartTime
temp, to determine the frame start time at SS side, shall actually be determined by frame start pream...
void SetPrimaryConnection(Ptr< WimaxConnection > primaryConnection)
uint8_t GetUcdCount(void) const
Get UCD count.
This class implements the OFDM Downlink burst profile descriptor as described by "IEEE Standard for L...
OfdmDcdChannelEncodings GetChannelEncodings(void) const
Get channel encodings field.
void AddHeader(const Header &header)
Add header to this packet.
Definition: packet.cc:256
uint8_t GetFecCodeType(void) const
void SetFecCodeType(uint8_t fecCodeType)
Set FEC code type.
void SetLen(uint16_t len)
Set length field.
void Stop(void)
Stop the device.
std::vector< OfdmDlBurstProfile > GetDlBurstProfiles(void) const
Get DL burst profile field.
uint16_t GetRangReqOppSize(void) const
Get range request opp size.
void UpdatePktsSent(uint32_t pktsSent)
update the number of sent packets by adding pktsSent
EventId m_dcdWaitTimeoutEvent
DCD wait timeout event.
void UpdateBytesRcvd(uint32_t bytesRcvd)
update the number of received bytes by adding bytesRcvd