A Discrete-Event Network Simulator
API
bs-net-device.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007,2008, 2009 INRIA, UDcast
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Authors: Jahanzeb Farooq <jahanzeb.farooq@sophia.inria.fr>
18  * Mohamed Amine Ismail <amine.ismail@sophia.inria.fr>
19  */
20 
21 #ifndef WIMAX_BS_NET_DEVICE_H
22 #define WIMAX_BS_NET_DEVICE_H
23 
25 #include "dl-mac-messages.h"
26 #include "ipcs-classifier.h"
27 #include "wimax-connection.h"
28 #include "wimax-net-device.h"
29 
30 #include "ns3/event-id.h"
31 #include "ns3/ipv4-address.h"
32 #include "ns3/mac48-address.h"
33 #include "ns3/nstime.h"
34 
35 namespace ns3
36 {
37 
38 class Node;
39 class Packet;
40 class SSRecord;
41 class SSManager;
42 class BSScheduler;
43 class BurstProfileManager;
44 class BSLinkManager;
45 class UplinkScheduler;
46 class BsServiceFlowManager;
47 
54 {
55  public:
57  enum State
58  {
63  };
64 
67  {
70  };
71 
76  static TypeId GetTypeId();
95  Ptr<UplinkScheduler> uplinkScheduler,
96  Ptr<BSScheduler> bsScheduler);
97  ~BaseStationNetDevice() override;
101  void SetInitialRangingInterval(Time initialRangInterval);
113  void SetDcdInterval(Time dcdInterval);
117  Time GetDcdInterval() const;
121  void SetUcdInterval(Time ucdInterval);
125  Time GetUcdInterval() const;
129  void SetIntervalT8(Time interval);
133  Time GetIntervalT8() const;
137  void SetMaxRangingCorrectionRetries(uint8_t maxRangCorrectionRetries);
141  uint8_t GetMaxRangingCorrectionRetries() const;
145  void SetMaxInvitedRangRetries(uint8_t maxInvitedRangRetries);
149  uint8_t GetMaxInvitedRangRetries() const;
153  void SetRangReqOppSize(uint8_t rangReqOppSize);
157  uint8_t GetRangReqOppSize() const;
161  void SetBwReqOppSize(uint8_t bwReqOppSize);
165  uint8_t GetBwReqOppSize() const;
169  void SetNrDlSymbols(uint32_t dlSymbols);
173  uint32_t GetNrDlSymbols() const;
177  void SetNrUlSymbols(uint32_t ulSymbols);
181  uint32_t GetNrUlSymbols() const;
185  uint32_t GetNrDcdSent() const;
189  uint32_t GetNrUcdSent() const;
201  uint8_t GetRangingOppNumber() const;
209  void SetSSManager(Ptr<SSManager> ssManager);
217  void SetUplinkScheduler(Ptr<UplinkScheduler> ulScheduler);
225  void SetBSScheduler(Ptr<BSScheduler> bsSchedule);
233  void SetLinkManager(Ptr<BSLinkManager> linkManager);
241  void SetBsClassifier(Ptr<IpcsClassifier> classifier);
242 
246  Time GetPsDuration() const;
250  Time GetSymbolDuration() const;
254  void Start() override;
258  void Stop() override;
266  bool Enqueue(Ptr<Packet> packet,
267  const MacHeaderType& hdrType,
268  Ptr<WimaxConnection> connection) override;
274 
278  void MarkUplinkAllocations();
283  void MarkRangingOppStart(Time rangingOppStartTime);
293 
294  private:
295  void DoDispose() override;
299  void StartFrame();
303  void StartDlSubFrame();
307  void EndDlSubFrame();
311  void StartUlSubFrame();
315  void EndUlSubFrame();
319  void EndFrame();
328  bool DoSend(Ptr<Packet> packet,
329  const Mac48Address& source,
330  const Mac48Address& dest,
331  uint16_t protocolNumber) override;
336  void DoReceive(Ptr<Packet> packet) override;
340  void CreateMapMessages();
346  void CreateDescriptorMessages(bool sendDcd, bool sendUcd);
350  void SendBursts();
351 
376  void SetDlBurstProfiles(Dcd* dcd);
381  void SetUlBurstProfiles(Ucd* ucd);
382 
387  void MarkUplinkAllocationStart(Time allocationStartTime);
394  void MarkUplinkAllocationEnd(Time allocationEndTime, Cid cid, uint8_t uiuc);
398  void UplinkAllocationStart();
404  void UplinkAllocationEnd(Cid cid, uint8_t uiuc);
408  void RangingOppStart();
409 
410  // parameters defined in Table 342
415 
419  uint8_t m_bwReqOppSize;
420 
421  uint32_t m_nrDlSymbols;
422  uint32_t m_nrUlSymbols;
423 
424  // to keep track total number of a certain management messages sent by the BS
425  uint32_t m_nrDlMapSent;
426  uint32_t m_nrUlMapSent;
427  // number of DCDs and UCDs sent even if same
428  uint32_t m_nrDcdSent;
429  uint32_t m_nrUcdSent;
430 
433 
436 
437  // uint32_t m_nrFrames; //temporarily defined in wimax-net-device, as static
438  uint32_t m_nrDlFrames;
439  uint32_t m_nrUlFrames;
440 
441  // to keep track if number of SSs have changed since the last frame
442  uint16_t m_nrSsRegistered;
443 
444  uint16_t m_nrDlAllocations;
445  uint16_t m_nrUlAllocations;
446 
449 
452 
454 
456 
463  // same fields as in PHY, for quick access
466 
469 
477 
486 
496 
505 
513 };
514 
515 } // namespace ns3
516 
517 #endif /* WIMAX_BS_NET_DEVICE_H */
BaseStation NetDevice.
Definition: bs-net-device.h:54
uint32_t m_nrUlMapSent
number UL map sent
uint8_t GetBwReqOppSize() const
void SetDcdInterval(Time dcdInterval)
Ptr< BSScheduler > GetBSScheduler() const
TracedCallback< Ptr< const Packet >, Mac48Address, Cid > m_traceBSRx
the base station receive trace callback
MacPreamble
MacPreamble enumeration.
Definition: bs-net-device.h:67
Time m_dcdInterval
in seconds
void SetBsClassifier(Ptr< IpcsClassifier > classifier)
Ptr< UplinkScheduler > m_uplinkScheduler
the uplink scheduler
uint8_t m_bwReqOppSize
in symbols
void SetBwReqOppSize(uint8_t bwReqOppSize)
void SetUcdInterval(Time ucdInterval)
void SetRangReqOppSize(uint8_t rangReqOppSize)
void RangingOppStart()
Ranging opp start.
Time m_ulSubframeStartTime
UL subframe start time.
void SetDlBurstProfiles(Dcd *dcd)
Send DL burst profiles.
void UplinkAllocationStart()
Uplink allocation start.
uint32_t GetNrDlSymbols() const
Ptr< SSManager > m_ssManager
the SS manager
void Stop() override
Stop device.
Ptr< IpcsClassifier > GetBsClassifier() const
uint8_t GetRangReqOppSize() const
Ptr< Packet > CreateUcd()
Create UCD.
Time GetDlSubframeStartTime() const
uint8_t GetMaxRangingCorrectionRetries() const
CidFactory * m_cidFactory
the CID factory
uint32_t m_framesSinceLastDcd
frames since last DCD
uint32_t m_ucdConfigChangeCount
UCD config change count.
uint8_t m_rangingOppNumber
current ranging TO number
uint32_t m_allocationStartTime
allocation start time
void SetNrDlSymbols(uint32_t dlSymbols)
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 ...
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 MarkRangingOppStart(Time rangingOppStartTime)
Mark ranging opp start.
void SetMaxRangingCorrectionRetries(uint8_t maxRangCorrectionRetries)
uint32_t m_nrDlSymbols
number of DL symbols
uint32_t GetNrUcdSent() const
uint32_t m_nrUlSymbols
number of UL symbols
Ptr< WimaxConnection > GetConnection(Cid cid)
uint8_t m_maxRangCorrectionRetries
maximum range correction retries
void MarkUplinkAllocationStart(Time allocationStartTime)
Mark uplink allocation start.
uint32_t m_nrDlFrames
number DL frames
void SetBSScheduler(Ptr< BSScheduler > bsSchedule)
static TypeId GetTypeId()
Get the type ID.
void Start() override
Start device.
uint16_t m_nrUlAllocations
number UL allocations
uint32_t m_nrDcdSent
number DCD sent
void StartFrame()
Start frame function.
Ptr< IpcsClassifier > m_bsClassifier
the base station classifier
void SetIntervalT8(Time interval)
Ptr< Packet > CreateUlMap()
Create UL map.
State
State enumeration.
Definition: bs-net-device.h:58
void EndFrame()
End frame function.
void DoDispose() override
Destructor implementation.
Ptr< BsServiceFlowManager > m_serviceFlowManager
the service flow manager
void SetInitialRangingInterval(Time initialRangInterval)
uint16_t m_nrSsRegistered
number SS registered
Time m_psDuration
ps duration
uint8_t m_maxInvitedRangRetries
maximum invited range retries
uint8_t m_ulAllocationNumber
to see UL burst number
Time GetInitialRangingInterval() const
void MarkUplinkAllocationEnd(Time allocationEndTime, Cid cid, uint8_t uiuc)
Mark uplink allocation end.
void SetNrUlSymbols(uint32_t ulSymbols)
void SetSSManager(Ptr< SSManager > ssManager)
void StartDlSubFrame()
Start DL subframe function.
Ptr< SSManager > GetSSManager() const
Time m_ucdInterval
in seconds
Ptr< Packet > CreateDlMap()
Create DL map.
void SetLinkManager(Ptr< BSLinkManager > linkManager)
void SetMaxInvitedRangRetries(uint8_t maxInvitedRangRetries)
Time m_symbolDuration
symbol duration
Time m_initialRangInterval
in seconds
void CreateDescriptorMessages(bool sendDcd, bool sendUcd)
creates the channel descriptor MAC management messages DCD and UCD
void SetUplinkScheduler(Ptr< UplinkScheduler > ulScheduler)
void UplinkAllocationEnd(Cid cid, uint8_t uiuc)
Uplink allocation end.
uint32_t m_nrUcdSent
number UCD sent
void StartUlSubFrame()
Start UL subframe function.
uint32_t m_nrUlFrames
number UL frames
void EndUlSubFrame()
End UL subframe function.
uint32_t GetNrUlSymbols() const
uint32_t m_dcdConfigChangeCount
DCD config change count.
uint32_t m_framesSinceLastUcd
frames since last UCD
void InitBaseStationNetDevice()
initializes the BS net device and sets its parameters to the default values
uint8_t m_rangReqOppSize
in symbols
Ptr< BSLinkManager > GetLinkManager() const
void CreateMapMessages()
creates the MAC management messages DL-MAP and UL-MAP
uint8_t GetMaxInvitedRangRetries() const
void DoReceive(Ptr< Packet > packet) override
Receive packet.
bool Enqueue(Ptr< Packet > packet, const MacHeaderType &hdrType, Ptr< WimaxConnection > connection) override
Enqueue a packet into a connection queue.
void SetServiceFlowManager(Ptr< BsServiceFlowManager > sfm)
Set service flow manager.
Ptr< Packet > CreateDcd()
Create DCD.
Ptr< BSScheduler > m_scheduler
the base station scheduler
Time m_intervalT8
in milliseconds, wait for DSA/DSC Acknowledge timeout
bool DoSend(Ptr< Packet > packet, const Mac48Address &source, const Mac48Address &dest, uint16_t protocolNumber) override
Send packet.
void SendBursts()
Send burst function.
uint32_t m_nrDlMapSent
number DL map sent
Ptr< UplinkScheduler > GetUplinkScheduler() const
Time m_dlSubframeStartTime
DL subframe start time.
Time GetUlSubframeStartTime() const
uint16_t m_nrDlAllocations
number DL allocations
void EndDlSubFrame()
End DL subframe function.
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< BsServiceFlowManager > GetServiceFlowManager() const
Ptr< BSLinkManager > m_linkManager
the link manager
TracedCallback< Ptr< const Packet > > m_bsPromiscRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
uint8_t GetRangingOppNumber() const
void MarkUplinkAllocations()
Mark uplink allocations.
void SetUlBurstProfiles(Ucd *ucd)
Send UL burst profiles.
TracedCallback< Ptr< const Packet > > m_bsRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
uint32_t GetNrDcdSent() const
This class is used exclusively by the BS to allocate CIDs to new connections.
Definition: cid-factory.h:46
Cid class.
Definition: cid.h:37
This class implements Downlink channel descriptor as described by "IEEE Standard for Local and metrop...
an EUI-48 address
Definition: mac48-address.h:46
This class Represents the HT (Header Type) field of generic MAC and bandwidth request headers.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition: type-id.h:59
This class implements the UCD message as described by "IEEE Standard for Local and metropolitan area ...
Hold together all WiMAX-related objects in a NetDevice.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
phy
Definition: third.py:89