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