A Discrete-Event Network Simulator
API
ss-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  * <amine.ismail@UDcast.com>
21  */
22 
23 #ifndef WIMAX_SS_NET_DEVICE_H
24 #define WIMAX_SS_NET_DEVICE_H
25 
26 #include "ns3/event-id.h"
27 #include "wimax-net-device.h"
28 #include "ns3/nstime.h"
29 #include "wimax-mac-header.h"
30 #include "ns3/uinteger.h"
31 #include "ns3/ss-service-flow-manager.h"
32 #include "ipcs-classifier.h"
33 
34 namespace ns3 {
35 
36 class Node;
37 class OfdmDlBurstProfile;
38 class OfdmUlBurstProfile;
39 class SSScheduler;
40 class SSLinkManager;
41 class SsServiceFlowManager;
42 class IpcsClassifier;
43 
49 {
50 public:
52  enum State
53  {
58  SS_STATE_WAITING_REG_RANG_INTRVL, // regular ranging interval
59  SS_STATE_WAITING_INV_RANG_INTRVL, // invited ranging interval
63  SS_STATE_TRANSMITTING, // currently not being used anywhere
65  };
66 
68  enum EventType
69  {
78  };
79 
84  static TypeId GetTypeId (void);
94 
102  void SetLostDlMapInterval (Time lostDlMapInterval);
106  Time GetLostDlMapInterval (void) const;
110  void SetLostUlMapInterval (Time lostUlMapInterval);
114  Time GetLostUlMapInterval (void) const;
118  void SetMaxDcdInterval (Time maxDcdInterval);
122  Time GetMaxDcdInterval (void) const;
126  void SetMaxUcdInterval (Time maxUcdInterval);
130  Time GetMaxUcdInterval (void) const;
134  void SetIntervalT1 (Time interval1);
138  Time GetIntervalT1 (void) const;
142  void SetIntervalT2 (Time interval2);
146  Time GetIntervalT2 (void) const;
150  void SetIntervalT3 (Time interval3);
154  Time GetIntervalT3 (void) const;
158  void SetIntervalT7 (Time interval7);
162  Time GetIntervalT7 (void) const;
166  void SetIntervalT12 (Time interval12);
170  Time GetIntervalT12 (void) const;
174  void SetIntervalT20 (Time interval20);
178  Time GetIntervalT20 (void) const;
182  void SetIntervalT21 (Time interval21);
186  Time GetIntervalT21 (void) const;
190  void SetMaxContentionRangingRetries (uint8_t maxContentionRangingRetries);
194  uint8_t GetMaxContentionRangingRetries (void) const;
198  void SetBasicConnection (Ptr<WimaxConnection> basicConnection);
206  void SetPrimaryConnection (Ptr<WimaxConnection> primaryConnection);
214  Cid GetBasicCid (void) const;
218  Cid GetPrimaryCid (void) const;
219 
224  void SetModulationType (WimaxPhy::ModulationType modulationType);
232  void SetAreManagementConnectionsAllocated (bool areManagementConnectionsAllocated);
236  bool GetAreManagementConnectionsAllocated (void) const;
240  void SetAreServiceFlowsAllocated (bool areServiceFlowsAllocated);
244  bool GetAreServiceFlowsAllocated (void) const;
248  Ptr<SSScheduler> GetScheduler (void) const;
252  void SetScheduler (Ptr<SSScheduler> ssScheduler);
256  bool HasServiceFlows (void) const;
264  bool Enqueue (Ptr<Packet> packet, const MacHeaderType &hdrType, Ptr<WimaxConnection> connection);
272  void SendBurst (uint8_t uiuc,
273  uint16_t nrSymbols,
274  Ptr<WimaxConnection> connection,
276 
280  void Start (void);
284  void Stop (void);
285 
290  void AddServiceFlow (ServiceFlow *sf);
295  void AddServiceFlow (ServiceFlow sf);
304  void SetTimer (EventId eventId, EventId &event);
308  bool IsRegistered (void) const;
314  Time GetTimeToAllocation (Time deferTime);
315 
329  Ptr<SSLinkManager> GetLinkManager (void) const;
334  void SetLinkManager (Ptr<SSLinkManager> linkManager);
344 
347 
353 
359 
365 
366 private:
372 
373  void DoDispose (void);
382  bool DoSend (Ptr<Packet> packet, const Mac48Address &source, const Mac48Address &dest, uint16_t protocolNumber);
387  void DoReceive (Ptr<Packet> packet);
388 
393  void ProcessDlMap (const DlMap &dlmap);
398  void ProcessUlMap (const UlMap &ulmap);
403  void ProcessDcd (const Dcd &dcd);
408  void ProcessUcd (const Ucd &ucd);
409 
410  // parameters defined in Table 342
423 
424  // parameters obtained from DL-MAP
425  uint8_t m_dcdCount;
427 
428  // parameters obtained from UL-MAP
429  uint8_t m_ucdCount;
431 
432  // to keep the number of DL-MAP/UL-MAP IEs found in the last DL-MAP/U-MAP messages
433  uint16_t m_nrDlMapElements;
434  uint16_t m_nrUlMapElements;
435 
438 
444 
445  uint32_t m_nrDlMapRecvd;
446  uint32_t m_nrUlMapRecvd;
447  uint32_t m_nrDcdRecvd;
448  uint32_t m_nrUcdRecvd;
449 
452 
453  /*represents the (least robust) modulation type of the SS which it then requests in RNG-REQ and if accepted by BS uses it for receiving and
454  transmitting. currently it is set by user in simulation script, shall actually be determined based on SS's distance, power, signal etc*/
456 
459 
463 
465 
473 
481 
490 
499 
507 
514 };
515 
516 } // namespace ns3
517 
518 #endif /* WIMAX_SS_NET_DEVICE_H */
Callback template class.
Definition: callback.h:1279
Cid class.
Definition: cid.h:38
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:54
an EUI-48 address
Definition: mac48-address.h:44
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:40
SubscriberStationNetDevice subclass of WimaxNetDevice.
Definition: ss-net-device.h:49
void Start(void)
Start the device.
bool Enqueue(Ptr< Packet > packet, const MacHeaderType &hdrType, Ptr< WimaxConnection > connection)
Enqueue a packet into a connection queue.
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,...
Ptr< SSLinkManager > m_linkManager
link manager
Ptr< WimaxConnection > m_primaryConnection
primary connection
bool GetAreServiceFlowsAllocated(void) const
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
void DoReceive(Ptr< Packet > packet)
Receive a packet.
EventId m_dcdWaitTimeoutEvent
DCD wait timeout event.
bool DoSend(Ptr< Packet > packet, const Mac48Address &source, const Mac48Address &dest, uint16_t protocolNumber)
Send a packet.
void SetIntervalT21(Time interval21)
OfdmUlBurstProfile * m_ulBurstProfile
UL burst profile.
void SetIntervalT20(Time interval20)
Ptr< SSScheduler > m_scheduler
the scheduler
bool GetAreManagementConnectionsAllocated(void) const
void SetIpcsPacketClassifier(Ptr< IpcsClassifier > classifier)
Sets the packet classifier to be used.
void SetIntervalT1(Time interval1)
Time m_intervalT21
in seconds, time the SS searches for (decodable) DL-MAP on a given channel
void InitSubscriberStationNetDevice(void)
initializes the net device and sets the parameters to the default values
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
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.
void SetBasicConnection(Ptr< WimaxConnection > basicConnection)
AsciiTraceCallback m_asciiTxQueueDequeueCb
Bound callback to perform ASCII logging for Dequeue events.
bool m_areManagementConnectionsAllocated
are management connections allocated
Ptr< SSLinkManager > GetLinkManager(void) const
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
uint8_t GetMaxContentionRangingRetries(void) const
void SetPrimaryConnection(Ptr< WimaxConnection > primaryConnection)
Ptr< SsServiceFlowManager > GetServiceFlowManager(void) const
Time GetLostUlMapInterval(void) const
void ProcessUcd(const Ucd &ucd)
Process UCD.
void SetTimer(EventId eventId, EventId &event)
Set timer.
void Stop(void)
Stop the device.
Ptr< SSScheduler > GetScheduler(void) const
uint8_t m_maxContentionRangingRetries
maximum contention ranging retries
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
Ptr< WimaxConnection > GetBasicConnection(void) const
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)
TracedCallback< Ptr< const Packet >, Mac48Address, const Cid & > m_traceSSRx
trace SS receive callback
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.
WimaxPhy::ModulationType GetModulationType(void) const
EventId m_lostDlMapEvent
lost DL map event
void SetLostDlMapInterval(Time lostDlMapInterval)
Ptr< SsServiceFlowManager > m_serviceFlowManager
the service flow manager
void DoDispose(void)
Destructor implementation.
static TypeId GetTypeId(void)
Get the type ID.
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
Time m_intervalT3
in milliseconds, ranging Response reception timeout following the transmission of a ranging request
EventType
EventType enumeration.
Definition: ss-net-device.h:69
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
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
Time GetLostDlMapInterval(void) const
void SetModulationType(WimaxPhy::ModulationType modulationType)
Set the most efficient modulation and coding scheme (MCS) supported by the device.
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.
void AddServiceFlow(ServiceFlow *sf)
adds a new service flow
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
Ptr< WimaxConnection > GetPrimaryConnection(void) const
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
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:52
Every class exported by the ns3 library is enclosed in the ns3 namespace.
phy
Definition: third.py:93