A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ss-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 * <amine.ismail@UDcast.com>
9 */
10
11#ifndef WIMAX_SS_NET_DEVICE_H
12#define WIMAX_SS_NET_DEVICE_H
13
14#include "ipcs-classifier.h"
16#include "wimax-mac-header.h"
17#include "wimax-net-device.h"
18
19#include "ns3/event-id.h"
20#include "ns3/nstime.h"
21#include "ns3/uinteger.h"
22
23namespace ns3
24{
25
26class Node;
27class OfdmDlBurstProfile;
28class OfdmUlBurstProfile;
29class SSScheduler;
30class SSLinkManager;
31class SsServiceFlowManager;
32class IpcsClassifier;
33
34/**
35 * \ingroup wimax
36 * SubscriberStationNetDevice subclass of WimaxNetDevice
37 */
39{
40 public:
41 /// State enumeration
56
57 /// EventType enumeration
69
70 /**
71 * \brief Get the type ID.
72 * \return the object TypeId
73 */
74 static TypeId GetTypeId();
76 /**
77 * Constructor
78 *
79 * \param node the node
80 * \param phy the wimax phy
81 */
84
85 /**
86 * \brief initializes the net device and sets the parameters to the default values
87 */
89 /**
90 * \param lostDlMapInterval time since last received DL-MAP message before downlink
91 * synchronization is considered lost
92 */
93 void SetLostDlMapInterval(Time lostDlMapInterval);
94 /**
95 * \returns the time since last received DL-MAP message before downlink synchronization is
96 * considered lost
97 */
99 /**
100 * \param lostUlMapInterval Time since last received UL-MAP before uplink synchronization is
101 * considered lost
102 */
103 void SetLostUlMapInterval(Time lostUlMapInterval);
104 /**
105 * \returns the time since last received UL-MAP before uplink synchronization is considered lost
106 */
108 /**
109 * \param maxDcdInterval Maximum time between transmission of DCD messages
110 */
111 void SetMaxDcdInterval(Time maxDcdInterval);
112 /**
113 * \returns the maximum time between transmission of DCD messages
114 */
115 Time GetMaxDcdInterval() const;
116 /**
117 * \param maxUcdInterval Maximum time between transmission of UCD messages
118 */
119 void SetMaxUcdInterval(Time maxUcdInterval);
120 /**
121 * \returns the maximum time between transmission of UCD messages
122 */
123 Time GetMaxUcdInterval() const;
124 /**
125 * \param interval1 Wait for DCD timeout value
126 */
127 void SetIntervalT1(Time interval1);
128 /**
129 * \returns the wait for DCD timeout
130 */
131 Time GetIntervalT1() const;
132 /**
133 * \param interval2 the wait for broadcast ranging timeout, i.e., wait for initial ranging
134 * opportunity
135 */
136 void SetIntervalT2(Time interval2);
137 /**
138 * \returns the wait for broadcast ranging timeout, i.e., wait for initial ranging opportunity
139 */
140 Time GetIntervalT2() const;
141 /**
142 * \param interval3 the ranging Response reception timeout following the transmission of a
143 * ranging request
144 */
145 void SetIntervalT3(Time interval3);
146 /**
147 * \returns the ranging Response reception timeout following the transmission of a ranging
148 * request
149 */
150 Time GetIntervalT3() const;
151 /**
152 * \param interval7 the wait for DSA/DSC/DSD Response timeout
153 */
154 void SetIntervalT7(Time interval7);
155 /**
156 * \returns the wait for DSA/DSC/DSD Response timeout
157 */
158 Time GetIntervalT7() const;
159 /**
160 * \param interval12 the Wait for UCD descriptor timeout
161 */
162 void SetIntervalT12(Time interval12);
163 /**
164 * \returns the wait for UCD descriptor timeout
165 */
166 Time GetIntervalT12() const;
167 /**
168 * \param interval20 the Time the SS searches for preambles on a given channel
169 */
170 void SetIntervalT20(Time interval20);
171 /**
172 * \returns the Time the SS searches for preambles on a given channel
173 */
174 Time GetIntervalT20() const;
175 /**
176 * \param interval21 the time the SS searches for (decodable) DL-MAP on a given channel
177 */
178 void SetIntervalT21(Time interval21);
179 /**
180 * \returns the time the SS searches for (decodable) DL-MAP on a given channel
181 */
182 Time GetIntervalT21() const;
183 /**
184 * \param maxContentionRangingRetries the Number of retries on contention Ranging Requests
185 */
186 void SetMaxContentionRangingRetries(uint8_t maxContentionRangingRetries);
187 /**
188 * \returns the Number of retries on contention Ranging Requests
189 */
190 uint8_t GetMaxContentionRangingRetries() const;
191 /**
192 * \param basicConnection the basic connection to be used
193 */
194 void SetBasicConnection(Ptr<WimaxConnection> basicConnection);
195 /**
196 * \return the basic connection currently in use
197 */
199 /**
200 * \param primaryConnection the primary connection to be used
201 */
202 void SetPrimaryConnection(Ptr<WimaxConnection> primaryConnection);
203 /**
204 * \returns the primary connection currently used
205 */
207 /**
208 * \returns the basic CID
209 */
210 Cid GetBasicCid() const;
211 /**
212 * \returns the primary CID
213 */
214 Cid GetPrimaryCid() const;
215
216 /**
217 * \brief Set the most efficient modulation and coding scheme (MCS) supported by the device
218 * \param modulationType the most robust MCS supported
219 */
220 void SetModulationType(WimaxPhy::ModulationType modulationType);
221 /**
222 * \returns the most efficient modulation and coding scheme (MCS) supported by the device
223 */
225 /**
226 * \param areManagementConnectionsAllocated true if the management connections are allocated,
227 * false otherwise
228 */
229 void SetAreManagementConnectionsAllocated(bool areManagementConnectionsAllocated);
230 /**
231 * \returns true if the management connections are allocated, false otherwise
232 */
234 /**
235 * \param areServiceFlowsAllocated true if the service flows are allocated, false otherwise
236 */
237 void SetAreServiceFlowsAllocated(bool areServiceFlowsAllocated);
238 /**
239 * \returns true if the service flows are allocated, false otherwise
240 */
241 bool GetAreServiceFlowsAllocated() const;
242 /**
243 * \return the scheduler installed on the device
244 */
246 /**
247 * \param ssScheduler the scheduler to be installed on the device
248 */
249 void SetScheduler(Ptr<SSScheduler> ssScheduler);
250 /**
251 * \returns true if the device has at least one active service flow, false otherwise
252 */
253 bool HasServiceFlows() const;
254 /**
255 * \brief Enqueue a packet into a connection queue
256 * \param packet the packet to be enqueued
257 * \param hdrType the mac header type to be appended to the packet
258 * \param connection the connection to be used
259 * \returns true if successful
260 */
261 bool Enqueue(Ptr<Packet> packet,
262 const MacHeaderType& hdrType,
263 Ptr<WimaxConnection> connection) override;
264 /**
265 * \brief Sends a burst on the uplink frame
266 * \param uiuc theOfdmUlBurstProfile
267 * \param nrSymbols number of symbols
268 * \param connection connection to use
269 * \param packetType optional HeaderType (default HEADER_TYPE_GENERIC)
270 */
271 void SendBurst(uint8_t uiuc,
272 uint16_t nrSymbols,
273 Ptr<WimaxConnection> connection,
275
276 /**
277 * \brief Start the device
278 */
279 void Start() override;
280 /**
281 * \brief Stop the device
282 */
283 void Stop() override;
284
285 /**
286 * \brief adds a new service flow
287 * \param sf pointer to service flow to add
288 */
289 void AddServiceFlow(ServiceFlow* sf) const;
290 /**
291 * \brief adds a new service flow
292 * \param sf service flow to add
293 */
294 void AddServiceFlow(ServiceFlow sf) const;
295 /**
296 * \brief Set timer. If in stopped state, the EventId passed in the first
297 * argument will be cancelled. If not, the second parameter will be set
298 * to the value of the first parameter.
299 *
300 * \param eventId EventId to cancel or to map to the second argument
301 * \param event EventId is set to first argument if not in stopped state
302 */
303 void SetTimer(EventId eventId, EventId& event);
304 /**
305 * \returns true if the SS is registered to a BS, false otherwise
306 */
307 bool IsRegistered() const;
308 /**
309 * \brief Get time to allocation
310 * \param deferTime defer time
311 * \returns the time to allocation
312 */
313 Time GetTimeToAllocation(Time deferTime);
314
316 /**
317 * \returns a pointer to the CS packet classifier
318 */
320 /**
321 * \brief Sets the packet classifier to be used
322 * \param classifier the classifier to use
323 */
325 /**
326 * \returns a pointer to the link manager currently used
327 */
329 /**
330 * \brief sets the link manager to be used
331 * \param linkManager link manager to use
332 */
333 void SetLinkManager(Ptr<SSLinkManager> linkManager);
334 /**
335 * \returns a pointer to the service flow manager installed on the device
336 */
338 /**
339 * \brief Sets the service flow manager to be installed on the device
340 * \param sfm service flow manager to be used
341 */
343
344 /// Callback for logging packets on ASCII traces
346
347 /**
348 * Set the Enqueue callback for ASCII tracing
349 * \param cb callback for ASCII tracing
350 */
352
353 /**
354 * Set the Dequeue callback for ASCII tracing
355 * \param cb callback for ASCII tracing
356 */
358
359 /**
360 * Set the Drop callback for ASCII tracing
361 * \param cb callback for ASCII tracing
362 */
364
365 private:
366 /**
367 * Get default lost DL map interval
368 * \returns the default lost DL map interval
369 */
371
372 void DoDispose() override;
373 /**
374 * Send a packet
375 * \param packet the packet to send
376 * \param source the source MAC address
377 * \param dest the destination MAC address
378 * \param protocolNumber the protocol number
379 * \returns true if successful
380 */
381 bool DoSend(Ptr<Packet> packet,
382 const Mac48Address& source,
383 const Mac48Address& dest,
384 uint16_t protocolNumber) override;
385 /**
386 * Receive a packet
387 * \param packet the packet received
388 */
389 void DoReceive(Ptr<Packet> packet) override;
390
391 /**
392 * Process DL map
393 * \param dlmap the DL map
394 */
395 void ProcessDlMap(const DlMap& dlmap);
396 /**
397 * Process UL map
398 * \param ulmap the UL map
399 */
400 void ProcessUlMap(const UlMap& ulmap);
401 /**
402 * Process DCD
403 * \param dcd the DCD
404 */
405 void ProcessDcd(const Dcd& dcd);
406 /**
407 * Process UCD
408 * \param ucd the UCD
409 */
410 void ProcessUcd(const Ucd& ucd);
411
412 // parameters defined in Table 342
413 Time m_lostDlMapInterval; ///< in milliseconds, time since last received DL-MAP before downlink
414 ///< synchronization is considered lost, maximum is 600
415 Time m_lostUlMapInterval; ///< in milliseconds, time since last received UL-MAP before uplink
416 ///< synchronization is considered lost, maximum is 600
417 Time m_maxDcdInterval; ///< in seconds, maximum time between transmission of DCD messages
418 Time m_maxUcdInterval; ///< in seconds, maximum time between transmission of UCD messages
419 Time m_intervalT1; ///< in seconds, wait for DCD timeout
420 Time m_intervalT2; ///< in seconds, wait for broadcast ranging timeout, i.e., wait for initial
421 ///< ranging opportunity
422 Time m_intervalT3; ///< in milliseconds, ranging Response reception timeout following the
423 ///< transmission of a ranging request
424 Time m_intervalT7; ///< in seconds, wait for DSA/DSC/DSD Response timeout
425 Time m_intervalT12; ///< in seconds, wait for UCD descriptor
426 Time m_intervalT20; ///< in seconds, time the SS searches for preambles on a given channel
427 Time m_intervalT21; ///< in seconds, time the SS searches for (decodable) DL-MAP on a given
428 ///< channel
429 uint8_t m_maxContentionRangingRetries; ///< maximum contention ranging retries
430
431 // parameters obtained from DL-MAP
432 uint8_t m_dcdCount; ///< DCD count
433 Mac48Address m_baseStationId; ///< base station ID
434
435 // parameters obtained from UL-MAP
436 uint8_t m_ucdCount; ///< UCD count
437 double m_allocationStartTime; ///< allocation start time
438
439 // to keep the number of DL-MAP/UL-MAP IEs found in the last DL-MAP/U-MAP messages
440 uint16_t m_nrDlMapElements; ///< number DL Map elements
441 uint16_t m_nrUlMapElements; ///< number UL Map elements
442
445
446 EventId m_lostDlMapEvent; ///< lost DL map event
447 EventId m_lostUlMapEvent; ///< lost UL map event
448 EventId m_dcdWaitTimeoutEvent; ///< DCD wait timeout event
449 EventId m_ucdWaitTimeoutEvent; ///< UCD wait timeout event
450 EventId m_rangOppWaitTimeoutEvent; ///< range opp wait timeout event
451
452 uint32_t m_nrDlMapRecvd; ///< number DL map received
453 uint32_t m_nrUlMapRecvd; ///< number UL map received
454 uint32_t m_nrDcdRecvd; ///< number DCD received
455 uint32_t m_nrUcdRecvd; ///< number UCD received
456
457 OfdmDlBurstProfile* m_dlBurstProfile; ///< DL burst profile
458 OfdmUlBurstProfile* m_ulBurstProfile; ///< UL burst profile
459
460 /*represents the (least robust) modulation type of the SS which it then requests in RNG-REQ and
461 if accepted by BS uses it for receiving and transmitting. currently it is set by user in
462 simulation script, shall actually be determined based on SS's distance, power, signal etc*/
464
465 bool m_areManagementConnectionsAllocated; ///< are management connections allocated
466 bool m_areServiceFlowsAllocated; ///< are service flows allocated
467
468 Ptr<SSScheduler> m_scheduler; ///< the scheduler
469 Ptr<SsServiceFlowManager> m_serviceFlowManager; ///< the service flow manager
471
473 m_traceSSRx; ///< trace SS receive callback
474
475 /**
476 * The trace source fired when packets come into the "top" of the device
477 * at the L3/L2 transition, before being queued for transmission.
478 *
479 * \see class CallBackTraceSource
480 */
482
483 /**
484 * The trace source fired when packets coming into the "top" of the device
485 * are dropped at the MAC layer during transmission.
486 *
487 * \see class CallBackTraceSource
488 */
490
491 /**
492 * The trace source fired for packets successfully received by the device
493 * immediately before being forwarded up to higher layers (at the L2/L3
494 * transition). This is a promiscuous trace.
495 *
496 * \see class CallBackTraceSource
497 */
499
500 /**
501 * The trace source fired for packets successfully received by the device
502 * immediately before being forwarded up to higher layers (at the L2/L3
503 * transition). This is a non- promiscuous trace.
504 *
505 * \see class CallBackTraceSource
506 */
508
509 /**
510 * The trace source fired when packets coming into the "top" of the device
511 * are dropped at the MAC layer during reception.
512 *
513 * \see class CallBackTraceSource
514 */
516
517 /// Bound callback to perform ASCII logging for Enqueue events
519 /// Bound callback to perform ASCII logging for Dequeue events
521 /// Bound callback to perform ASCII logging for Drop events
523};
524
525} // namespace ns3
526
527#endif /* WIMAX_SS_NET_DEVICE_H */
Callback template class.
Definition callback.h:422
Cid class.
Definition cid.h:26
This class implements Downlink channel descriptor as described by "IEEE Standard forLocal and metropo...
This class implements DL-MAP as described by "IEEE Standard forLocal and metropolitan area networks P...
An identifier for simulation events.
Definition event-id.h:45
an EUI-48 address
This class Represents the HT (Header Type) field of generic MAC and bandwidth request headers.
HeaderType
Header type enumeration.
This class implements the OFDM Downlink burst profile descriptor as described by "IEEE Standardfor Lo...
This class implements the UL burst profile as described by "IEEE Standard forLocal and metropolitan a...
Smart pointer class similar to boost::intrusive_ptr.
This class implements service flows as described by the IEEE-802.16 standard.
SubscriberStationNetDevice subclass of WimaxNetDevice.
void Start() override
Start the device.
Time m_intervalT2
in seconds, wait for broadcast ranging timeout, i.e., wait for initial ranging opportunity
Time m_lostDlMapInterval
in milliseconds, time since last received DL-MAP before downlink synchronization is considered lost,...
Time m_lostUlMapInterval
in milliseconds, time since last received UL-MAP before uplink synchronization is considered lost,...
void DoReceive(Ptr< Packet > packet) override
Receive a packet.
Ptr< SSLinkManager > m_linkManager
link manager
Ptr< WimaxConnection > m_primaryConnection
primary connection
void SetAsciiTxQueueDropCallback(AsciiTraceCallback cb)
Set the Drop callback for ASCII tracing.
TracedCallback< Ptr< const Packet > > m_ssPromiscRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
double m_allocationStartTime
allocation start time
EventId m_dcdWaitTimeoutEvent
DCD wait timeout event.
void SetIntervalT21(Time interval21)
OfdmUlBurstProfile * m_ulBurstProfile
UL burst profile.
void SetIntervalT20(Time interval20)
Ptr< SSScheduler > m_scheduler
the scheduler
void SetIpcsPacketClassifier(Ptr< IpcsClassifier > classifier)
Sets the packet classifier to be used.
void SetIntervalT1(Time interval1)
void AddServiceFlow(ServiceFlow *sf) const
adds a new service flow
Time m_intervalT21
in seconds, time the SS searches for (decodable) DL-MAP on a given channel
void SetMaxDcdInterval(Time maxDcdInterval)
void SetAreManagementConnectionsAllocated(bool areManagementConnectionsAllocated)
Ptr< IpcsClassifier > m_classifier
the classifier
Callback< void, std::string, Ptr< const Packet > > AsciiTraceCallback
Callback for logging packets on ASCII traces.
uint32_t m_nrUlMapRecvd
number UL map received
AsciiTraceCallback m_asciiTxQueueDropCb
Bound callback to perform ASCII logging for Drop events.
WimaxPhy::ModulationType m_modulationType
modulation type
uint8_t GetMaxContentionRangingRetries() const
uint32_t m_nrDcdRecvd
number DCD received
void SetAsciiTxQueueDequeueCallback(AsciiTraceCallback cb)
Set the Dequeue callback for ASCII tracing.
void SetScheduler(Ptr< SSScheduler > ssScheduler)
AsciiTraceCallback m_asciiTxQueueEnqueueCb
Bound callback to perform ASCII logging for Enqueue events.
bool DoSend(Ptr< Packet > packet, const Mac48Address &source, const Mac48Address &dest, uint16_t protocolNumber) override
Send a packet.
Ptr< SSScheduler > GetScheduler() const
void SetBasicConnection(Ptr< WimaxConnection > basicConnection)
AsciiTraceCallback m_asciiTxQueueDequeueCb
Bound callback to perform ASCII logging for Dequeue events.
bool m_areManagementConnectionsAllocated
are management connections allocated
Time m_intervalT20
in seconds, time the SS searches for preambles on a given channel
Ptr< IpcsClassifier > GetIpcsClassifier() const
void SetLostUlMapInterval(Time lostUlMapInterval)
Time m_intervalT1
in seconds, wait for DCD timeout
void SetPrimaryConnection(Ptr< WimaxConnection > primaryConnection)
void ProcessUcd(const Ucd &ucd)
Process UCD.
void SetTimer(EventId eventId, EventId &event)
Set timer.
Ptr< WimaxConnection > GetBasicConnection() const
uint8_t m_maxContentionRangingRetries
maximum contention ranging retries
static TypeId GetTypeId()
Get the type ID.
EventId m_ucdWaitTimeoutEvent
UCD wait timeout event.
TracedCallback< Ptr< const Packet > > m_ssRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
EventId m_rangOppWaitTimeoutEvent
range opp wait timeout event
TracedCallback< Ptr< const Packet > > m_ssTxDropTrace
The trace source fired when packets coming into the "top" of the device are dropped at the MAC layer ...
Mac48Address m_baseStationId
base station ID
void SetMaxContentionRangingRetries(uint8_t maxContentionRangingRetries)
void ProcessDlMap(const DlMap &dlmap)
Process DL map.
void ProcessDcd(const Dcd &dcd)
Process DCD.
void SetIntervalT2(Time interval2)
Time m_maxUcdInterval
in seconds, maximum time between transmission of UCD messages
Time GetTimeToAllocation(Time deferTime)
Get time to allocation.
static Time GetDefaultLostDlMapInterval()
Get default lost DL map interval.
void SetIntervalT12(Time interval12)
void SetIntervalT3(Time interval3)
TracedCallback< Ptr< const Packet > > m_ssRxDropTrace
The trace source fired when packets coming into the "top" of the device are dropped at the MAC layer ...
bool m_areServiceFlowsAllocated
are service flows allocated
void SetAsciiTxQueueEnqueueCallback(AsciiTraceCallback cb)
Set the Enqueue callback for ASCII tracing.
bool GetAreManagementConnectionsAllocated() const
bool Enqueue(Ptr< Packet > packet, const MacHeaderType &hdrType, Ptr< WimaxConnection > connection) override
Enqueue a packet into a connection queue.
EventId m_lostDlMapEvent
lost DL map event
void SetLostDlMapInterval(Time lostDlMapInterval)
Ptr< SsServiceFlowManager > m_serviceFlowManager
the service flow manager
Time m_intervalT12
in seconds, wait for UCD descriptor
void SetLinkManager(Ptr< SSLinkManager > linkManager)
sets the link manager to be used
void SetIntervalT7(Time interval7)
Time m_maxDcdInterval
in seconds, maximum time between transmission of DCD messages
TracedCallback< Ptr< const Packet >, Mac48Address, const Cid & > m_traceSSRx
trace SS receive callback
Time m_intervalT3
in milliseconds, ranging Response reception timeout following the transmission of a ranging request
Ptr< SSLinkManager > GetLinkManager() const
void Stop() override
Stop the device.
WimaxPhy::ModulationType GetModulationType() const
EventType
EventType enumeration.
void SetServiceFlowManager(Ptr< SsServiceFlowManager > sfm)
Sets the service flow manager to be installed on the device.
uint32_t m_nrDlMapRecvd
number DL map received
void SetAreServiceFlowsAllocated(bool areServiceFlowsAllocated)
void ProcessUlMap(const UlMap &ulmap)
Process UL map.
Ptr< WimaxConnection > m_basicConnection
basic connection
Ptr< SsServiceFlowManager > GetServiceFlowManager() const
OfdmDlBurstProfile * m_dlBurstProfile
DL burst profile.
uint16_t m_nrDlMapElements
number DL Map elements
TracedCallback< Ptr< const Packet > > m_ssTxTrace
The trace source fired when packets come into the "top" of the device at the L3/L2 transition,...
uint32_t m_nrUcdRecvd
number UCD received
void InitSubscriberStationNetDevice()
initializes the net device and sets the parameters to the default values
Ptr< WimaxConnection > GetPrimaryConnection() const
void SetModulationType(WimaxPhy::ModulationType modulationType)
Set the most efficient modulation and coding scheme (MCS) supported by the device.
void DoDispose() override
Destructor implementation.
void SendBurst(uint8_t uiuc, uint16_t nrSymbols, Ptr< WimaxConnection > connection, MacHeaderType::HeaderType packetType=MacHeaderType::HEADER_TYPE_GENERIC)
Sends a burst on the uplink frame.
uint16_t m_nrUlMapElements
number UL Map elements
Time m_intervalT7
in seconds, wait for DSA/DSC/DSD Response timeout
void SetMaxUcdInterval(Time maxUcdInterval)
EventId m_lostUlMapEvent
lost UL map event
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...
This class implements the UL-MAP_IE message as described by "IEEE Standard forLocal and metropolitan ...
Hold together all WiMAX-related objects in a NetDevice.
ModulationType
ModulationType enumeration.
Definition wimax-phy.h:43
Every class exported by the ns3 library is enclosed in the ns3 namespace.