23 #include "ns3/simulator.h" 
   24 #include "ns3/drop-tail-queue.h" 
   28 #include "ns3/packet-burst.h" 
   34 #include "ns3/trace-source-accessor.h" 
   35 #include "ns3/pointer.h" 
   61     TypeId (
"ns3::SubscriberStationNetDevice")
 
   64     .SetGroupName (
"Wimax")
 
   68     .AddAttribute (
"BasicConnection",
 
   72                    MakePointerChecker<WimaxConnection> ())
 
   74     .AddAttribute (
"PrimaryConnection",
 
   78                    MakePointerChecker<WimaxConnection> ())
 
   80     .AddAttribute (
"LostDlMapInterval",
 
   81                    "Time since last received DL-MAP message before downlink synchronization is considered lost. Maximum is 600ms",
 
   87     .AddAttribute (
"LostUlMapInterval",
 
   88                    "Time since last received UL-MAP before uplink synchronization is considered lost, maximum is 600.",
 
   94     .AddAttribute (
"MaxDcdInterval",
 
   95                    "Maximum time between transmission of DCD messages. Maximum is 10s",
 
  101     .AddAttribute (
"MaxUcdInterval",
 
  102                    "Maximum time between transmission of UCD messages. Maximum is 10s",
 
  108     .AddAttribute (
"IntervalT1",
 
  109                    "Wait for DCD timeout. Maximum is 5*maxDcdInterval",
 
  115     .AddAttribute (
"IntervalT2",
 
  116                    "Wait for broadcast ranging timeout, i.e., wait for initial ranging opportunity. Maximum is 5*Ranging interval",
 
  122     .AddAttribute (
"IntervalT3",
 
  123                    "ranging Response reception timeout following the transmission of a ranging request. Maximum is 200ms",
 
  129     .AddAttribute (
"IntervalT7",
 
  130                    "wait for DSA/DSC/DSD Response timeout. Maximum is 1s",
 
  136     .AddAttribute (
"IntervalT12",
 
  137                    "Wait for UCD descriptor.Maximum is 5*MaxUcdInterval",
 
  143     .AddAttribute (
"IntervalT20",
 
  144                    "Time the SS searches for preambles on a given channel. Minimum is 2 MAC frames",
 
  150     .AddAttribute (
"IntervalT21",
 
  151                    "time the SS searches for (decodable) DL-MAP on a given channel",
 
  157     .AddAttribute (
"MaxContentionRangingRetries",
 
  158                    "Number of retries on contention Ranging Requests",
 
  162                    MakeUintegerChecker<uint8_t> (1, 16))
 
  164     .AddAttribute (
"SSScheduler",
 
  165                    "The ss scheduler attached to this device.",
 
  169                    MakePointerChecker<SSScheduler> ())
 
  171     .AddAttribute (
"LinkManager",
 
  172                    "The ss link manager attached to this device.",
 
  176                    MakePointerChecker<SSLinkManager> ())
 
  178     .AddAttribute (
"Classifier",
 
  179                    "The ss classifier attached to this device.",
 
  183                    MakePointerChecker<IpcsClassifier> ())
 
  185     .AddTraceSource (
"SSTxDrop",
 
  186                      "A packet has been dropped in the MAC layer before being queued for transmission.",
 
  188                      "ns3::Packet::TracedCallback")
 
  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")
 
  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")
 
  202     .AddTraceSource (
"SSRxDrop",
 
  203                      "A packet has been dropped in the MAC layer after it has been passed up from the physical " 
  206                      "ns3::Packet::TracedCallback")
 
  562   GetPhy ()->SetPhyParameters ();
 
  563   GetPhy ()->SetDataRates ();
 
  592                                     uint16_t protocolNumber)
 
  609       NS_LOG_INFO (
"\tCan't send packet! (NotRegitered with the network)");
 
  613   NS_LOG_DEBUG (
"packet to send, size : " << packet->
GetSize () << 
", destination : " << dest);
 
  617       NS_LOG_INFO (
"\tCan't send packet! (No service Flow)");
 
  621   if (protocolNumber == 2048)
 
  626   if ((protocolNumber != 2048) || (serviceFlow == NULL))
 
  629       NS_LOG_INFO (
"\tNo service flows matches...using the default one.");
 
  632   NS_LOG_INFO (
"\tPacket classified in the service flow SFID =  " << serviceFlow->
GetSfid () << 
" CID = " 
  633                                                                   << serviceFlow->
GetCid ());
 
  649       NS_LOG_INFO (
"Error!! The Service Flow is not enabled" );
 
  662   NS_ASSERT_MSG (connection != 0, 
"SS: Can not enqueue the packet: the selected connection is nor initialized");
 
  669       hdr.
SetCid (connection->GetCid ());
 
  679                          "Error while equeuing  packet: incorrect header type");
 
  682           grantMgmntSubhdr.
SetPm (
true);
 
  686   NS_LOG_INFO (
"ServiceFlowManager: enqueuing packet" );
 
  687   return connection->Enqueue (packet, hdrType, hdr);
 
  708   if (burst->GetNPackets () == 0)
 
  728       NS_LOG_DEBUG (
" sending burst" << 
", SFID: " << connection->GetServiceFlow ()->GetSfid () << 
", pkts sent: " 
  747   uint32_t pktSize = packet->
GetSize ();
 
  750   bool fragmentation = 
false;  
 
  762       cid = gnrcMacHdr.
GetCid ();
 
  765       uint8_t type = gnrcMacHdr.
GetType ();
 
  769           uint8_t tmpType = type;
 
  770           if (((tmpType >> 2) & 1) == 1)
 
  773               fragmentation = 
true;
 
  774               NS_LOG_INFO (
"SS DoReceive -> the packet is a fragment" <<  std::endl);
 
  927                              "SS: Error while receiving a ranging response message: SS state should be SS_STATE_WAITING_RNG_RSP");
 
  946                              "SS: Error while receiving a ranging response message: SS state should be SS_STATE_WAITING_RNG_RSP");
 
 1002               NS_LOG_INFO ( 
"FRAG_DEBUG: SS DoReceive, the Packet is a fragment" << std::endl);
 
 1004               uint32_t fc = fragSubhdr.
GetFc ();
 
 1011                   NS_LOG_INFO ( 
"\t Received the latest fragment" << std::endl);
 
 1013                   ->FragmentEnqueue (packet);
 
 1016                     GetConnection (cid)->GetFragmentsQueue ();
 
 1021                   NS_LOG_INFO ( 
"\t SS PACKET DEFRAGMENTATION" << std::endl);
 
 1023                        iter != fragmentsQueue.end (); ++iter)
 
 1029                   ->ClearFragmentsQueue ();
 
 1039                   NS_LOG_INFO ( 
"\t Received the first or the middle fragment" << std::endl);
 
 1075   for (std::list<OfdmDlMapIe>::iterator iter = dlMapElements.begin (); iter != dlMapElements.end (); ++iter)
 
 1091       uint8_t temp = iter->GetDiuc ();
 
 1092       temp = iter->GetPreamblePresent ();
 
 1093       temp = iter->GetStartTime ();
 
 1107   for (std::list<OfdmUlMapIe>::iterator iter = ulMapElements.begin (); iter != ulMapElements.end (); ++iter)
 
 1127                                                                 * 
GetPhy ()->GetSymbolDuration ().GetSeconds ()));
 
 1135                              "SS: Error while processing UL MAP: SS state should be SS_STATE_WAITING_INV_RANG_INTRVL");
 
 1209   for (std::vector<OfdmDlBurstProfile>::iterator iter = dlBurstProfiles.begin (); iter != dlBurstProfiles.end (); ++iter)
 
 1244   for (std::vector<OfdmUlBurstProfile>::iterator iter = ulBurstProfiles.begin (); iter != ulBurstProfiles.end (); ++iter)
 
 1271     - timeAlreadyElapsed;
 
 1272   return timeToUlSubframe + defferTime;
 
void SendBandwidthRequest(uint8_t uiuc, uint16_t allocationSize)
 
uint8_t GetFecCodeType(void) const 
 
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer. 
 
OfdmDcdChannelEncodings GetChannelEncodings(void) const 
 
void SetIntervalT3(Time interval3)
 
Introspection did not find any typical Config paths. 
 
void SetTimer(EventId eventId, EventId &event)
 
Cid GetBasicCid(void) const 
 
Simulation virtual time values and global simulation resolution. 
 
bool GetIsEnabled(void) const 
 
void SetIntervalT1(Time interval1)
 
Time GetIntervalT2(void) const 
returns the wait for broadcast ranging timeout, i.e., wait for initial ranging opportunity ...
 
static Time GetDefaultLostDlMapInterval()
 
Introspection did not find any typical Config paths. 
 
void SetLostDlMapInterval(Time lostDlMapInterval)
 
void ProcessUcd(const Ucd &ucd)
 
Time GetMaxUcdInterval(void) const 
returns the maximum time between transmission of UCD messages 
 
void ProcessDcd(const Dcd &dcd)
 
void SetIntervalT21(Time interval21)
 
Ptr< WimaxConnection > m_basicConnection
 
Introspection did not find any typical Config paths. 
 
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system. 
 
Ptr< WimaxConnection > m_primaryConnection
 
uint8_t GetFrameDurationCode(void) const 
 
std::list< OfdmDlMapIe > GetDlMapElements(void) const 
 
Introspection did not find any typical Config paths. 
 
uint8_t GetConfigurationChangeCount(void) const 
 
bool HasServiceFlows(void) const 
 
this class implements a structure to manage some parameters and statistics related to a service flow ...
 
void SetIntervalT2(Time interval2)
 
void SetModulationType(WimaxPhy::ModulationType modulationType)
Set the most efficient modulation and coding scheme (MCS) supported by the device. 
 
bool GetAreManagementConnectionsAllocated(void) const 
 
uint32_t GetBytesRcvd(void) const 
 
void ProcessDlMap(const DlMap &dlmap)
 
bool IsMulticast(void) const 
 
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. 
 
void SetMaxDcdInterval(Time maxDcdInterval)
 
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit. 
 
Dcd GetCurrentDcd(void) const 
 
void SetAreManagementConnectionsAllocated(bool areManagementConnectionsAllocated)
 
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). 
 
Time GetIntervalT7(void) const 
returns the wait for DSA/DSC/DSD Response timeout 
 
void SetLostUlMapInterval(Time lostUlMapInterval)
 
uint32_t GetSfid(void) const 
 
uint8_t GetConfigurationChangeCount(void) const 
 
void StartScanning(SubscriberStationNetDevice::EventType type, bool deleteParameters)
 
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO. 
 
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate. 
 
Time GetLostUlMapInterval(void) const 
returns the time since last received UL-MAP before uplink synchronization is considered lost ...
 
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 SetScheduler(Ptr< SSScheduler > ssScheduler)
 
bool IsRunning(void) const 
This method is syntactic sugar for !IsExpired(). 
 
void SetMaxUcdInterval(Time maxUcdInterval)
 
Ptr< ConnectionManager > GetConnectionManager(void) const 
 
Time GetIntervalT12(void) const 
returns the wait for UCD descriptor timeout 
 
Ptr< IpcsClassifier > GetIpcsClassifier() const 
 
uint8_t GetType(void) const 
 
Mac48Address m_baseStationId
 
TracedCallback< Ptr< const Packet > > m_ssPromiscRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
 
uint8_t GetDcdCount(void) const 
 
Ptr< SSScheduler > m_scheduler
 
void ProcessUlMap(const UlMap &ulmap)
 
bool m_areServiceFlowsAllocated
 
~SubscriberStationNetDevice(void)
 
Ptr< WimaxConnection > GetConnection(void) const 
 
uint16_t GetRangReqOppSize(void) const 
 
void SetDiuc(uint8_t diuc)
 
bool IsRegistered(void) const 
 
Cid GetPrimaryCid(void) const 
 
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source. 
 
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range. 
 
Ptr< SSScheduler > GetScheduler(void) const 
 
void SetNrUlBurstProfiles(uint8_t nrUlBurstProfiles)
 
void DoReceive(Ptr< Packet > packet)
 
TracedCallback< Ptr< const Packet > > m_ssRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
 
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 SetNrDlBurstProfiles(uint8_t nrDlBurstProfiles)
 
void SendRangingRequest(uint8_t uiuc, uint16_t allocationSize)
 
SubscriberStationNetDevice(void)
 
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. 
 
void SetIntervalT20(Time interval20)
 
void SetMaxContentionRangingRetries(uint8_t maxContentionRangingRetries)
 
uint8_t m_maxContentionRangingRetries
 
void SetCurrentDcd(Dcd dcd)
 
AttributeValue implementation for Time. 
 
double m_allocationStartTime
 
void SetIntervalT12(Time interval12)
 
void SetFecCodeType(uint8_t fecCodeType)
 
bool DoSend(Ptr< Packet > packet, const Mac48Address &source, const Mac48Address &dest, uint16_t protocolNumber)
 
Hold an unsigned integer type. 
 
OfdmUcdChannelEncodings GetChannelEncodings(void) const 
 
bool Enqueue(Ptr< Packet > packet, const MacHeaderType &hdrType, Ptr< WimaxConnection > connection)
Enqueue a packet into a connection queue. 
 
void SetUiuc(uint8_t uiuc)
 
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 ...
 
Time GetTimeToAllocation(Time defferTime)
 
Introspection did not find any typical Config paths. 
 
uint8_t GetRangingBackoffStart(void) const 
 
Ptr< SsServiceFlowManager > m_serviceFlowManager
 
uint8_t GetFecCodeType(void) const 
 
std::list< OfdmUlMapIe > GetUlMapElements(void) const 
 
Ptr< WimaxConnection > GetInitialRangingConnection(void) const 
 
Ptr< BandwidthManager > GetBandwidthManager(void) const 
 
Ptr< SSLinkManager > GetLinkManager(void) const 
 
TracedCallback< Ptr< const Packet > > m_ssTxTrace
The trace source fired when packets come into the "top" of the device at the L3/L2 transition...
 
EventId m_ucdWaitTimeoutEvent
 
uint8_t GetUiuc(void) const 
 
Introspection did not find any typical Config paths. 
 
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. 
 
Mac48Address GetMacAddress(void) const 
 
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 UpdatePktsRcvd(uint32_t pktsRcvd)
update the number of received packets by adding pktsRcvd 
 
uint8_t GetUiuc(void) const 
 
uint16_t GetEirxPIrMax(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. 
 
uint16_t GetBsEirp(void) const 
 
static TypeId GetTypeId(void)
 
void DoDispose(void)
Destructor implementation. 
 
WimaxPhy::ModulationType GetModulationType(void) const 
returns the most efficient modulation and coding scheme (MCS) supported by the device ...
 
uint32_t GetPktsRcvd(void) const 
 
uint8_t GetUcdCount(void) const 
 
Ucd GetCurrentUcd(void) const 
 
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< SSLinkManager > m_linkManager
 
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...
 
TracedCallback< Ptr< const Packet >, Mac48Address, const Cid & > m_traceSSRx
 
static Time Now(void)
Return the current simulation virtual time. 
 
void SetPhy(Ptr< WimaxPhy > phy)
 
Mac48Address GetBaseStationId(void) const 
 
ServiceFlowRecord * GetRecord(void) const 
 
Ptr< WimaxConnection > GetBasicConnection(void) const 
 
void SetAreServiceFlowsAllocated(bool areServiceFlowsAllocated)
 
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
 
uint16_t m_nrDlMapElements
 
void NotifyPromiscTrace(Ptr< Packet > p)
 
Ptr< BurstProfileManager > GetBurstProfileManager(void) const 
 
Time GetIntervalT21(void) const 
returns the time the SS searches for (decodable) DL-MAP on a given channel 
 
EventId m_rangOppWaitTimeoutEvent
 
void SetLinkManager(Ptr< SSLinkManager >)
sets the link manager to be used 
 
bool m_areManagementConnectionsAllocated
 
An identifier for simulation events. 
 
std::vector< OfdmDlBurstProfile > GetDlBurstProfiles(void) const 
 
std::vector< OfdmUlBurstProfile > GetUlBurstProfiles(void) const 
 
void SetCurrentUcd(Ucd ucd)
 
Time GetIntervalT1(void) const 
returns the wait for DCD timeout 
 
Introspection did not find any typical Config paths. 
 
void ForwardDown(Ptr< PacketBurst > burst, WimaxPhy::ModulationType modulationType)
 
Ptr< WimaxPhy > GetPhy(void) const 
 
Time GetMaxDcdInterval(void) const 
returns the maximum time between transmission of DCD messages 
 
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG. 
 
Time Seconds(double value)
Construct a Time in the indicated unit. 
 
void SetIntervalT7(Time interval7)
 
void CreateDefaultConnections(void)
Creates the initial ranging and broadcast connections. 
 
uint32_t GetAllocationStartTime(void) const 
 
uint32_t GetBytesSent(void) const 
 
OfdmDlBurstProfile * m_dlBurstProfile
 
Time GetLostDlMapInterval(void) const 
 
Time GetIntervalT20(void) const 
returns the Time the SS searches for preambles on a given channel 
 
Time MicroSeconds(uint64_t value)
Construct a Time in the indicated unit. 
 
void SetState(uint8_t state)
 
void SetServiceFlowManager(Ptr< SsServiceFlowManager >)
Sets the service flow manager to be installed on the device. 
 
#define NS_LOG_ERROR(msg)
Use NS_LOG to output a message of level LOG_ERROR. 
 
uint8_t GetDiuc(void) const 
 
Ptr< IpcsClassifier > m_classifier
 
void InitSubscriberStationNetDevice(void)
initializes the net device and sets the parameters to the default values 
 
WimaxPhy::ModulationType m_modulationType
 
void UpdateBytesSent(uint32_t bytesSent)
update the number of sent bytes by adding bytesSent 
 
virtual void SetNode(Ptr< Node > node)
 
OfdmUlBurstProfile * m_ulBurstProfile
 
void SetIpcsPacketClassifier(Ptr< IpcsClassifier >)
Sets the packet classifier to be used. 
 
Ptr< SsServiceFlowManager > GetServiceFlowManager(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...
 
void AddServiceFlow(ServiceFlow *sf)
adds a new service flow 
 
a unique identifier for an interface. 
 
uint16_t m_nrUlMapElements
 
TypeId SetParent(TypeId tid)
Set the parent TypeId. 
 
void SetReceiveCallback(void)
 
static Time m_frameStartTime
 
uint16_t GetStartTime(void) const 
 
void SetPrimaryConnection(Ptr< WimaxConnection > primaryConnection)
 
uint8_t GetMaxContentionRangingRetries(void) const 
 
void AddHeader(const Header &header)
Add header to this packet. 
 
uint8_t GetState(void) const 
 
void SetFecCodeType(uint8_t fecCodeType)
 
Ptr< WimaxConnection > GetPrimaryConnection(void) const 
returns the primary connection currently usde 
 
HeaderType
this class implements the mac header type field. 
 
uint16_t GetCid(void) const 
 
bool GetAreServiceFlowsAllocated(void) const 
 
void UpdatePktsSent(uint32_t pktsSent)
update the number of sent packets by adding pktsSent 
 
EventId m_dcdWaitTimeoutEvent
 
Time GetIntervalT3(void) const 
returns the ranging Response reception timeout following the transmission of a ranging request ...
 
uint32_t GetPktsSent(void) const 
 
void UpdateBytesRcvd(uint32_t bytesRcvd)
update the number of received bytes by adding bytesRcvd