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 
317 
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 */
HeaderType
Header type enumeration.
void SetIntervalT3(Time interval3)
void SetTimer(EventId eventId, EventId &event)
Set timer.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
void SetIntervalT1(Time interval1)
static Time GetDefaultLostDlMapInterval()
Get default lost DL map interval.
Time m_intervalT21
in seconds, time the SS searches for (decodable) DL-MAP on a given channel
This class implements DL-MAP as described by "IEEE Standard for Local and metropolitan area networks ...
void SetLostDlMapInterval(Time lostDlMapInterval)
void ProcessUcd(const Ucd &ucd)
Process UCD.
Callback template class.
Definition: callback.h:1278
void ProcessDcd(const Dcd &dcd)
Process DCD.
void SetIntervalT21(Time interval21)
Ptr< WimaxConnection > m_basicConnection
basic connection
Ptr< WimaxConnection > m_primaryConnection
primary connection
Callback< void, std::string, Ptr< const Packet > > AsciiTraceCallback
Callback for logging packets on ASCII traces.
void SetIntervalT2(Time interval2)
void SetModulationType(WimaxPhy::ModulationType modulationType)
Set the most efficient modulation and coding scheme (MCS) supported by the device.
Forward calls to a chain of Callback.
void ProcessDlMap(const DlMap &dlmap)
Process DL map.
EventId m_lostUlMapEvent
lost UL map event
void SetMaxDcdInterval(Time maxDcdInterval)
void SetAsciiTxQueueDequeueCallback(AsciiTraceCallback cb)
Set the Dequeue callback for ASCII tracing.
void SetAreManagementConnectionsAllocated(bool areManagementConnectionsAllocated)
uint32_t m_nrUcdRecvd
number UCD received
void SetLostUlMapInterval(Time lostUlMapInterval)
Ptr< IpcsClassifier > GetIpcsClassifier() const
void SetAsciiTxQueueDropCallback(AsciiTraceCallback cb)
Set the Drop callback for ASCII tracing.
This class implements the UL burst profile as described by "IEEE Standard for Local and metropolitan ...
void SetScheduler(Ptr< SSScheduler > ssScheduler)
Time m_lostDlMapInterval
in milliseconds, time since last received DL-MAP before downlink synchronization is considered lost...
void SetMaxUcdInterval(Time maxUcdInterval)
void Start(void)
Start the device.
Time GetLostDlMapInterval(void) const
Mac48Address m_baseStationId
base station ID
Ptr< SsServiceFlowManager > GetServiceFlowManager(void) const
TracedCallback< Ptr< const Packet > > m_ssPromiscRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
Ptr< SSScheduler > m_scheduler
the scheduler
void ProcessUlMap(const UlMap &ulmap)
Process UL map.
bool m_areServiceFlowsAllocated
are service flows allocated
Time m_intervalT3
in milliseconds, ranging Response reception timeout following the transmission of a ranging request ...
phy
Definition: third.py:93
void DoReceive(Ptr< Packet > packet)
Receive a packet.
TracedCallback< Ptr< const Packet > > m_ssRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
Time m_intervalT20
in seconds, time the SS searches for preambles on a given channel
uint32_t m_nrDlMapRecvd
number DL map received
Time m_intervalT7
in seconds, wait for DSA/DSC/DSD Response timeout
void SetIntervalT20(Time interval20)
EventType
EventType enumeration.
Definition: ss-net-device.h:68
void SetMaxContentionRangingRetries(uint8_t maxContentionRangingRetries)
uint8_t m_maxContentionRangingRetries
maximum contention ranging retries
double m_allocationStartTime
allocation start time
uint32_t m_nrDcdRecvd
number DCD received
void SetIntervalT12(Time interval12)
bool DoSend(Ptr< Packet > packet, const Mac48Address &source, const Mac48Address &dest, uint16_t protocolNumber)
Send a packet.
bool Enqueue(Ptr< Packet > packet, const MacHeaderType &hdrType, Ptr< WimaxConnection > connection)
Enqueue a packet into a connection queue.
bool GetAreServiceFlowsAllocated(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 ...
This class implements the UCD message as described by "IEEE Standard for Local and metropolitan area ...
Time m_intervalT12
in seconds, wait for UCD descriptor
Ptr< SsServiceFlowManager > m_serviceFlowManager
the service flow manager
TracedCallback< Ptr< const Packet > > m_ssTxTrace
The trace source fired when packets come into the "top" of the device at the L3/L2 transition...
void SetLinkManager(Ptr< SSLinkManager > linkManager)
sets the link manager to be used
EventId m_ucdWaitTimeoutEvent
UCD wait timeout event.
Ptr< WimaxConnection > GetPrimaryConnection(void) const
This class implements Downlink channel descriptor as described by "IEEE Standard for Local and metrop...
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.
This class Represents the HT (Header Type) field of generic MAC and bandwidth request headers...
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 ...
Ptr< WimaxConnection > GetBasicConnection(void) const
Time m_maxDcdInterval
in seconds, maximum time between transmission of DCD messages
Time GetLostUlMapInterval(void) const
EventId m_lostDlMapEvent
lost DL map event
AsciiTraceCallback m_asciiTxQueueDropCb
Bound callback to perform ASCII logging for Drop events.
Hold together all WiMAX-related objects in a NetDevice.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static TypeId GetTypeId(void)
Get the type ID.
Cid class.
Definition: cid.h:37
void DoDispose(void)
Destructor implementation.
Time m_lostUlMapInterval
in milliseconds, time since last received UL-MAP before uplink synchronization is considered lost...
Ptr< SSLinkManager > GetLinkManager(void) const
AsciiTraceCallback m_asciiTxQueueEnqueueCb
Bound callback to perform ASCII logging for Enqueue events.
an EUI-48 address
Definition: mac48-address.h:43
This class implements service flows as described by the IEEE-802.16 standard.
Definition: service-flow.h:39
AsciiTraceCallback m_asciiTxQueueDequeueCb
Bound callback to perform ASCII logging for Dequeue events.
Ptr< SSLinkManager > m_linkManager
link manager
void SetBasicConnection(Ptr< WimaxConnection > basicConnection)
TracedCallback< Ptr< const Packet >, Mac48Address, const Cid & > m_traceSSRx
trace SS receive callback
void SetAreServiceFlowsAllocated(bool areServiceFlowsAllocated)
bool GetAreManagementConnectionsAllocated(void) const
uint16_t m_nrDlMapElements
number DL Map elements
void SetIpcsPacketClassifier(Ptr< IpcsClassifier > classifier)
Sets the packet classifier to be used.
ModulationType
ModulationType enumeration.
Definition: wimax-phy.h:49
EventId m_rangOppWaitTimeoutEvent
range opp wait timeout event
WimaxPhy::ModulationType GetModulationType(void) const
uint8_t GetMaxContentionRangingRetries(void) const
bool m_areManagementConnectionsAllocated
are management connections allocated
An identifier for simulation events.
Definition: event-id.h:53
Time m_intervalT2
in seconds, wait for broadcast ranging timeout, i.e., wait for initial ranging opportunity ...
This class implements the UL-MAP_IE message as described by "IEEE Standard for Local and metropolitan...
void SetAsciiTxQueueEnqueueCallback(AsciiTraceCallback cb)
Set the Enqueue callback for ASCII tracing.
Ptr< SSScheduler > GetScheduler(void) const
void SetIntervalT7(Time interval7)
OfdmDlBurstProfile * m_dlBurstProfile
DL burst profile.
SubscriberStationNetDevice subclass of WimaxNetDevice.
Definition: ss-net-device.h:48
Time m_intervalT1
in seconds, wait for DCD timeout
Time m_maxUcdInterval
in seconds, maximum time between transmission of UCD messages
Ptr< IpcsClassifier > m_classifier
the classifier
void InitSubscriberStationNetDevice(void)
initializes the net device and sets the parameters to the default values
WimaxPhy::ModulationType m_modulationType
modulation type
Time GetTimeToAllocation(Time deferTime)
Get time to allocation.
OfdmUlBurstProfile * m_ulBurstProfile
UL burst profile.
void AddServiceFlow(ServiceFlow *sf)
adds a new service flow
a unique identifier for an interface.
Definition: type-id.h:58
uint16_t m_nrUlMapElements
number UL Map elements
void SetServiceFlowManager(Ptr< SsServiceFlowManager > sfm)
Sets the service flow manager to be installed on the device.
uint32_t m_nrUlMapRecvd
number UL map received
void SetPrimaryConnection(Ptr< WimaxConnection > primaryConnection)
This class implements the OFDM Downlink burst profile descriptor as described by "IEEE Standard for L...
void Stop(void)
Stop the device.
EventId m_dcdWaitTimeoutEvent
DCD wait timeout event.