A Discrete-Event Network Simulator
API
bs-net-device.h
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
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
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  */
21 
22 #ifndef WIMAX_BS_NET_DEVICE_H
23 #define WIMAX_BS_NET_DEVICE_H
24 
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"
34 
35 namespace ns3 {
36 
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;
46 
53 {
54 public:
56  enum State
57  {
62  };
63 
66  {
69  };
70 
75  static TypeId GetTypeId (void);
76  BaseStationNetDevice (void);
94  Ptr<UplinkScheduler> uplinkScheduler,
95  Ptr<BSScheduler> bsScheduler);
96  ~BaseStationNetDevice (void);
100  void SetInitialRangingInterval (Time initialRangInterval);
104  void InitBaseStationNetDevice (void);
108  Time GetInitialRangingInterval (void) const;
112  void SetDcdInterval (Time dcdInterval);
116  Time GetDcdInterval (void) const;
120  void SetUcdInterval (Time ucdInterval);
124  Time GetUcdInterval (void) const;
128  void SetIntervalT8 (Time interval);
132  Time GetIntervalT8 (void) const;
136  void SetMaxRangingCorrectionRetries (uint8_t maxRangCorrectionRetries);
140  uint8_t GetMaxRangingCorrectionRetries (void) const;
144  void SetMaxInvitedRangRetries (uint8_t maxInvitedRangRetries);
148  uint8_t GetMaxInvitedRangRetries (void) const;
152  void SetRangReqOppSize (uint8_t rangReqOppSize);
156  uint8_t GetRangReqOppSize (void) const;
160  void SetBwReqOppSize (uint8_t bwReqOppSize);
164  uint8_t GetBwReqOppSize (void) const;
168  void SetNrDlSymbols (uint32_t dlSymbols);
172  uint32_t GetNrDlSymbols (void) const;
176  void SetNrUlSymbols (uint32_t ulSymbols);
180  uint32_t GetNrUlSymbols (void) const;
184  uint32_t GetNrDcdSent (void) const;
188  uint32_t GetNrUcdSent (void) const;
192  Time GetDlSubframeStartTime (void) const;
196  Time GetUlSubframeStartTime (void) const;
200  uint8_t GetRangingOppNumber (void) const;
204  Ptr<SSManager> GetSSManager (void) const;
208  void SetSSManager (Ptr<SSManager> ssManager);
216  void SetUplinkScheduler (Ptr<UplinkScheduler> ulScheduler);
220  Ptr<BSLinkManager> GetLinkManager (void) const;
224  void SetBSScheduler (Ptr<BSScheduler> bsSchedule);
228  Ptr<BSScheduler> GetBSScheduler (void) const;
232  void SetLinkManager (Ptr<BSLinkManager> linkManager);
240  void SetBsClassifier (Ptr<IpcsClassifier> classifier);
241 
245  Time GetPsDuration (void) const;
249  Time GetSymbolDuration (void) const;
253  void Start (void);
257  void Stop (void);
265  bool Enqueue (Ptr<Packet> packet, const MacHeaderType &hdrType, Ptr<WimaxConnection> connection);
271 
275  void MarkUplinkAllocations (void);
280  void MarkRangingOppStart (Time rangingOppStartTime);
290 private:
291  virtual void DoDispose (void);
295  void StartFrame (void);
299  void StartDlSubFrame (void);
303  void EndDlSubFrame (void);
307  void StartUlSubFrame (void);
311  void EndUlSubFrame (void);
315  void EndFrame (void);
324  bool DoSend (Ptr<Packet> packet, const Mac48Address& source, const Mac48Address& dest, uint16_t protocolNumber);
329  void DoReceive (Ptr<Packet> packet);
333  void CreateMapMessages (void);
339  void CreateDescriptorMessages (bool sendDcd, bool sendUcd);
343  void SendBursts (void);
344 
349  Ptr<Packet> CreateDlMap (void);
354  Ptr<Packet> CreateDcd (void);
359  Ptr<Packet> CreateUlMap (void);
364  Ptr<Packet> CreateUcd (void);
369  void SetDlBurstProfiles (Dcd *dcd);
374  void SetUlBurstProfiles (Ucd *ucd);
375 
380  void MarkUplinkAllocationStart (Time allocationStartTime);
387  void MarkUplinkAllocationEnd (Time allocationEndTime, Cid cid, uint8_t uiuc);
391  void UplinkAllocationStart (void);
397  void UplinkAllocationEnd (Cid cid, uint8_t uiuc);
401  void RangingOppStart (void);
402 
403  // parameters defined in Table 342
408 
412  uint8_t m_bwReqOppSize;
413 
414  uint32_t m_nrDlSymbols;
415  uint32_t m_nrUlSymbols;
416 
417  // to keep track total number of a certain management messages sent by the BS
418  uint32_t m_nrDlMapSent;
419  uint32_t m_nrUlMapSent;
420  // number of DCDs and UCDs sent even if same
421  uint32_t m_nrDcdSent;
422  uint32_t m_nrUcdSent;
423 
426 
429 
430  // uint32_t m_nrFrames; //temporarily defined in wimax-net-device, as static
431  uint32_t m_nrDlFrames;
432  uint32_t m_nrUlFrames;
433 
434  // to keep track if number of SSs have changed since the last frame
435  uint16_t m_nrSsRegistered;
436 
437  uint16_t m_nrDlAllocations;
438  uint16_t m_nrUlAllocations;
439 
442 
445 
447 
449 
456  // same fields as in PHY, for quick access
459 
461 
469 
477 
486 
495 
503 };
504 
505 } // namespace ns3
506 
507 #endif /* WIMAX_BS_NET_DEVICE_H */
BaseStation NetDevice.
Definition: bs-net-device.h:53
uint32_t m_nrUlMapSent
number UL map sent
uint8_t GetRangingOppNumber(void) const
void SetDcdInterval(Time dcdInterval)
void DoReceive(Ptr< Packet > packet)
Receive packet.
void Stop(void)
Stop device.
void EndDlSubFrame(void)
End DL subframe function.
virtual void DoDispose(void)
Destructor implementation.
TracedCallback< Ptr< const Packet >, Mac48Address, Cid > m_traceBSRx
the base station receive trace callback
MacPreamble
MacPreamble enumeration.
Definition: bs-net-device.h:66
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)
Ptr< BSScheduler > GetBSScheduler(void) const
Time m_ulSubframeStartTime
UL subframe start time.
void SetDlBurstProfiles(Dcd *dcd)
Send DL burst profiles.
void MarkUplinkAllocations(void)
Mark uplink allocations.
Ptr< SSManager > m_ssManager
the SS manager
void InitBaseStationNetDevice(void)
initializes the BS net device and sets its parameters to the default values
void StartDlSubFrame(void)
Start DL subframe function.
Time GetPsDuration(void) const
Ptr< UplinkScheduler > GetUplinkScheduler(void) const
uint8_t GetMaxInvitedRangRetries(void) const
bool DoSend(Ptr< Packet > packet, const Mac48Address &source, const Mac48Address &dest, uint16_t protocolNumber)
Send packet.
bool Enqueue(Ptr< Packet > packet, const MacHeaderType &hdrType, Ptr< WimaxConnection > connection)
Enqueue a packet into a connection queue.
CidFactory * m_cidFactory
the CID factory
uint32_t m_framesSinceLastDcd
frames since last DCD
uint32_t m_ucdConfigChangeCount
UCD config change count.
Ptr< Packet > CreateDcd(void)
Create DCD.
Time GetDcdInterval(void) const
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 RangingOppStart(void)
Ranging opp start.
void SetMaxRangingCorrectionRetries(uint8_t maxRangCorrectionRetries)
uint32_t m_nrDlSymbols
number of DL symbols
uint32_t m_nrUlSymbols
number of UL symbols
Ptr< WimaxConnection > GetConnection(Cid cid)
void CreateMapMessages(void)
creates the MAC management messages DL-MAP and UL-MAP
void StartFrame(void)
Start frame function.
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)
Ptr< BSLinkManager > GetLinkManager(void) const
void Start(void)
Start device.
uint16_t m_nrUlAllocations
number UL allocations
uint32_t m_nrDcdSent
number DCD sent
Ptr< IpcsClassifier > m_bsClassifier
the base station classifier
void SetIntervalT8(Time interval)
State
State enumeration.
Definition: bs-net-device.h:57
Ptr< Packet > CreateUlMap(void)
Create UL map.
Time GetInitialRangingInterval(void) const
Ptr< BsServiceFlowManager > m_serviceFlowManager
the service flow manager
void SetInitialRangingInterval(Time initialRangInterval)
uint16_t m_nrSsRegistered
number SS registered
Ptr< IpcsClassifier > GetBsClassifier(void) const
Time m_psDuration
ps duration
uint32_t GetNrUlSymbols(void) const
uint8_t m_maxInvitedRangRetries
maximum invited range retries
uint8_t m_ulAllocationNumber
to see UL burst number
void MarkUplinkAllocationEnd(Time allocationEndTime, Cid cid, uint8_t uiuc)
Mark uplink allocation end.
void SetNrUlSymbols(uint32_t ulSymbols)
Ptr< BsServiceFlowManager > GetServiceFlowManager(void) const
void SetSSManager(Ptr< SSManager > ssManager)
Time m_ucdInterval
in seconds
void SetLinkManager(Ptr< BSLinkManager > linkManager)
void SetMaxInvitedRangRetries(uint8_t maxInvitedRangRetries)
Time m_symbolDuration
symbol duration
uint32_t GetNrDlSymbols(void) const
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)
Time GetUcdInterval(void) const
Time GetIntervalT8(void) const
void UplinkAllocationEnd(Cid cid, uint8_t uiuc)
Uplink allocation end.
uint32_t m_nrUcdSent
number UCD sent
Ptr< Packet > CreateDlMap(void)
Create DL map.
uint32_t GetNrDcdSent(void) const
uint32_t m_nrUlFrames
number UL frames
void EndFrame(void)
End frame function.
uint32_t m_dcdConfigChangeCount
DCD config change count.
Ptr< Packet > CreateUcd(void)
Create UCD.
uint32_t m_framesSinceLastUcd
frames since last UCD
Time GetDlSubframeStartTime(void) const
uint8_t m_rangReqOppSize
in symbols
Time GetSymbolDuration(void) const
uint32_t GetNrUcdSent(void) const
void EndUlSubFrame(void)
End UL subframe function.
void SetServiceFlowManager(Ptr< BsServiceFlowManager > sfm)
Set service flow manager.
Time GetUlSubframeStartTime(void) const
void StartUlSubFrame(void)
Start UL subframe function.
void UplinkAllocationStart(void)
Uplink allocation start.
uint8_t GetRangReqOppSize(void) const
Ptr< BSScheduler > m_scheduler
the base station scheduler
Time m_intervalT8
in milliseconds, wait for DSA/DSC Acknowledge timeout
uint32_t m_nrDlMapSent
number DL map sent
Time m_dlSubframeStartTime
DL subframe start time.
uint16_t m_nrDlAllocations
number DL allocations
uint8_t GetMaxRangingCorrectionRetries(void) const
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< 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...
static TypeId GetTypeId(void)
Get the type ID.
uint8_t GetBwReqOppSize(void) const
Ptr< SSManager > GetSSManager(void) const
void SetUlBurstProfiles(Ucd *ucd)
Send UL burst profiles.
void SendBursts(void)
Send burst function.
TracedCallback< Ptr< const Packet > > m_bsRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
This class is used exclusively by the BS to allocate CIDs to new connections.
Definition: cid-factory.h:46
Cid class.
Definition: cid.h:38
This class implements Downlink channel descriptor as described by "IEEE Standard for Local and metrop...
an EUI-48 address
Definition: mac48-address.h:44
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:103
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:93