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" 
   61     .SetGroupName(
"Wimax")
 
   65     .AddAttribute (
"BSScheduler",
 
   66                    "Downlink Scheduler for BS",
 
   69                    MakePointerChecker<BSScheduler> ())
 
   71     .AddAttribute (
"InitialRangInterval",
 
   72                    "Time between Initial Ranging regions assigned by the BS. Maximum is 2s",
 
   78     .AddAttribute (
"DcdInterval",
 
   79                    "Time between transmission of DCD messages. Maximum value is 10s.",
 
   84     .AddAttribute (
"UcdInterval",
 
   85                    "Time between transmission of UCD messages. Maximum value is 10s.",
 
   90     .AddAttribute (
"IntervalT8",
 
   91                    "Wait for DSA/DSC Acknowledge timeout. Maximum 300ms.",
 
   96     .AddAttribute (
"RangReqOppSize",
 
   97                    "The ranging opportunity size in symbols",
 
  101                    MakeUintegerChecker<uint8_t> (1, 256))
 
  103     .AddAttribute (
"BwReqOppSize",
 
  104                    "The bandwidth request opportunity size in symbols",
 
  107                    MakeUintegerChecker<uint8_t> (1, 256))
 
  109     .AddAttribute (
"MaxRangCorrectionRetries",
 
  110                    "Number of retries on contention Ranging Requests",
 
  114                    MakeUintegerChecker<uint8_t> (1, 16))
 
  116     .AddAttribute (
"SSManager",
 
  117                    "The ss manager attached to this device.",
 
  120                    MakePointerChecker<SSManager> ())
 
  122     .AddAttribute (
"Scheduler",
 
  123                    "The BS scheduler attached to this device.",
 
  126                    MakePointerChecker<BSScheduler> ())
 
  128     .AddAttribute (
"LinkManager",
 
  129                    "The link manager attached to this device.",
 
  132                    MakePointerChecker<BSLinkManager> ())
 
  134     .AddAttribute (
"UplinkScheduler",
 
  135                    "The uplink scheduler attached to this device.",
 
  139                    MakePointerChecker<UplinkScheduler> ())
 
  141     .AddAttribute (
"BsIpcsPacketClassifier",
 
  142                    "The uplink IP packet classifier attached to this device.",
 
  145                    MakePointerChecker<IpcsClassifier> ())
 
  147     .AddAttribute (
"ServiceFlowManager",
 
  148                    "The service flow manager attached to this device.",
 
  152                    MakePointerChecker<ServiceFlowManager> ())
 
  154     .AddTraceSource (
"BSTx",
 
  155                      "A packet has been received from higher layers " 
  156                      "and is being processed in preparation " 
  157                      "for queueing for transmission.",
 
  159                      "ns3::Packet::TracedCallback")
 
  161     .AddTraceSource (
"BSTxDrop",
 
  162                      "A packet has been dropped in the MAC layer " 
  163                      "before being queued for transmission.",
 
  165                      "ns3::Packet::TracedCallback")
 
  167     .AddTraceSource (
"BSPromiscRx",
 
  168                      "A packet has been received by this device, " 
  169                      "has been passed up from the physical layer " 
  170                      "and is being forwarded up the local protocol stack.  " 
  171                      "This is a promiscuous trace,",
 
  173                      "ns3::Packet::TracedCallback")
 
  175     .AddTraceSource (
"BSRx",
 
  176                      "A packet has been received by this device, " 
  177                      "has been passed up from the physical layer " 
  178                      "and is being forwarded up the local protocol stack.  " 
  179                      "This is a non-promiscuous trace,",
 
  181                      "ns3::Packet::TracedCallback")
 
  183     .AddTraceSource (
"BSRxDrop",
 
  184                      "A packet has been dropped in the MAC layer " 
  185                      "after it has been passed up from the physical layer.",
 
  187                      "ns3::Packet::TracedCallback");
 
  517   GetPhy ()->SetPhyParameters ();
 
  518   GetPhy ()->SetDataRates ();
 
  543   uint32_t symbolsPerFrame = 
GetPhy ()->GetSymbolsPerFrame ();
 
  614                               uint16_t protocolNumber)
 
  626   if (protocolNumber == 2048)
 
  631   if (protocolNumber != 2048 || serviceFlow == 0)
 
  636   if (serviceFlow == 0)
 
  642   if (serviceFlow->GetIsEnabled ())
 
  666                  "BS: Can not enqueue packet on the selected connection: the connection is not initialized");
 
  671   hdr.
SetCid (connection->GetCid ());
 
  673   return connection->Enqueue (packet, hdrType, hdr);
 
  690   bool fragmentation = 
false;  
 
  703       cid = gnrcMacHdr.
GetCid ();
 
  715           uint8_t tmpType = type;
 
  716           if (((tmpType >> 2) & 1) == 1)
 
  719               NS_LOG_INFO (
"FRAG_DEBUG: DoReceive -> the packet is a fragment" << std::endl);
 
  720               fragmentation = 
true;
 
  818               NS_LOG_INFO ( 
"FRAG_DEBUG: BS DoReceive, the Packet is a fragment" << std::endl);
 
  820               uint32_t fc = fragSubhdr.
GetFc ();
 
  826                   NS_LOG_INFO (
"\t Received the latest fragment" << std::endl);
 
  828                   ->FragmentEnqueue (packet);
 
  834                   NS_LOG_INFO (
"\t BS PACKET DEFRAGMENTATION" << std::endl);
 
  836                        iter != fragmentsQueue.end (); ++iter)
 
  842                   ->ClearFragmentsQueue ();
 
  853                   NS_LOG_INFO (
"\t Received the first or the middle fragment" << std::endl);
 
  855                   ->FragmentEnqueue (packet);
 
  866                      "A bandwidth request should be carried by a bandwidth header type");
 
  873       cid = bwRequestHdr.
GetCid ();
 
  885   bool sendDcd = 
false, sendUcd = 
false, updateDcd = 
false, updateUcd = 
false;
 
  887   uint16_t currentNrSsRegistered = 
m_ssManager->GetNRegisteredSSs ();
 
  891       m_uplinkScheduler->GetChannelDescriptorsToUpdate (updateDcd, updateUcd, sendDcd, sendUcd);
 
  895       sendDcd = sendUcd = 
true;
 
  963   std::pair<OfdmDlMapIe*, Ptr<PacketBurst> > pair;
 
  965   std::list<std::pair<OfdmDlMapIe*, Ptr<PacketBurst> > > *downlinkBursts = 
m_scheduler->GetDownlinkBursts ();
 
  970   while (downlinkBursts->size ())
 
  972       pair = downlinkBursts->front ();
 
  974       dlMapIe = pair.first;
 
  976       uint8_t diuc = dlMapIe->
GetDiuc ();
 
  995       txTime += 
GetPhy ()->GetTransmissionTime (burst->GetSize (), modulationType);
 
  996       downlinkBursts->pop_front ();
 
 1010   std::list<std::pair<OfdmDlMapIe*, Ptr<PacketBurst> > > *downlinkBursts = 
m_scheduler->GetDownlinkBursts ();
 
 1013        != downlinkBursts->end (); ++iter)
 
 1015       iter->first->SetPreamblePresent (0);
 
 1016       iter->first->SetStartTime (0);
 
 1075   std::list<OfdmUlMapIe> uplinkAllocations = 
m_uplinkScheduler->GetUplinkAllocations ();
 
 1077   for (std::list<OfdmUlMapIe>::iterator iter = uplinkAllocations.begin (); iter != uplinkAllocations.end (); ++iter)
 
 1167   NS_ASSERT_MSG (connection != 0, 
"BS: Invalid connection=0");
 
 1174   uint16_t symbolsToAllocation = 0;
 
 1175   std::list<OfdmUlMapIe> uplinkAllocations = 
m_uplinkScheduler->GetUplinkAllocations ();
 
 1176   for (std::list<OfdmUlMapIe>::iterator iter = uplinkAllocations.begin (); iter != uplinkAllocations.end (); ++iter)
 
 1185       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)
 
Simulation virtual time values and global simulation resolution. 
 
void SetUcdCount(uint8_t ucdCount)
 
Time GetIntervalT8(void) const 
 
void SetNrDlSymbols(uint32_t dlSymbols)
 
Introspection did not find any typical Config paths. 
 
Introspection did not find any typical Config paths. 
 
uint16_t GetRtg(void) const 
 
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system. 
 
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)
 
Introspection did not find any typical Config paths. 
 
void SetRangingBackoffEnd(uint8_t rangingBackoffEnd)
 
Introspection did not find any typical Config paths. 
 
void SetLinkManager(Ptr< BSLinkManager > linkManager)
 
void ForwardUp(Ptr< Packet > packet, const Mac48Address &source, const Mac48Address &dest)
 
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name. 
 
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit. 
 
Ptr< WimaxConnection > GetBroadcastConnection(void) const 
 
uint32_t GetSize(void) const 
Returns the the size in bytes of the packet (including the zero-filled initial payload). 
 
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 
 
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO. 
 
bool IsBroadcast(void) const 
 
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate. 
 
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 
 
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)
 
void SetStartTime(uint16_t startTime)
 
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source. 
 
uint16_t m_nrUlAllocations
 
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range. 
 
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 
Get an approximation of the time stored in this instance in the indicated unit. 
 
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. 
 
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
 
static EventId Schedule(Time const &delay, MEM mem_ptr, OBJ obj)
Schedule an event to expire after delay. 
 
uint16_t GetTtg(void) const 
 
void SetSbchnlFocContCodes(uint8_t sbchnlFocContCodes)
 
void SetCurrentDcd(Dcd dcd)
 
void SetRangReqOppSize(uint8_t rangReqOppSize)
 
AttributeValue implementation for 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)
 
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)
 
Introspection did not find any typical Config paths. 
 
~BaseStationNetDevice(void)
 
Mac48Address GetMacAddress(void) const 
 
Ptr< IpcsClassifier > m_bsClassifier
 
virtual void DoDispose(void)
Destructor implementation. 
 
Ptr< Packet > CreateDlMap(void)
 
void SetFrameNumber(uint32_t frameNumber)
 
Ptr< BsServiceFlowManager > GetServiceFlowManager(void) const 
 
uint8_t GetUiuc(void) const 
 
Ptr< Packet > Copy(void) const 
performs a COW copy of the packet. 
 
void SetChannelEncodings(OfdmDcdChannelEncodings channelEncodings)
 
uint8_t GetBwReqOppSize(void) const 
 
Hold together all Wimax-related objects in a NetDevice. 
 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
 
uint16_t GetDuration(void) const 
 
Hold objects of type Ptr. 
 
this class implements the bandwidth-request mac Header as described by IEEE Standard for Local and me...
 
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
 
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
 
static Time Now(void)
Return the current simulation virtual 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)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
 
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)
 
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)
Use NS_LOG to output a message of level LOG_DEBUG. 
 
Ptr< SSManager > GetSSManager(void) const 
 
void SetRequestBackoffEnd(uint8_t requestBackoffEnd)
 
Time Seconds(double value)
Construct a Time in the indicated unit. 
 
void CreateDefaultConnections(void)
Creates the initial ranging and broadcast connections. 
 
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)
 
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)
Destructor implementation. 
 
void MarkUplinkAllocations(void)
 
uint8_t GetHt(void) const 
 
void SetNrUlSymbols(uint32_t ulSymbols)
 
CidFactory * m_cidFactory
 
virtual void SetNode(Ptr< Node > node)
 
Introspection did not find any typical Config paths. 
 
bool IsPrimary(Cid cid) const 
 
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
 
void UplinkAllocationStart(void)
 
void AddUlMapElement(OfdmUlMapIe ulMapElement)
 
a unique identifier for an interface. 
 
TypeId SetParent(TypeId tid)
Set the parent TypeId. 
 
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)