25 #include "ns3/simulator.h" 
   26 #include "ns3/drop-tail-queue.h" 
   31 #include "ns3/packet-burst.h" 
   37 #include "ns3/trace-source-accessor.h" 
   38 #include "ns3/pointer.h" 
   40 #include "ns3/uinteger.h" 
   46 #include "ns3/ipv4-address.h" 
   47 #include "ns3/llc-snap-header.h" 
   62     .AddConstructor<BaseStationNetDevice> ()
 
   64     .AddAttribute (
"BSScheduler",
 
   65                    "Downlink Scheduler for BS",
 
   68                    MakePointerChecker<BSScheduler> ())
 
   70     .AddAttribute (
"InitialRangInterval",
 
   71                    "Time between Initial Ranging regions assigned by the BS. Maximum is 2s",
 
   77     .AddAttribute (
"DcdInterval",
 
   78                    "Time between transmission of DCD messages. Maximum value is 10s.",
 
   83     .AddAttribute (
"UcdInterval",
 
   84                    "Time between transmission of UCD messages. Maximum value is 10s.",
 
   89     .AddAttribute (
"IntervalT8",
 
   90                    "Wait for DSA/DSC Acknowledge timeout. Maximum 300ms.",
 
   95     .AddAttribute (
"RangReqOppSize",
 
   96                    "The ranging opportunity size in symbols",
 
  100                    MakeUintegerChecker<uint8_t> (1, 256))
 
  102     .AddAttribute (
"BwReqOppSize",
 
  103                    "The bandwidth request opportunity size in symbols",
 
  106                    MakeUintegerChecker<uint8_t> (1, 256))
 
  108     .AddAttribute (
"MaxRangCorrectionRetries",
 
  109                    "Number of retries on contention Ranging Requests",
 
  113                    MakeUintegerChecker<uint8_t> (1, 16))
 
  115     .AddAttribute (
"SSManager",
 
  116                    "The ss manager attached to this device.",
 
  119                    MakePointerChecker<SSManager> ())
 
  121     .AddAttribute (
"Scheduler",
 
  122                    "The BS scheduler attached to this device.",
 
  125                    MakePointerChecker<BSScheduler> ())
 
  127     .AddAttribute (
"LinkManager",
 
  128                    "The link manager attached to this device.",
 
  131                    MakePointerChecker<BSLinkManager> ())
 
  133     .AddAttribute (
"UplinkScheduler",
 
  134                    "The uplink scheduler attached to this device.",
 
  138                    MakePointerChecker<UplinkScheduler> ())
 
  140     .AddAttribute (
"BsIpcsPacketClassifier",
 
  141                    "The uplink IP packet classifier attached to this device.",
 
  144                    MakePointerChecker<IpcsClassifier> ())
 
  146     .AddAttribute (
"ServiceFlowManager",
 
  147                    "The service flow manager attached to this device.",
 
  151                    MakePointerChecker<ServiceFlowManager> ())
 
  153     .AddTraceSource (
"BSTx", 
"A packet has been received from higher layers and is being processed in preparation for " 
  156     .AddTraceSource (
"BSTxDrop",
 
  157                      "A packet has been dropped in the MAC layer before being queued for transmission.",
 
  160     .AddTraceSource (
"BSPromiscRx",
 
  161                      "A packet has been received by this device, has been passed up from the physical layer " 
  162                      "and is being forwarded up the local protocol stack.  This is a promiscuous trace,",
 
  165     .AddTraceSource (
"BSRx",
 
  166                      "A packet has been received by this device, has been passed up from the physical layer " 
  167                      "and is being forwarded up the local protocol stack.  This is a non-promiscuous trace,",
 
  170     .AddTraceSource (
"BSRxDrop",
 
  171                      "A packet has been dropped in the MAC layer after it has been passed up from the physical " 
  503   GetPhy ()->SetPhyParameters ();
 
  504   GetPhy ()->SetDataRates ();
 
  529   uint32_t symbolsPerFrame = 
GetPhy ()->GetSymbolsPerFrame ();
 
  600                               uint16_t protocolNumber)
 
  612   if (protocolNumber == 2048)
 
  617   if (protocolNumber != 2048 || serviceFlow == 0)
 
  622   if (serviceFlow == 0)
 
  628   if (serviceFlow->GetIsEnabled ())
 
  652                  "BS: Can not enqueue packet on the selected connection: the connection is not initialized");
 
  657   hdr.
SetCid (connection->GetCid ());
 
  659   return connection->Enqueue (packet, hdrType, hdr);
 
  676   bool fragmentation = 
false;  
 
  689       cid = gnrcMacHdr.
GetCid ();
 
  701           uint8_t tmpType = type;
 
  702           if (((tmpType >> 2) & 1) == 1)
 
  705               NS_LOG_INFO (
"FRAG_DEBUG: DoReceive -> the packet is a fragment" << std::endl);
 
  706               fragmentation = 
true;
 
  804               NS_LOG_INFO ( 
"FRAG_DEBUG: BS DoReceive, the Packet is a fragment" << std::endl);
 
  806               uint32_t fc = fragSubhdr.
GetFc ();
 
  812                   NS_LOG_INFO (
"\t Received the latest fragment" << std::endl);
 
  814                   ->FragmentEnqueue (packet);
 
  820                   NS_LOG_INFO (
"\t BS PACKET DEFRAGMENTATION" << std::endl);
 
  822                        iter != fragmentsQueue.end (); ++iter)
 
  828                   ->ClearFragmentsQueue ();
 
  839                   NS_LOG_INFO (
"\t Received the first or the middle fragment" << std::endl);
 
  841                   ->FragmentEnqueue (packet);
 
  852                      "A bandwidth request should be carried by a bandwidth header type");
 
  859       cid = bwRequestHdr.
GetCid ();
 
  871   bool sendDcd = 
false, sendUcd = 
false, updateDcd = 
false, updateUcd = 
false;
 
  873   uint16_t currentNrSsRegistered = 
m_ssManager->GetNRegisteredSSs ();
 
  877       m_uplinkScheduler->GetChannelDescriptorsToUpdate (updateDcd, updateUcd, sendDcd, sendUcd);
 
  881       sendDcd = sendUcd = 
true;
 
  948   Time txTime = Seconds (0);
 
  949   std::pair<OfdmDlMapIe*, Ptr<PacketBurst> > pair;
 
  951   std::list<std::pair<OfdmDlMapIe*, Ptr<PacketBurst> > > *downlinkBursts = 
m_scheduler->GetDownlinkBursts ();
 
  956   while (downlinkBursts->size ())
 
  958       pair = downlinkBursts->front ();
 
  960       dlMapIe = pair.first;
 
  962       uint8_t diuc = dlMapIe->
GetDiuc ();
 
  981       txTime += 
GetPhy ()->GetTransmissionTime (burst->GetSize (), modulationType);
 
  982       downlinkBursts->pop_front ();
 
  996   std::list<std::pair<OfdmDlMapIe*, Ptr<PacketBurst> > > *downlinkBursts = 
m_scheduler->GetDownlinkBursts ();
 
  999        != downlinkBursts->end (); ++iter)
 
 1001       iter->first->SetPreamblePresent (0);
 
 1002       iter->first->SetStartTime (0);
 
 1061   std::list<OfdmUlMapIe> uplinkAllocations = 
m_uplinkScheduler->GetUplinkAllocations ();
 
 1063   for (std::list<OfdmUlMapIe>::iterator iter = uplinkAllocations.begin (); iter != uplinkAllocations.end (); ++iter)
 
 1153   NS_ASSERT_MSG (connection != 0, 
"BS: Invalid connection=0");
 
 1160   uint16_t symbolsToAllocation = 0;
 
 1161   std::list<OfdmUlMapIe> uplinkAllocations = 
m_uplinkScheduler->GetUplinkAllocations ();
 
 1162   for (std::list<OfdmUlMapIe>::iterator iter = uplinkAllocations.begin (); iter != uplinkAllocations.end (); ++iter)
 
 1171       symbolsToAllocation = uplinkAllocation.
GetStartTime ();
 
void SetUcdInterval(Time ucdInterval)
 
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer. 
 
BaseStationNetDevice(void)
 
void RangingOppStart(void)
 
uint8_t m_rangingOppNumber
 
void SetRtg(uint16_t rtg)
 
keep track of time values and allow control of global simulation resolution 
 
void SetUcdCount(uint8_t ucdCount)
 
Time GetIntervalT8(void) const 
 
void SetNrDlSymbols(uint32_t dlSymbols)
 
Doxygen introspection did not find any typical Config paths. 
 
Doxygen introspection did not find any typical Config paths. 
 
uint16_t GetRtg(void) const 
 
void StartDlSubFrame(void)
 
void SetEirxPIrMax(uint16_t rss_ir_max)
 
uint32_t GetNrDcdSent(void) const 
 
uint16_t m_nrSsRegistered
 
void SetLength(uint8_t length)
 
void MarkRangingOppStart(Time rangingOppStartTime)
 
void SetBsEirp(uint16_t bs_eirp)
 
Doxygen introspection did not find any typical Config paths. 
 
void SetRangingBackoffEnd(uint8_t rangingBackoffEnd)
 
Doxygen introspection did not find any typical Config paths. 
 
void SetLinkManager(Ptr< BSLinkManager > linkManager)
 
void ForwardUp(Ptr< Packet > packet, const Mac48Address &source, const Mac48Address &dest)
 
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
 
Ptr< WimaxConnection > GetBroadcastConnection(void) const 
 
uint32_t GetSize(void) const 
 
Ptr< BSScheduler > GetBSScheduler(void) const 
 
TracedCallback< Ptr< const Packet > > m_bsRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
 
uint8_t GetMaxRangingCorrectionRetries(void) const 
 
bool IsBroadcast(void) const 
 
Time m_initialRangInterval
 
static void Cancel(const EventId &id)
Set the cancel bit on this event: the event's associated function will not be invoked when it expires...
 
void SetBSScheduler(Ptr< BSScheduler > bsSchedule)
 
Ptr< ConnectionManager > GetConnectionManager(void) const 
 
uint8_t GetRangReqOppSize(void) const 
 
static EventId Schedule(Time const &time, MEM mem_ptr, OBJ obj)
Schedule an event to expire at the relative time "time" is reached. 
 
uint8_t GetType(void) const 
 
Ptr< Packet > CreateUcd(void)
 
void SetChannelNr(uint8_t channelNr)
 
void SetMaxInvitedRangRetries(uint8_t maxInvitedRangRetries)
 
void SetIntervalT8(Time interval)
 
void SetBsClassifier(Ptr< IpcsClassifier > classifier)
 
void SetType(uint8_t type)
 
void SetLength(uint8_t length)
 
void UplinkAllocationEnd(Cid cid, uint8_t uiuc)
 
bool IsBasic(Cid cid) const 
 
void SetDiuc(uint8_t diuc)
 
void SetChannelEncodings(OfdmUcdChannelEncodings channelEncodings)
 
#define NS_FATAL_ERROR(msg)
fatal error handling 
 
void SetStartTime(uint16_t startTime)
 
uint16_t m_nrUlAllocations
 
void SetPreamblePresent(uint8_t preamblePresent)
 
void SetFrameDurationCode(uint8_t frameDurationCode)
 
uint32_t GetNrFrames(void) const 
 
Time GetDcdInterval(void) const 
 
void SetSbchnlReqRegionFullParams(uint8_t sbchnlReqRegionFullParams)
 
void SetBaseStationId(Mac48Address baseStationID)
 
double GetSeconds(void) const 
 
void AddAtEnd(Ptr< const Packet > packet)
Concatenate the input packet at the end of the current packet. 
 
void SetRequestBackoffStart(uint8_t requestBackoffStart)
 
Ptr< Packet > CreateUlMap(void)
 
uint32_t m_framesSinceLastDcd
 
void MarkUplinkAllocationStart(Time allocationStartTime)
 
uint8_t GetMaxInvitedRangRetries(void) const 
 
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)
 
bool Enqueue(Ptr< Packet > packet, const MacHeaderType &hdrType, Ptr< WimaxConnection > connection)
Enqueue a packet into a connection queue. 
 
uint16_t GetTtg(void) const 
 
void SetSbchnlFocContCodes(uint8_t sbchnlFocContCodes)
 
void SetCurrentDcd(Dcd dcd)
 
void SetRangReqOppSize(uint8_t rangReqOppSize)
 
hold objects of type ns3::Time 
 
void SetTtg(uint16_t ttg)
 
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 ...
 
Time GetInitialRangingInterval(void) const 
 
void SetFecCodeType(uint8_t fecCodeType)
 
static Cid InitialRanging(void)
 
Time GetSymbolDuration(void) const 
 
Hold an unsigned integer type. 
 
void SetDcdCount(uint8_t dcdCount)
 
void SetUiuc(uint8_t uiuc)
 
Doxygen introspection did not find any typical Config paths. 
 
void SetAllocationStartTime(uint32_t allocationStartTime)
 
bool IsInitialRanging(void) const 
 
static TypeId GetTypeId(void)
 
void SetRangingBackoffStart(uint8_t rangingBackoffStart)
 
Time GetPsDuration(void) const 
 
uint16_t m_nrDlAllocations
 
Ptr< UplinkScheduler > GetUplinkScheduler(void) const 
 
void SetInitialRangingInterval(Time initialRangInterval)
 
Ptr< IpcsClassifier > GetBsClassifier(void) const 
 
Ptr< WimaxConnection > GetInitialRangingConnection(void) const 
 
uint32_t m_allocationStartTime
 
Ptr< BandwidthManager > GetBandwidthManager(void) const 
 
Ptr< BSLinkManager > m_linkManager
 
void SetBwReqOppSize(uint16_t bwReqOppSize)
 
void AddUlBurstProfile(OfdmUlBurstProfile ulBurstProfile)
 
Doxygen introspection did not find any typical Config paths. 
 
~BaseStationNetDevice(void)
 
Mac48Address GetMacAddress(void) const 
 
Ptr< IpcsClassifier > m_bsClassifier
 
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
 
Ptr< Packet > CreateDlMap(void)
 
void SetFrameNumber(uint32_t frameNumber)
 
Ptr< BsServiceFlowManager > GetServiceFlowManager(void) const 
 
uint8_t GetUiuc(void) const 
 
Ptr< Packet > Copy(void) const 
 
void SetChannelEncodings(OfdmDcdChannelEncodings channelEncodings)
 
uint8_t GetBwReqOppSize(void) const 
 
Hold together all Wimax-related objects in a NetDevice. 
 
uint16_t GetDuration(void) const 
 
this class implements the bandwidth-request mac Header as described by IEEE Standard for Local and me...
 
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
 
void SetFrequency(uint32_t frequency)
 
TracedCallback< Ptr< const Packet >, Mac48Address, Cid > m_traceBSRx
 
void AddDlBurstProfile(OfdmDlBurstProfile dlBurstProfile)
 
uint8_t GetRangingOppNumber(void) const 
 
void SetRangReqOppSize(uint16_t rangReqOppSize)
 
Ptr< BSScheduler > m_scheduler
 
This class implements service flows as described by the IEEE-802.16 standard. 
 
static EventId ScheduleNow(MEM mem_ptr, OBJ obj)
Schedule an event to expire Now. 
 
std::list< Ptr< const Packet > > FragmentsQueue
 
NS_LOG_COMPONENT_DEFINE("BaseStationNetDevice")
 
static Time Now(void)
Return the "current simulation time". 
 
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)
 
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)
 
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
 
void SetUplinkScheduler(Ptr< UplinkScheduler > ulScheduler)
 
uint32_t GetNrDlSymbols(void) const 
 
void DoReceive(Ptr< Packet > packet)
 
#define NS_ASSERT_MSG(condition, message)
 
void CreateDescriptorMessages(bool sendDcd, bool senUcd)
creates the channel descriptor MAC management messages DCD and UCD 
 
void StartUlSubFrame(void)
 
void SetDlBurstProfiles(Dcd *dcd)
 
Ptr< BurstProfileManager > GetBurstProfileManager(void) const 
 
void SetFrequency(uint32_t frequency)
 
void SetNrFrames(uint32_t nrFrames)
 
uint32_t GetNrUlSymbols(void) const 
 
void SetMaxRangingCorrectionRetries(uint8_t maxRangCorrectionRetries)
 
uint32_t m_dcdConfigChangeCount
 
uint8_t m_maxRangCorrectionRetries
 
void SetConfigurationChangeCount(uint8_t ucdCount)
 
void SetCurrentUcd(Ucd ucd)
 
Doxygen introspection did not find any typical Config paths. 
 
uint8_t m_ulAllocationNumber
 
Time m_dlSubframeStartTime
 
void ForwardDown(Ptr< PacketBurst > burst, WimaxPhy::ModulationType modulationType)
 
Ptr< BSLinkManager > GetLinkManager(void) const 
 
Ptr< WimaxPhy > GetPhy(void) const 
 
Time GetUcdInterval(void) const 
 
void SetBwReqOppSize(uint8_t bwReqOppSize)
 
#define NS_LOG_DEBUG(msg)
 
Ptr< SSManager > GetSSManager(void) const 
 
void SetRequestBackoffEnd(uint8_t requestBackoffEnd)
 
void CreateDefaultConnections(void)
 
uint32_t m_framesSinceLastUcd
 
void MarkUplinkAllocationEnd(Time allocationEndTime, Cid cid, uint8_t uiuc)
 
Ptr< BsServiceFlowManager > m_serviceFlowManager
 
Time m_ulSubframeStartTime
 
Ptr< UplinkScheduler > m_uplinkScheduler
 
void SetUlBurstProfiles(Ucd *ucd)
 
Ptr< WimaxConnection > GetConnection(Cid cid)
 
void SetSSManager(Ptr< SSManager > ssManager)
 
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range. 
 
uint8_t GetDiuc(void) const 
 
Time GetDlSubframeStartTime(void) const 
 
void SetBaseStationId(Mac48Address baseStationId)
 
uint32_t m_ucdConfigChangeCount
 
void SetState(uint8_t state)
 
bool check_hcs(void) const 
 
void InitBaseStationNetDevice(void)
initializes the BS net device and sets its parameters to the default values 
 
void AddDlMapElement(OfdmDlMapIe dlMapElement)
 
void SetServiceFlowManager(Ptr< BsServiceFlowManager >)
 
This class is used exclusively by the BS to allocate CIDs to new connections. 
 
void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
 
void MarkUplinkAllocations(void)
 
uint8_t GetHt(void) const 
 
void SetNrUlSymbols(uint32_t ulSymbols)
 
CidFactory * m_cidFactory
 
virtual void SetNode(Ptr< Node > node)
 
Doxygen introspection did not find any typical Config paths. 
 
bool IsPrimary(Cid cid) const 
 
void UplinkAllocationStart(void)
 
void AddUlMapElement(OfdmUlMapIe ulMapElement)
 
a unique identifier for an interface. 
 
TypeId SetParent(TypeId tid)
 
void SetReceiveCallback(void)
 
Time GetUlSubframeStartTime(void) const 
 
static Time m_frameStartTime
 
uint16_t GetStartTime(void) const 
 
uint8_t m_maxInvitedRangRetries
 
void SetConfigurationChangeCount(uint8_t configurationChangeCount)
 
uint32_t GetNrUcdSent(void) const 
 
void AddHeader(const Header &header)
Add header to this packet. 
 
void SetFecCodeType(uint8_t fecCodeType)
 
static uint8_t m_direction
 
void SetType(uint8_t type)
 
Ptr< Packet > CreateDcd(void)