A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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);
67  Ptr<WimaxPhy> phy,
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 */