A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
48 {
49 public:
50  enum State
51  {
53  SS_STATE_WAITING_REG_RANG_INTRVL, // regular ranging interval
54  SS_STATE_WAITING_INV_RANG_INTRVL, // invited ranging interval
57  };
58 
59  enum EventType
60  {
63  };
64 
65  static TypeId GetTypeId (void);
69 
77  void SetLostDlMapInterval (Time lostDlMapInterval);
78  /*
79  * \returns the time since last received DL-MAP message before downlink synchronization is considered lost
80  */
81  Time GetLostDlMapInterval (void) const;
85  void SetLostUlMapInterval (Time lostUlMapInterval);
89  Time GetLostUlMapInterval (void) const;
93  void SetMaxDcdInterval (Time maxDcdInterval);
97  Time GetMaxDcdInterval (void) const;
101  void SetMaxUcdInterval (Time maxUcdInterval);
105  Time GetMaxUcdInterval (void) const;
109  void SetIntervalT1 (Time interval1);
113  Time GetIntervalT1 (void) const;
117  void SetIntervalT2 (Time interval2);
121  Time GetIntervalT2 (void) const;
125  void SetIntervalT3 (Time interval3);
129  Time GetIntervalT3 (void) const;
133  void SetIntervalT7 (Time interval7);
137  Time GetIntervalT7 (void) const;
141  void SetIntervalT12 (Time interval12);
145  Time GetIntervalT12 (void) const;
149  void SetIntervalT20 (Time interval20);
153  Time GetIntervalT20 (void) const;
157  void SetIntervalT21 (Time interval21);
161  Time GetIntervalT21 (void) const;
165  void SetMaxContentionRangingRetries (uint8_t maxContentionRangingRetries);
169  uint8_t GetMaxContentionRangingRetries (void) const;
173  void SetBasicConnection (Ptr<WimaxConnection> basicConnection);
181  void SetPrimaryConnection (Ptr<WimaxConnection> primaryConnection);
189  Cid GetBasicCid (void) const;
193  Cid GetPrimaryCid (void) const;
194 
199  void SetModulationType (WimaxPhy::ModulationType modulationType);
207  void SetAreManagementConnectionsAllocated (bool areManagementConnectionsAllocated);
211  bool GetAreManagementConnectionsAllocated (void) const;
215  void SetAreServiceFlowsAllocated (bool areServiceFlowsAllocated);
219  bool GetAreServiceFlowsAllocated (void) const;
223  Ptr<SSScheduler> GetScheduler (void) const;
227  void SetScheduler (Ptr<SSScheduler> ssScheduler);
231  bool HasServiceFlows (void) const;
238  bool Enqueue (Ptr<Packet> packet, const MacHeaderType &hdrType, Ptr<WimaxConnection> connection);
242  void SendBurst (uint8_t uiuc,
243  uint16_t nrSymbols,
244  Ptr<WimaxConnection> connection,
246 
247  void Start (void);
248  void Stop (void);
249 
253  void AddServiceFlow (ServiceFlow *sf);
257  void AddServiceFlow (ServiceFlow sf);
258  void SetTimer (EventId eventId, EventId &event);
262  bool IsRegistered (void) const;
263  Time GetTimeToAllocation (Time defferTime);
264 
277  Ptr<SSLinkManager> GetLinkManager (void) const;
290 
291 private:
293 
294  void DoDispose (void);
295  bool DoSend (Ptr<Packet> packet, const Mac48Address &source, const Mac48Address &dest, uint16_t protocolNumber);
296  void DoReceive (Ptr<Packet> packet);
297 
298  void ProcessDlMap (const DlMap &dlmap);
299  void ProcessUlMap (const UlMap &ulmap);
300  void ProcessDcd (const Dcd &dcd);
301  void ProcessUcd (const Ucd &ucd);
302 
303  // parameters defined in Table 342
304  Time m_lostDlMapInterval; // in milliseconds, time since last received DL-MAP before downlink synchronization is considered lost, maximum is 600
305  Time m_lostUlMapInterval; // in milliseconds, time since last received UL-MAP before uplink synchronization is considered lost, maximum is 600
306  Time m_maxDcdInterval; // in seconds, maximum time between transmission of DCD messages
307  Time m_maxUcdInterval; // in seconds, maximum time between transmission of UCD messages
308  Time m_intervalT1; // in seconds, wait for DCD timeout
309  Time m_intervalT2; // in seconds, wait for broadcast ranging timeout, i.e., wait for initial ranging opportunity
310  Time m_intervalT3; // in milliseconds, ranging Response reception timeout following the transmission of a ranging request
311  Time m_intervalT7; // in seconds, wait for DSA/DSC/DSD Response timeout
312  Time m_intervalT12; // in seconds, wait for UCD descriptor
313  Time m_intervalT20; // in seconds, time the SS searches for preambles on a given channel
314  Time m_intervalT21; // in seconds, time the SS searches for (decodable) DL-MAP on a given channel
316 
317  // parameters obtained from DL-MAP
318  uint8_t m_dcdCount;
320 
321  // parameters obtained from UL-MAP
322  uint8_t m_ucdCount;
324 
325  // to keep the number of DL-MAP/UL-MAP IEs found in the last DL-MAP/U-MAP messages
328 
331 
333 
334  uint32_t m_nrDlMapRecvd;
335  uint32_t m_nrUlMapRecvd;
336  uint32_t m_nrDcdRecvd;
337  uint32_t m_nrUcdRecvd;
338 
341 
342  /*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
343  transmiting. currently it is set by user in simulation script, shall actually be determined based on SS's distance, power, signal etc*/
345 
348 
352 
355 
363 
371 
380 
389 
397 };
398 
399 } // namespace ns3
400 
401 #endif /* WIMAX_SS_NET_DEVICE_H */
HeaderType
this class implements the mac header type field.
void SetIntervalT3(Time interval3)
void SetTimer(EventId eventId, EventId &event)
keep track of time values and allow control of global simulation resolution
Definition: nstime.h:81
void SetIntervalT1(Time interval1)
Time GetIntervalT2(void) const
returns the wait for broadcast ranging timeout, i.e., wait for initial ranging opportunity ...
static Time GetDefaultLostDlMapInterval()
Doxygen introspection did not find any typical Config paths.
void SetLostDlMapInterval(Time lostDlMapInterval)
void ProcessUcd(const Ucd &ucd)
Time GetMaxUcdInterval(void) const
returns the maximum time between transmission of UCD messages
void ProcessDcd(const Dcd &dcd)
void SetIntervalT21(Time interval21)
Ptr< WimaxConnection > m_basicConnection
Ptr< WimaxConnection > m_primaryConnection
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 CallbackAn ns3::TracedCallback has almost exactly the same API as a norma...
bool GetAreManagementConnectionsAllocated(void) const
void ProcessDlMap(const DlMap &dlmap)
void SetMaxDcdInterval(Time maxDcdInterval)
void SetAreManagementConnectionsAllocated(bool areManagementConnectionsAllocated)
Time GetIntervalT7(void) const
returns the wait for DSA/DSC/DSD Response timeout
void SetLostUlMapInterval(Time lostUlMapInterval)
Time GetLostUlMapInterval(void) const
returns the time since last received UL-MAP before uplink synchronization is considered lost ...
void SetScheduler(Ptr< SSScheduler > ssScheduler)
void SetMaxUcdInterval(Time maxUcdInterval)
Time GetIntervalT12(void) const
returns the wait for UCD descriptor timeout
Ptr< IpcsClassifier > GetIpcsClassifier() 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
void ProcessUlMap(const UlMap &ulmap)
TracedCallback< Ptr< const PacketBurst >, Mac48Address, Cid *, WimaxPhy::ModulationType > m_traceSSTx
Ptr< SSScheduler > GetScheduler(void) const
void DoReceive(Ptr< Packet > packet)
TracedCallback< Ptr< const Packet > > m_ssRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
void SetIntervalT20(Time interval20)
void SetMaxContentionRangingRetries(uint8_t maxContentionRangingRetries)
void SetIntervalT12(Time interval12)
bool DoSend(Ptr< Packet > packet, const Mac48Address &source, const Mac48Address &dest, uint16_t protocolNumber)
bool Enqueue(Ptr< Packet > packet, const MacHeaderType &hdrType, Ptr< WimaxConnection > connection)
Enqueue a packet into a connection queue.
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 ...
Doxygen introspection did not find any typical Config paths.
Time GetTimeToAllocation(Time defferTime)
Ptr< SsServiceFlowManager > m_serviceFlowManager
Ptr< SSLinkManager > GetLinkManager(void) const
TracedCallback< Ptr< const Packet > > m_ssTxTrace
The trace source fired when packets come into the "top" of the device at the L3/L2 transition...
Doxygen introspection did not find any typical Config paths.
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.
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 ...
Hold together all Wimax-related objects in a NetDevice.
static TypeId GetTypeId(void)
Definition: cid.h:35
void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
WimaxPhy::ModulationType GetModulationType(void) const
returns the most efficient modulation and coding scheme (MCS) supported by the device ...
an EUI-48 address
Definition: mac48-address.h:41
This class implements service flows as described by the IEEE-802.16 standard.
Definition: service-flow.h:39
Ptr< SSLinkManager > m_linkManager
void SetBasicConnection(Ptr< WimaxConnection > basicConnection)
Ptr< WimaxConnection > GetBasicConnection(void) const
void SetAreServiceFlowsAllocated(bool areServiceFlowsAllocated)
Time GetIntervalT21(void) const
returns the time the SS searches for (decodable) DL-MAP on a given channel
void SetLinkManager(Ptr< SSLinkManager >)
sets the link manager to be used
an identifier for simulation events.
Definition: event-id.h:46
Time GetIntervalT1(void) const
returns the wait for DCD timeout
Doxygen introspection did not find any typical Config paths.
Time GetMaxDcdInterval(void) const
returns the maximum time between transmission of DCD messages
void SetIntervalT7(Time interval7)
OfdmDlBurstProfile * m_dlBurstProfile
Time GetLostDlMapInterval(void) const
Time GetIntervalT20(void) const
returns the Time the SS searches for preambles on a given channel
void SetServiceFlowManager(Ptr< SsServiceFlowManager >)
Sets the service flow manager to be installed on the device.
Ptr< IpcsClassifier > m_classifier
void InitSubscriberStationNetDevice(void)
initializes the net device and sets the parameters to the default values
WimaxPhy::ModulationType m_modulationType
OfdmUlBurstProfile * m_ulBurstProfile
void SetIpcsPacketClassifier(Ptr< IpcsClassifier >)
Sets the packet classifier to be used.
Ptr< SsServiceFlowManager > GetServiceFlowManager(void) const
void AddServiceFlow(ServiceFlow *sf)
adds a new service flow
a unique identifier for an interface.
Definition: type-id.h:49
TracedCallback< Ptr< const Packet >, Mac48Address, Cid * > m_traceSSRx
void SetPrimaryConnection(Ptr< WimaxConnection > primaryConnection)
uint8_t GetMaxContentionRangingRetries(void) const
Ptr< WimaxConnection > GetPrimaryConnection(void) const
returns the primary connection currently usde
bool GetAreServiceFlowsAllocated(void) const
Time GetIntervalT3(void) const
returns the ranging Response reception timeout following the transmission of a ranging request ...