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 
51 {
52 public:
53  enum State
54  {
56  };
57 
59  {
61  };
62 
63  static TypeId GetTypeId (void);
64  BaseStationNetDevice (void);
68  Ptr<UplinkScheduler> uplinkScheduler,
69  Ptr<BSScheduler> bsScheduler);
70  ~BaseStationNetDevice (void);
74  void SetInitialRangingInterval (Time initialRangInterval);
78  void InitBaseStationNetDevice (void);
82  Time GetInitialRangingInterval (void) const;
86  void SetDcdInterval (Time dcdInterval);
90  Time GetDcdInterval (void) const;
94  void SetUcdInterval (Time ucdInterval);
98  Time GetUcdInterval (void) const;
102  void SetIntervalT8 (Time interval);
106  Time GetIntervalT8 (void) const;
110  void SetMaxRangingCorrectionRetries (uint8_t maxRangCorrectionRetries);
114  uint8_t GetMaxRangingCorrectionRetries (void) const;
118  void SetMaxInvitedRangRetries (uint8_t maxInvitedRangRetries);
122  uint8_t GetMaxInvitedRangRetries (void) const;
126  void SetRangReqOppSize (uint8_t rangReqOppSize);
130  uint8_t GetRangReqOppSize (void) const;
134  void SetBwReqOppSize (uint8_t bwReqOppSize);
138  uint8_t GetBwReqOppSize (void) const;
142  void SetNrDlSymbols (uint32_t dlSymbols);
146  uint32_t GetNrDlSymbols (void) const;
150  void SetNrUlSymbols (uint32_t ulSymbols);
154  uint32_t GetNrUlSymbols (void) const;
158  uint32_t GetNrDcdSent (void) const;
162  uint32_t GetNrUcdSent (void) const;
163 
164  Time GetDlSubframeStartTime (void) const;
165  Time GetUlSubframeStartTime (void) const;
166  uint8_t GetRangingOppNumber (void) const;
170  Ptr<SSManager> GetSSManager (void) const;
174  void SetSSManager (Ptr<SSManager> ssManager);
182  void SetUplinkScheduler (Ptr<UplinkScheduler> ulScheduler);
186  Ptr<BSLinkManager> GetLinkManager (void) const;
190  void SetBSScheduler (Ptr<BSScheduler> bsSchedule);
194  Ptr<BSScheduler> GetBSScheduler (void) const;
195 
199  void SetLinkManager (Ptr<BSLinkManager> linkManager);
207  void SetBsClassifier (Ptr<IpcsClassifier> classifier);
208 
209  Time GetPsDuration (void) const;
210  Time GetSymbolDuration (void) const;
211 
212  void Start (void);
213  void Stop (void);
220  bool Enqueue (Ptr<Packet> packet, const MacHeaderType &hdrType, Ptr<WimaxConnection> connection);
222 
223  void MarkUplinkAllocations (void);
224  void MarkRangingOppStart (Time rangingOppStartTime);
225 
228 private:
229  void DoDispose (void);
230  void StartFrame (void);
231  void StartDlSubFrame (void);
232  void EndDlSubFrame (void);
233  void StartUlSubFrame (void);
234  void EndUlSubFrame (void);
235  void EndFrame (void);
236 
237  bool DoSend (Ptr<Packet> packet, const Mac48Address& source, const Mac48Address& dest, uint16_t protocolNumber);
238  void DoReceive (Ptr<Packet> packet);
242  void CreateMapMessages (void);
246  void CreateDescriptorMessages (bool sendDcd, bool senUcd);
247  void SendBursts (void);
248 
249  Ptr<Packet> CreateDlMap (void);
250  Ptr<Packet> CreateDcd (void);
251  Ptr<Packet> CreateUlMap (void);
252  Ptr<Packet> CreateUcd (void);
253  void SetDlBurstProfiles (Dcd *dcd);
254  void SetUlBurstProfiles (Ucd *ucd);
255 
256  void MarkUplinkAllocationStart (Time allocationStartTime);
257  void MarkUplinkAllocationEnd (Time allocationEndTime, Cid cid, uint8_t uiuc);
258  void UplinkAllocationStart (void);
259  void UplinkAllocationEnd (Cid cid, uint8_t uiuc);
260  void RangingOppStart (void);
261 
262  // parameters defined in Table 342
264  Time m_dcdInterval; // in seconds
265  Time m_ucdInterval; // in seconds
266  Time m_intervalT8; // in milliseconds, wait for DSA/DSC Acknowledge timeout
267 
270  uint8_t m_rangReqOppSize; // in symbols
271  uint8_t m_bwReqOppSize; // in symbols
272 
273  uint32_t m_nrDlSymbols;
274  uint32_t m_nrUlSymbols;
275 
276  // to keep track total number of a certain management messages sent by the BS
277  uint32_t m_nrDlMapSent;
278  uint32_t m_nrUlMapSent;
279  // number of DCDs and UCDs sent even if same
280  uint32_t m_nrDcdSent;
281  uint32_t m_nrUcdSent;
282 
285 
288 
289  // uint32_t m_nrFrames; //temporarily defined in wimax-net-device, as static
290  uint32_t m_nrDlFrames;
291  uint32_t m_nrUlFrames;
292 
293  // to keep track if number of SSs have changed since the last frame
295 
298 
301 
302  uint8_t m_ulAllocationNumber; // to see UL burst number
303  uint8_t m_rangingOppNumber; // current ranging TO number
304 
306 
308 
315  // same fields as in PHY, for quick access
318 
320 
328 
336 
345 
354 
362 };
363 
364 } // namespace ns3
365 
366 #endif /* WIMAX_BS_NET_DEVICE_H */
void SetUcdInterval(Time ucdInterval)
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
Time GetIntervalT8(void) const
void SetNrDlSymbols(uint32_t dlSymbols)
uint32_t GetNrDcdSent(void) const
void MarkRangingOppStart(Time rangingOppStartTime)
Forward calls to a chain of Callback.
void SetLinkManager(Ptr< BSLinkManager > linkManager)
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
void SetBSScheduler(Ptr< BSScheduler > bsSchedule)
uint8_t GetRangReqOppSize(void) const
Ptr< Packet > CreateUcd(void)
void SetMaxInvitedRangRetries(uint8_t maxInvitedRangRetries)
void SetIntervalT8(Time interval)
void SetBsClassifier(Ptr< IpcsClassifier > classifier)
void UplinkAllocationEnd(Cid cid, uint8_t uiuc)
Time GetDcdInterval(void) const
Ptr< Packet > CreateUlMap(void)
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 ...
bool Enqueue(Ptr< Packet > packet, const MacHeaderType &hdrType, Ptr< WimaxConnection > connection)
Enqueue a packet into a connection queue.
tuple phy
Definition: third.py:86
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 ...
Time GetInitialRangingInterval(void) const
Time GetSymbolDuration(void) const
Introspection did not find any typical Config paths.
static TypeId GetTypeId(void)
Time GetPsDuration(void) const
Ptr< UplinkScheduler > GetUplinkScheduler(void) const
void SetInitialRangingInterval(Time initialRangInterval)
Ptr< IpcsClassifier > GetBsClassifier(void) const
Ptr< BSLinkManager > m_linkManager
Introspection did not find any typical Config paths.
Represents the HT (Header Type) field of generic MAC and bandwidth request headers.
Ptr< IpcsClassifier > m_bsClassifier
Ptr< Packet > CreateDlMap(void)
Ptr< BsServiceFlowManager > GetServiceFlowManager(void) const
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.
TracedCallback< Ptr< const Packet >, Mac48Address, Cid > m_traceBSRx
Definition: cid.h:35
uint8_t GetRangingOppNumber(void) const
an EUI-48 address
Definition: mac48-address.h:43
Ptr< BSScheduler > m_scheduler
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 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)
void CreateDescriptorMessages(bool sendDcd, bool senUcd)
creates the channel descriptor MAC management messages DCD and UCD
void SetDlBurstProfiles(Dcd *dcd)
uint32_t GetNrUlSymbols(void) const
void SetMaxRangingCorrectionRetries(uint8_t maxRangCorrectionRetries)
Ptr< BSLinkManager > GetLinkManager(void) const
Time GetUcdInterval(void) const
void SetBwReqOppSize(uint8_t bwReqOppSize)
Ptr< SSManager > GetSSManager(void) const
void MarkUplinkAllocationEnd(Time allocationEndTime, Cid cid, uint8_t uiuc)
Ptr< BsServiceFlowManager > m_serviceFlowManager
Ptr< UplinkScheduler > m_uplinkScheduler
void SetUlBurstProfiles(Ucd *ucd)
Ptr< WimaxConnection > GetConnection(Cid cid)
void SetSSManager(Ptr< SSManager > ssManager)
Time GetDlSubframeStartTime(void) const
void InitBaseStationNetDevice(void)
initializes the BS net device and sets its parameters to the default values
void SetServiceFlowManager(Ptr< BsServiceFlowManager >)
This class is used exclusively by the BS to allocate CIDs to new connections.
Definition: cid-factory.h:45
void DoDispose(void)
Destructor implementation.
void SetNrUlSymbols(uint32_t ulSymbols)
a unique identifier for an interface.
Definition: type-id.h:58
Time GetUlSubframeStartTime(void) const
uint32_t GetNrUcdSent(void) const
Ptr< Packet > CreateDcd(void)