A Discrete-Event Network Simulator
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
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  */
25 #include "wimax-net-device.h"
26 #include "ns3/event-id.h"
27 #include "wimax-connection.h"
28 #include "ns3/nstime.h"
29 #include "ns3/mac48-address.h"
30 #include "ns3/ipv4-address.h"
31 #include "ns3/bs-service-flow-manager.h"
32 #include "dl-mac-messages.h"
33 #include "ipcs-classifier.h"
35 namespace ns3 {
37 class Node;
38 class Packet;
39 class SSRecord;
40 class SSManager;
41 class BSScheduler;
42 class BurstProfileManager;
43 class BSLinkManager;
44 class UplinkScheduler;
45 class BsServiceFlowManager;
51 {
52 public:
54  enum State
55  {
60  };
64  {
67  };
73  static TypeId GetTypeId (void);
74  BaseStationNetDevice (void);
92  Ptr<UplinkScheduler> uplinkScheduler,
93  Ptr<BSScheduler> bsScheduler);
94  ~BaseStationNetDevice (void);
98  void SetInitialRangingInterval (Time initialRangInterval);
102  void InitBaseStationNetDevice (void);
106  Time GetInitialRangingInterval (void) const;
110  void SetDcdInterval (Time dcdInterval);
114  Time GetDcdInterval (void) const;
118  void SetUcdInterval (Time ucdInterval);
122  Time GetUcdInterval (void) const;
126  void SetIntervalT8 (Time interval);
130  Time GetIntervalT8 (void) const;
134  void SetMaxRangingCorrectionRetries (uint8_t maxRangCorrectionRetries);
138  uint8_t GetMaxRangingCorrectionRetries (void) const;
142  void SetMaxInvitedRangRetries (uint8_t maxInvitedRangRetries);
146  uint8_t GetMaxInvitedRangRetries (void) const;
150  void SetRangReqOppSize (uint8_t rangReqOppSize);
154  uint8_t GetRangReqOppSize (void) const;
158  void SetBwReqOppSize (uint8_t bwReqOppSize);
162  uint8_t GetBwReqOppSize (void) const;
166  void SetNrDlSymbols (uint32_t dlSymbols);
170  uint32_t GetNrDlSymbols (void) const;
174  void SetNrUlSymbols (uint32_t ulSymbols);
178  uint32_t GetNrUlSymbols (void) const;
182  uint32_t GetNrDcdSent (void) const;
186  uint32_t GetNrUcdSent (void) const;
190  Time GetDlSubframeStartTime (void) const;
194  Time GetUlSubframeStartTime (void) const;
198  uint8_t GetRangingOppNumber (void) const;
202  Ptr<SSManager> GetSSManager (void) const;
206  void SetSSManager (Ptr<SSManager> ssManager);
214  void SetUplinkScheduler (Ptr<UplinkScheduler> ulScheduler);
218  Ptr<BSLinkManager> GetLinkManager (void) const;
222  void SetBSScheduler (Ptr<BSScheduler> bsSchedule);
226  Ptr<BSScheduler> GetBSScheduler (void) const;
230  void SetLinkManager (Ptr<BSLinkManager> linkManager);
238  void SetBsClassifier (Ptr<IpcsClassifier> classifier);
243  Time GetPsDuration (void) const;
247  Time GetSymbolDuration (void) const;
251  void Start (void);
255  void Stop (void);
263  bool Enqueue (Ptr<Packet> packet, const MacHeaderType &hdrType, Ptr<WimaxConnection> connection);
273  void MarkUplinkAllocations (void);
278  void MarkRangingOppStart (Time rangingOppStartTime);
288 private:
289  virtual void DoDispose (void);
293  void StartFrame (void);
297  void StartDlSubFrame (void);
301  void EndDlSubFrame (void);
305  void StartUlSubFrame (void);
309  void EndUlSubFrame (void);
313  void EndFrame (void);
322  bool DoSend (Ptr<Packet> packet, const Mac48Address& source, const Mac48Address& dest, uint16_t protocolNumber);
327  void DoReceive (Ptr<Packet> packet);
331  void CreateMapMessages (void);
337  void CreateDescriptorMessages (bool sendDcd, bool sendUcd);
341  void SendBursts (void);
347  Ptr<Packet> CreateDlMap (void);
352  Ptr<Packet> CreateDcd (void);
357  Ptr<Packet> CreateUlMap (void);
362  Ptr<Packet> CreateUcd (void);
367  void SetDlBurstProfiles (Dcd *dcd);
372  void SetUlBurstProfiles (Ucd *ucd);
378  void MarkUplinkAllocationStart (Time allocationStartTime);
385  void MarkUplinkAllocationEnd (Time allocationEndTime, Cid cid, uint8_t uiuc);
389  void UplinkAllocationStart (void);
395  void UplinkAllocationEnd (Cid cid, uint8_t uiuc);
399  void RangingOppStart (void);
401  // parameters defined in Table 342
410  uint8_t m_bwReqOppSize;
412  uint32_t m_nrDlSymbols;
413  uint32_t m_nrUlSymbols;
415  // to keep track total number of a certain management messages sent by the BS
416  uint32_t m_nrDlMapSent;
417  uint32_t m_nrUlMapSent;
418  // number of DCDs and UCDs sent even if same
419  uint32_t m_nrDcdSent;
420  uint32_t m_nrUcdSent;
428  // uint32_t m_nrFrames; //temporarily defined in wimax-net-device, as static
429  uint32_t m_nrDlFrames;
430  uint32_t m_nrUlFrames;
432  // to keep track if number of SSs have changed since the last frame
433  uint16_t m_nrSsRegistered;
435  uint16_t m_nrDlAllocations;
436  uint16_t m_nrUlAllocations;
454  // same fields as in PHY, for quick access
501 };
503 } // namespace ns3
505 #endif /* WIMAX_BS_NET_DEVICE_H */
void SetUcdInterval(Time ucdInterval)
uint8_t m_rangReqOppSize
in symbols
void RangingOppStart(void)
Ranging opp start.
uint8_t m_rangingOppNumber
current ranging TO number
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
void SetNrDlSymbols(uint32_t dlSymbols)
Time GetInitialRangingInterval(void) const
void StartDlSubFrame(void)
Start DL subframe function.
uint16_t m_nrSsRegistered
number SS registered
void MarkRangingOppStart(Time rangingOppStartTime)
Mark ranging opp start.
Time GetUcdInterval(void) const
void EndUlSubFrame(void)
End UL subframe function.
Time GetDlSubframeStartTime(void) const
Forward calls to a chain of Callback.
Ptr< BSLinkManager > GetLinkManager(void) const
void SetLinkManager(Ptr< BSLinkManager > linkManager)
void CreateDescriptorMessages(bool sendDcd, bool sendUcd)
creates the channel descriptor MAC management messages DCD and UCD
TracedCallback< Ptr< const Packet > > m_bsRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
uint8_t GetMaxInvitedRangRetries(void) const
Time m_initialRangInterval
in seconds
void SetBSScheduler(Ptr< BSScheduler > bsSchedule)
Ptr< SSManager > GetSSManager(void) const
void EndFrame(void)
End frame function.
Ptr< Packet > CreateUcd(void)
Create UCD.
void SetMaxInvitedRangRetries(uint8_t maxInvitedRangRetries)
void SetIntervalT8(Time interval)
void SetBsClassifier(Ptr< IpcsClassifier > classifier)
void UplinkAllocationEnd(Cid cid, uint8_t uiuc)
Uplink allocation end.
uint8_t GetRangingOppNumber(void) const
Ptr< BsServiceFlowManager > GetServiceFlowManager(void) const
Time GetUlSubframeStartTime(void) const
Definition: third.py:93
uint16_t m_nrUlAllocations
number UL allocations
uint32_t m_nrUlFrames
number UL frames
Ptr< Packet > CreateUlMap(void)
Create UL map.
uint32_t m_framesSinceLastDcd
frames since last DCD
void MarkUplinkAllocationStart(Time allocationStartTime)
Mark uplink allocation start.
TracedCallback< Ptr< const Packet > > m_bsRxDropTrace
The trace source fired when packets coming into the "top" of the device are dropped at the MAC layer ...
bool Enqueue(Ptr< Packet > packet, const MacHeaderType &hdrType, Ptr< WimaxConnection > connection)
Enqueue a packet into a connection queue.
uint8_t m_bwReqOppSize
in symbols
uint32_t m_nrDlMapSent
number DL map sent
void Stop(void)
Stop device.
void SetRangReqOppSize(uint8_t rangReqOppSize)
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 ...
This class implements the UCD message as described by "IEEE Standard for Local and metropolitan area ...
static TypeId GetTypeId(void)
Get the type ID.
uint32_t m_nrDlSymbols
number of DL symbols
uint16_t m_nrDlAllocations
number DL allocations
void SetInitialRangingInterval(Time initialRangInterval)
uint32_t m_nrDlFrames
number DL frames
uint32_t m_allocationStartTime
allocation start time
Ptr< UplinkScheduler > GetUplinkScheduler(void) const
Time GetPsDuration(void) const
Time GetSymbolDuration(void) const
Ptr< BSLinkManager > m_linkManager
the link manager
This class implements Downlink channel descriptor as described by "IEEE Standard for Local and metrop...
This class Represents the HT (Header Type) field of generic MAC and bandwidth request headers...
Ptr< IpcsClassifier > m_bsClassifier
the base station classifier
void SetServiceFlowManager(Ptr< BsServiceFlowManager > sfm)
Set service flow manager.
Ptr< Packet > CreateDlMap(void)
Create DL map.
void SendBursts(void)
Send burst function.
Time m_symbolDuration
symbol duration
Hold together all WiMAX-related objects in a NetDevice.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void EndDlSubFrame(void)
End DL subframe function.
TracedCallback< Ptr< const Packet >, Mac48Address, Cid > m_traceBSRx
the base station receive trace callback
Cid class.
Definition: cid.h:37
an EUI-48 address
Definition: mac48-address.h:43
Ptr< BSScheduler > m_scheduler
the base station scheduler
MacPreamble enumeration.
Definition: bs-net-device.h:63
Time m_intervalT8
in milliseconds, wait for DSA/DSC Acknowledge timeout
uint32_t GetNrDcdSent(void) const
Time m_ucdInterval
in seconds
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...
uint32_t m_nrUcdSent
number UCD sent
void CreateMapMessages(void)
creates the MAC management messages DL-MAP and UL-MAP
bool DoSend(Ptr< Packet > packet, const Mac48Address &source, const Mac48Address &dest, uint16_t protocolNumber)
Send packet.
TracedCallback< Ptr< const Packet > > m_bsTxTrace
The trace source fired when packets come into the "top" of the device at the L3/L2 transition...
Ptr< SSManager > m_ssManager
the SS manager
Time GetIntervalT8(void) const
void SetUplinkScheduler(Ptr< UplinkScheduler > ulScheduler)
void DoReceive(Ptr< Packet > packet)
Receive packet.
void StartUlSubFrame(void)
Start UL subframe function.
Time m_psDuration
ps duration
Time GetDcdInterval(void) const
void SetDlBurstProfiles(Dcd *dcd)
Send DL burst profiles.
Ptr< IpcsClassifier > GetBsClassifier(void) const
Time m_dcdInterval
in seconds
void Start(void)
Start device.
void SetMaxRangingCorrectionRetries(uint8_t maxRangCorrectionRetries)
uint32_t m_dcdConfigChangeCount
DCD config change count.
uint32_t GetNrDlSymbols(void) const
uint8_t m_maxRangCorrectionRetries
maximum range correction retries
uint32_t m_nrUlMapSent
number UL map sent
uint8_t m_ulAllocationNumber
to see UL burst number
Time m_dlSubframeStartTime
DL subframe start time.
void SetBwReqOppSize(uint8_t bwReqOppSize)
Ptr< BSScheduler > GetBSScheduler(void) const
void StartFrame(void)
Start frame function.
uint32_t m_framesSinceLastUcd
frames since last UCD
void MarkUplinkAllocationEnd(Time allocationEndTime, Cid cid, uint8_t uiuc)
Mark uplink allocation end.
Ptr< BsServiceFlowManager > m_serviceFlowManager
the service flow manager
Time m_ulSubframeStartTime
UL subframe start time.
Ptr< UplinkScheduler > m_uplinkScheduler
the uplink scheduler
void SetUlBurstProfiles(Ucd *ucd)
Send UL burst profiles.
uint32_t GetNrUcdSent(void) const
Ptr< WimaxConnection > GetConnection(Cid cid)
uint32_t GetNrUlSymbols(void) const
uint8_t GetMaxRangingCorrectionRetries(void) const
void SetSSManager(Ptr< SSManager > ssManager)
uint32_t m_nrDcdSent
number DCD sent
State enumeration.
Definition: bs-net-device.h:54
uint32_t m_ucdConfigChangeCount
UCD config change count.
void InitBaseStationNetDevice(void)
initializes the BS net device and sets its parameters to the default values
This class is used exclusively by the BS to allocate CIDs to new connections.
Definition: cid-factory.h:45
virtual void DoDispose(void)
Destructor implementation.
void MarkUplinkAllocations(void)
Mark uplink allocations.
CidFactory * m_cidFactory
the CID factory
void SetNrUlSymbols(uint32_t ulSymbols)
uint32_t m_nrUlSymbols
number of UL symbols
uint8_t GetRangReqOppSize(void) const
void UplinkAllocationStart(void)
Uplink allocation start.
a unique identifier for an interface.
Definition: type-id.h:58
uint8_t m_maxInvitedRangRetries
maximum invited range retries
uint8_t GetBwReqOppSize(void) const
Ptr< Packet > CreateDcd(void)
Create DCD.