A Discrete-Event Network Simulator
API
ss-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  * <amine.ismail@UDcast.com>
20  */
21 
22 #ifndef WIMAX_SS_NET_DEVICE_H
23 #define WIMAX_SS_NET_DEVICE_H
24 
25 #include "ipcs-classifier.h"
27 #include "wimax-mac-header.h"
28 #include "wimax-net-device.h"
29 
30 #include "ns3/event-id.h"
31 #include "ns3/nstime.h"
32 #include "ns3/uinteger.h"
33 
34 namespace ns3
35 {
36 
37 class Node;
38 class OfdmDlBurstProfile;
39 class OfdmUlBurstProfile;
40 class SSScheduler;
41 class SSLinkManager;
42 class SsServiceFlowManager;
43 class IpcsClassifier;
44 
50 {
51  public:
53  enum State
54  {
59  SS_STATE_WAITING_REG_RANG_INTRVL, // regular ranging interval
60  SS_STATE_WAITING_INV_RANG_INTRVL, // invited ranging interval
64  SS_STATE_TRANSMITTING, // currently not being used anywhere
66  };
67 
69  enum EventType
70  {
79  };
80 
85  static TypeId GetTypeId();
94  ~SubscriberStationNetDevice() override;
95 
104  void SetLostDlMapInterval(Time lostDlMapInterval);
109  Time GetLostDlMapInterval() const;
114  void SetLostUlMapInterval(Time lostUlMapInterval);
118  Time GetLostUlMapInterval() const;
122  void SetMaxDcdInterval(Time maxDcdInterval);
126  Time GetMaxDcdInterval() const;
130  void SetMaxUcdInterval(Time maxUcdInterval);
134  Time GetMaxUcdInterval() const;
138  void SetIntervalT1(Time interval1);
142  Time GetIntervalT1() const;
147  void SetIntervalT2(Time interval2);
151  Time GetIntervalT2() const;
156  void SetIntervalT3(Time interval3);
161  Time GetIntervalT3() const;
165  void SetIntervalT7(Time interval7);
169  Time GetIntervalT7() const;
173  void SetIntervalT12(Time interval12);
177  Time GetIntervalT12() const;
181  void SetIntervalT20(Time interval20);
185  Time GetIntervalT20() const;
189  void SetIntervalT21(Time interval21);
193  Time GetIntervalT21() const;
197  void SetMaxContentionRangingRetries(uint8_t maxContentionRangingRetries);
201  uint8_t GetMaxContentionRangingRetries() const;
205  void SetBasicConnection(Ptr<WimaxConnection> basicConnection);
213  void SetPrimaryConnection(Ptr<WimaxConnection> primaryConnection);
221  Cid GetBasicCid() const;
225  Cid GetPrimaryCid() const;
226 
231  void SetModulationType(WimaxPhy::ModulationType modulationType);
240  void SetAreManagementConnectionsAllocated(bool areManagementConnectionsAllocated);
248  void SetAreServiceFlowsAllocated(bool areServiceFlowsAllocated);
252  bool GetAreServiceFlowsAllocated() const;
260  void SetScheduler(Ptr<SSScheduler> ssScheduler);
264  bool HasServiceFlows() const;
272  bool Enqueue(Ptr<Packet> packet,
273  const MacHeaderType& hdrType,
274  Ptr<WimaxConnection> connection) override;
282  void SendBurst(uint8_t uiuc,
283  uint16_t nrSymbols,
284  Ptr<WimaxConnection> connection,
286 
290  void Start() override;
294  void Stop() override;
295 
300  void AddServiceFlow(ServiceFlow* sf) const;
305  void AddServiceFlow(ServiceFlow sf) const;
314  void SetTimer(EventId eventId, EventId& event);
318  bool IsRegistered() const;
324  Time GetTimeToAllocation(Time deferTime);
325 
344  void SetLinkManager(Ptr<SSLinkManager> linkManager);
354 
357 
363 
369 
375 
376  private:
382 
383  void DoDispose() override;
392  bool DoSend(Ptr<Packet> packet,
393  const Mac48Address& source,
394  const Mac48Address& dest,
395  uint16_t protocolNumber) override;
400  void DoReceive(Ptr<Packet> packet) override;
401 
406  void ProcessDlMap(const DlMap& dlmap);
411  void ProcessUlMap(const UlMap& ulmap);
416  void ProcessDcd(const Dcd& dcd);
421  void ProcessUcd(const Ucd& ucd);
422 
423  // parameters defined in Table 342
441 
442  // parameters obtained from DL-MAP
443  uint8_t m_dcdCount;
445 
446  // parameters obtained from UL-MAP
447  uint8_t m_ucdCount;
449 
450  // to keep the number of DL-MAP/UL-MAP IEs found in the last DL-MAP/U-MAP messages
451  uint16_t m_nrDlMapElements;
452  uint16_t m_nrUlMapElements;
453 
456 
462 
463  uint32_t m_nrDlMapRecvd;
464  uint32_t m_nrUlMapRecvd;
465  uint32_t m_nrDcdRecvd;
466  uint32_t m_nrUcdRecvd;
467 
470 
471  /*represents the (least robust) modulation type of the SS which it then requests in RNG-REQ and
472  if accepted by BS uses it for receiving and transmitting. currently it is set by user in
473  simulation script, shall actually be determined based on SS's distance, power, signal etc*/
475 
478 
482 
485 
493 
501 
510 
519 
527 
534 };
535 
536 } // namespace ns3
537 
538 #endif /* WIMAX_SS_NET_DEVICE_H */
Callback template class.
Definition: callback.h:438
Cid class.
Definition: cid.h:37
This class implements Downlink channel descriptor as described by "IEEE Standard for Local and metrop...
This class implements DL-MAP as described by "IEEE Standard for Local and metropolitan area networks ...
An identifier for simulation events.
Definition: event-id.h:55
an EUI-48 address
Definition: mac48-address.h:46
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 Standard for L...
This class implements the UL burst profile as described by "IEEE Standard for Local and metropolitan ...
This class implements service flows as described by the IEEE-802.16 standard.
Definition: service-flow.h:43
SubscriberStationNetDevice subclass of WimaxNetDevice.
Definition: ss-net-device.h:50
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.
Definition: ss-net-device.h:70
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: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 ...
This class implements the UL-MAP_IE message as described by "IEEE Standard for Local and metropolitan...
Hold together all WiMAX-related objects in a NetDevice.
ModulationType
ModulationType enumeration.
Definition: wimax-phy.h:54
Every class exported by the ns3 library is enclosed in the ns3 namespace.
phy
Definition: third.py:89