A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
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
35namespace ns3
36{
37
38class Node;
39class Packet;
40class SSRecord;
41class SSManager;
42class BSScheduler;
43class BurstProfileManager;
44class BSLinkManager;
45class UplinkScheduler;
46class BsServiceFlowManager;
47
48/**
49 * \ingroup wimax
50 *
51 * BaseStation NetDevice
52 */
54{
55 public:
56 /// State enumeration
57 enum State
58 {
63 };
64
65 /// MacPreamble enumeration
67 {
70 };
71
72 /**
73 * \brief Get the type ID.
74 * \return the object TypeId
75 */
76 static TypeId GetTypeId();
78 /**
79 * Constructor
80 *
81 * \param node the node
82 * \param phy the wimax phy
83 */
85 /**
86 * Constructor
87 *
88 * \param node the node
89 * \param phy the wimax phy
90 * \param uplinkScheduler uplink scheduler
91 * \param bsScheduler bs scheduler
92 */
94 Ptr<WimaxPhy> phy,
95 Ptr<UplinkScheduler> uplinkScheduler,
96 Ptr<BSScheduler> bsScheduler);
97 ~BaseStationNetDevice() override;
98 /**
99 * \param initialRangInterval Time between initial ranging regions assigned by the BS
100 */
101 void SetInitialRangingInterval(Time initialRangInterval);
102 /**
103 * \brief initializes the BS net device and sets its parameters to the default values
104 */
106 /**
107 * \returns Time between initial ranging regions assigned by the BS
108 */
110 /**
111 * \param dcdInterval Time between transmission of DCD messages
112 */
113 void SetDcdInterval(Time dcdInterval);
114 /**
115 * \returns the Time between transmission of DCD messages
116 */
117 Time GetDcdInterval() const;
118 /**
119 * \param ucdInterval the Time between transmission of UCD messages
120 */
121 void SetUcdInterval(Time ucdInterval);
122 /**
123 * \returns Time between transmission of UCD messages
124 */
125 Time GetUcdInterval() const;
126 /**
127 * \param interval the Wait for DSA/DSC Acknowledge timeout
128 */
129 void SetIntervalT8(Time interval);
130 /**
131 * \returns the Wait for DSA/DSC Acknowledge timeout
132 */
133 Time GetIntervalT8() const;
134 /**
135 * \param maxRangCorrectionRetries the number of retries on contention Ranging Requests
136 */
137 void SetMaxRangingCorrectionRetries(uint8_t maxRangCorrectionRetries);
138 /**
139 * \returns the number of retries on contention Ranging Requests
140 */
141 uint8_t GetMaxRangingCorrectionRetries() const;
142 /**
143 * \param maxInvitedRangRetries the number of retries on contention Ranging
144 */
145 void SetMaxInvitedRangRetries(uint8_t maxInvitedRangRetries);
146 /**
147 * \returns the number of retries on contention Ranging
148 */
149 uint8_t GetMaxInvitedRangRetries() const;
150 /**
151 * \param rangReqOppSize The ranging opportunity size in symbols
152 */
153 void SetRangReqOppSize(uint8_t rangReqOppSize);
154 /**
155 * \returns The ranging opportunity size in symbols
156 */
157 uint8_t GetRangReqOppSize() const;
158 /**
159 * \param bwReqOppSize The bandwidth request opportunity size in symbols
160 */
161 void SetBwReqOppSize(uint8_t bwReqOppSize);
162 /**
163 * \returns The bandwidth request opportunity size in symbols
164 */
165 uint8_t GetBwReqOppSize() const;
166 /**
167 * \param dlSymbols the number of symbols in the downlink sub-frame
168 */
169 void SetNrDlSymbols(uint32_t dlSymbols);
170 /**
171 * \returns the number of symbols in the downlink sub-frame
172 */
173 uint32_t GetNrDlSymbols() const;
174 /**
175 * \param ulSymbols the number of symbols in the uplink sub-frame
176 */
177 void SetNrUlSymbols(uint32_t ulSymbols);
178 /**
179 * \returns the number of symbols in the uplink sub-frame
180 */
181 uint32_t GetNrUlSymbols() const;
182 /**
183 * \returns the number dcd messages already sent
184 */
185 uint32_t GetNrDcdSent() const;
186 /**
187 * \returns the number ucd messages already sent
188 */
189 uint32_t GetNrUcdSent() const;
190 /**
191 * \returns the DL subframe start time
192 */
194 /**
195 * \returns the UL subframe start time
196 */
198 /**
199 * \returns the ranging opp number
200 */
201 uint8_t GetRangingOppNumber() const;
202 /**
203 * \returns a pointer to the SS manager
204 */
206 /**
207 * \param ssManager the SS manager to be installed on the BS
208 */
209 void SetSSManager(Ptr<SSManager> ssManager);
210 /**
211 * \returns a pointer to the uplink scheduler installed on the device
212 */
214 /**
215 * \param ulScheduler the ulScheduler to be isnstalled on the BS
216 */
218 /**
219 * \returns a pointer to the link manager installed on the BS
220 */
222 /**
223 * \param bsSchedule the downlink scheduler to be installed on the BS
224 */
225 void SetBSScheduler(Ptr<BSScheduler> bsSchedule);
226 /**
227 * \returns The BS scheduler installed on the BS
228 */
230 /**
231 * \param linkManager The link manager installed on the BS
232 */
233 void SetLinkManager(Ptr<BSLinkManager> linkManager);
234 /**
235 * \returns a pointer to the classifier installed on the BS
236 */
238 /**
239 * \param classifier a classifier to be installed on the BS
240 */
241 void SetBsClassifier(Ptr<IpcsClassifier> classifier);
242
243 /**
244 * \returns PS duration
245 */
246 Time GetPsDuration() const;
247 /**
248 * \returns symbol duration
249 */
250 Time GetSymbolDuration() const;
251 /**
252 * \brief Start device
253 */
254 void Start() override;
255 /**
256 * \brief Stop device
257 */
258 void Stop() override;
259 /**
260 * \brief Enqueue a packet into a connection queue
261 * \param packet the packet to be enqueued
262 * \param hdrType the mac header type to be appended to the packet
263 * \param connection the connection to be used
264 * \return true if successful
265 */
266 bool Enqueue(Ptr<Packet> packet,
267 const MacHeaderType& hdrType,
268 Ptr<WimaxConnection> connection) override;
269 /**
270 * \param cid connection ID
271 * \returns a pointer to the connection
272 */
274
275 /**
276 * \brief Mark uplink allocations
277 */
279 /**
280 * \brief Mark ranging opp start
281 * \param rangingOppStartTime start time
282 */
283 void MarkRangingOppStart(Time rangingOppStartTime);
284 /**
285 * \returns service flow manager
286 */
288 /**
289 * \brief Set service flow manager
290 * \param sfm the service flow manager
291 */
293
294 private:
295 void DoDispose() override;
296 /**
297 * \brief Start frame function
298 */
299 void StartFrame();
300 /**
301 * \brief Start DL subframe function
302 */
303 void StartDlSubFrame();
304 /**
305 * \brief End DL subframe function
306 */
307 void EndDlSubFrame();
308 /**
309 * \brief Start UL subframe function
310 */
311 void StartUlSubFrame();
312 /**
313 * \brief End UL subframe function
314 */
315 void EndUlSubFrame();
316 /**
317 * \brief End frame function
318 */
319 void EndFrame();
320 /**
321 * \brief Send packet
322 * \param packet to send
323 * \param source MAC address
324 * \param dest destination MAC address
325 * \param protocolNumber protocol number
326 * \returns true if successful
327 */
328 bool DoSend(Ptr<Packet> packet,
329 const Mac48Address& source,
330 const Mac48Address& dest,
331 uint16_t protocolNumber) override;
332 /**
333 * \brief Receive packet
334 * \param packet to send
335 */
336 void DoReceive(Ptr<Packet> packet) override;
337 /**
338 * \brief creates the MAC management messages DL-MAP and UL-MAP
339 */
340 void CreateMapMessages();
341 /**
342 * \brief creates the channel descriptor MAC management messages DCD and UCD
343 * \param sendDcd true if send DCD
344 * \param sendUcd true if send UCD
345 */
346 void CreateDescriptorMessages(bool sendDcd, bool sendUcd);
347 /**
348 * \brief Send burst function
349 */
350 void SendBursts();
351
352 /**
353 * \brief Create DL map
354 * \returns packet
355 */
357 /**
358 * \brief Create DCD
359 * \returns packet
360 */
362 /**
363 * \brief Create UL map
364 * \returns packet
365 */
367 /**
368 * \brief Create UCD
369 * \returns packet
370 */
372 /**
373 * \brief Send DL burst profiles
374 * \param dcd burst profile
375 */
376 void SetDlBurstProfiles(Dcd* dcd);
377 /**
378 * \brief Send UL burst profiles
379 * \param ucd burst profile
380 */
381 void SetUlBurstProfiles(Ucd* ucd);
382
383 /**
384 * \brief Mark uplink allocation start
385 * \param allocationStartTime allocation start time
386 */
387 void MarkUplinkAllocationStart(Time allocationStartTime);
388 /**
389 * \brief Mark uplink allocation end
390 * \param allocationEndTime allocation end time
391 * \param cid connection ID
392 * \param uiuc
393 */
394 void MarkUplinkAllocationEnd(Time allocationEndTime, Cid cid, uint8_t uiuc);
395 /**
396 * \brief Uplink allocation start
397 */
399 /**
400 * \brief Uplink allocation end
401 * \param cid connection ID
402 * \param uiuc
403 */
404 void UplinkAllocationEnd(Cid cid, uint8_t uiuc);
405 /**
406 * \brief Ranging opp start
407 */
408 void RangingOppStart();
409
410 // parameters defined in Table 342
412 Time m_dcdInterval; ///< in seconds
413 Time m_ucdInterval; ///< in seconds
414 Time m_intervalT8; ///< in milliseconds, wait for DSA/DSC Acknowledge timeout
415
416 uint8_t m_maxRangCorrectionRetries; ///< maximum range correction retries
417 uint8_t m_maxInvitedRangRetries; ///< maximum invited range retries
418 uint8_t m_rangReqOppSize; ///< in symbols
419 uint8_t m_bwReqOppSize; ///< in symbols
420
421 uint32_t m_nrDlSymbols; ///< number of DL symbols
422 uint32_t m_nrUlSymbols; ///< number of UL symbols
423
424 // to keep track total number of a certain management messages sent by the BS
425 uint32_t m_nrDlMapSent; ///< number DL map sent
426 uint32_t m_nrUlMapSent; ///< number UL map sent
427 // number of DCDs and UCDs sent even if same
428 uint32_t m_nrDcdSent; ///< number DCD sent
429 uint32_t m_nrUcdSent; ///< number UCD sent
430
431 uint32_t m_dcdConfigChangeCount; ///< DCD config change count
432 uint32_t m_ucdConfigChangeCount; ///< UCD config change count
433
434 uint32_t m_framesSinceLastDcd; ///< frames since last DCD
435 uint32_t m_framesSinceLastUcd; ///< frames since last UCD
436
437 // uint32_t m_nrFrames; //temporarily defined in wimax-net-device, as static
438 uint32_t m_nrDlFrames; ///< number DL frames
439 uint32_t m_nrUlFrames; ///< number UL frames
440
441 // to keep track if number of SSs have changed since the last frame
442 uint16_t m_nrSsRegistered; ///< number SS registered
443
444 uint16_t m_nrDlAllocations; ///< number DL allocations
445 uint16_t m_nrUlAllocations; ///< number UL allocations
446
447 Time m_dlSubframeStartTime; ///< DL subframe start time
448 Time m_ulSubframeStartTime; ///< UL subframe start time
449
450 uint8_t m_ulAllocationNumber; ///< to see UL burst number
451 uint8_t m_rangingOppNumber; ///< current ranging TO number
452
453 CidFactory* m_cidFactory; ///< the CID factory
454
455 uint32_t m_allocationStartTime; ///< allocation start time
456
457 Ptr<SSManager> m_ssManager; ///< the SS manager
458 Ptr<UplinkScheduler> m_uplinkScheduler; ///< the uplink scheduler
459 Ptr<BSScheduler> m_scheduler; ///< the base station scheduler
460 Ptr<BSLinkManager> m_linkManager; ///< the link manager
461 Ptr<IpcsClassifier> m_bsClassifier; ///< the base station classifier
462 Ptr<BsServiceFlowManager> m_serviceFlowManager; ///< the service flow manager
463 // same fields as in PHY, for quick access
464 Time m_psDuration; ///< ps duration
465 Time m_symbolDuration; ///< symbol duration
466
468 m_traceBSRx; ///< the base station receive trace callback
469
470 /**
471 * The trace source fired when packets come into the "top" of the device
472 * at the L3/L2 transition, before being queued for transmission.
473 *
474 * \see class CallBackTraceSource
475 */
476 TracedCallback<Ptr<const Packet>> m_bsTxTrace; ///< the base station transmit trace callback
477
478 /**
479 * The trace source fired when packets coming into the "top" of the device
480 * are dropped at the MAC layer during transmission.
481 *
482 * \see class CallBackTraceSource
483 */
485 m_bsTxDropTrace; ///< base station transmit drop trace callback
486
487 /**
488 * The trace source fired for packets successfully received by the device
489 * immediately before being forwarded up to higher layers (at the L2/L3
490 * transition). This is a promiscuous trace.
491 *
492 * \see class CallBackTraceSource
493 */
495 m_bsPromiscRxTrace; ///< base station promiscuous receive trace callback
496
497 /**
498 * The trace source fired for packets successfully received by the device
499 * immediately before being forwarded up to higher layers (at the L2/L3
500 * transition). This is a non- promiscuous trace.
501 *
502 * \see class CallBackTraceSource
503 */
504 TracedCallback<Ptr<const Packet>> m_bsRxTrace; ///< base station receive trace callback
505
506 /**
507 * The trace source fired when packets coming into the "top" of the device
508 * are dropped at the MAC layer during reception.
509 *
510 * \see class CallBackTraceSource
511 */
512 TracedCallback<Ptr<const Packet>> m_bsRxDropTrace; ///< base station receive drop trace callback
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.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
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.