A Discrete-Event Network Simulator
API
wimax-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  */
21 
22 #ifndef WIMAX_NET_DEVICE_H
23 #define WIMAX_NET_DEVICE_H
24 
25 #include "ns3/net-device.h"
26 #include "ns3/event-id.h"
27 #include "ns3/mac48-address.h"
28 #include "cid.h"
29 #include "wimax-connection.h"
30 #include "cid-factory.h"
31 #include "mac-messages.h"
32 #include "dl-mac-messages.h"
33 #include "ul-mac-messages.h"
34 #include "ns3/traced-callback.h"
35 #include "ns3/nstime.h"
36 #include "ns3/log.h"
37 #include "wimax-phy.h"
38 #include "wimax-mac-header.h"
39 
40 namespace ns3 {
41 
42 class Node;
43 class Packet;
44 class TraceContext;
45 class TraceResolver;
46 class Channel;
47 class WimaxChannel;
48 class PacketBurst;
49 class BurstProfileManager;
50 class ConnectionManager;
51 class ServiceFlowManager;
52 class BandwidthManager;
53 class UplinkScheduler;
54 
69 class WimaxNetDevice : public NetDevice
70 {
71 public:
72  enum Direction
73  {
75  };
76 
78  {
80  };
81 
82  static TypeId GetTypeId (void);
83  WimaxNetDevice (void);
84  virtual ~WimaxNetDevice (void);
88  void SetTtg (uint16_t ttg);
92  uint16_t GetTtg (void) const;
96  void SetRtg (uint16_t rtg);
100  uint16_t GetRtg (void) const;
105  void SetPhy (Ptr<WimaxPhy> phy);
109  Ptr<WimaxPhy> GetPhy (void) const;
110 
114  void SetChannel (Ptr<WimaxChannel> wimaxChannel);
115 
116  uint64_t GetChannel (uint8_t index) const;
117 
118  void SetNrFrames (uint32_t nrFrames);
119  uint32_t GetNrFrames (void) const;
127  Mac48Address GetMacAddress (void) const;
128  void SetState (uint8_t state);
129  uint8_t GetState (void) const;
138 
139  void SetCurrentDcd (Dcd dcd);
140  Dcd GetCurrentDcd (void) const;
141  void SetCurrentUcd (Ucd ucd);
142  Ucd GetCurrentUcd (void) const;
147 
151  virtual void SetConnectionManager (Ptr<ConnectionManager> connectionManager );
152 
157 
161  void SetBurstProfileManager (Ptr<BurstProfileManager> burstProfileManager);
162 
167 
171  void SetBandwidthManager (Ptr<BandwidthManager> bandwidthManager);
172 
176  void CreateDefaultConnections (void);
177 
178  virtual void Start (void) = 0;
179  virtual void Stop (void) = 0;
180 
181  void SetReceiveCallback (void);
182 
183  void ForwardUp (Ptr<Packet> packet, const Mac48Address &source, const Mac48Address &dest);
184 
185  virtual bool Enqueue (Ptr<Packet> packet, const MacHeaderType &hdrType, Ptr<WimaxConnection> connection) = 0;
186  void ForwardDown (Ptr<PacketBurst> burst, WimaxPhy::ModulationType modulationType);
187 
188  // temp, shall be private
189  static uint8_t m_direction; // downlink or uplink
190 
191  static Time m_frameStartTime; // temp, to determine the frame start time at SS side, shall actually be determined by frame start preamble
192 
193  virtual void SetName (const std::string name);
194  virtual std::string GetName (void) const;
195  virtual void SetIfIndex (const uint32_t index);
196  virtual uint32_t GetIfIndex (void) const;
197  virtual Ptr<Channel> GetPhyChannel (void) const;
198  virtual Ptr<Channel> GetChannel (void) const;
199  virtual void SetAddress (Address address);
200  virtual Address GetAddress (void) const;
201  virtual bool SetMtu (const uint16_t mtu);
202  virtual uint16_t GetMtu (void) const;
203  virtual bool IsLinkUp (void) const;
204  virtual void SetLinkChangeCallback (Callback<void> callback);
205  virtual bool IsBroadcast (void) const;
206  virtual Address GetBroadcast (void) const;
207  virtual bool IsMulticast (void) const;
208  virtual Address GetMulticast (void) const;
209  virtual Address MakeMulticastAddress (Ipv4Address multicastGroup) const;
210  virtual bool IsPointToPoint (void) const;
211  virtual bool Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber);
212  virtual void SetNode (Ptr<Node> node);
213  virtual Ptr<Node> GetNode (void) const;
214  virtual bool NeedsArp (void) const;
216  virtual void AddLinkChangeCallback (Callback<void> callback);
217  virtual bool SendFrom (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber);
220  virtual bool SupportsSendFrom (void) const;
221 
232  typedef void (* TxRxTracedCallback)
233  (Ptr<const Packet> packet, const Mac48Address & mac);
250 
251  virtual void DoDispose (void);
252  virtual Address GetMulticast (Ipv6Address addr) const;
253  virtual Address GetMulticast (Ipv4Address multicastGroup) const;
254  virtual bool IsBridge (void) const;
255 
256  bool IsPromisc (void);
258 
259 private:
260  WimaxNetDevice (const WimaxNetDevice &);
262 
263  static const uint16_t MAX_MSDU_SIZE = 1500;
264  // recommended by wimax forum.
265  static const uint16_t DEFAULT_MSDU_SIZE = 1400;
266 
267  virtual bool DoSend (Ptr<Packet> packet,
268  const Mac48Address& source,
269  const Mac48Address& dest,
270  uint16_t protocolNumber) = 0;
271  virtual void DoReceive (Ptr<Packet> packet) = 0;
272  virtual Ptr<WimaxChannel> DoGetChannel (void) const;
273  void Receive (Ptr<const PacketBurst> burst);
274  void InitializeChannels (void);
275 
280 
281  uint32_t m_ifIndex;
282  std::string m_name;
283  bool m_linkUp;
285  mutable uint16_t m_mtu;
286 
287  // temp, shall be in BS. defined here to allow SS to access. SS shall actually determine it from DLFP, shall be moved to BS after DLFP is implemented
288  static uint32_t m_nrFrames;
289 
290  // not sure if it shall be included here
291  std::vector<uint64_t> m_dlChannels;
292 
294  uint8_t m_state;
295  uint32_t m_symbolIndex;
296 
297  // length of TTG and RTG, in units of PSs
298  uint16_t m_ttg;
299  uint16_t m_rtg;
300 
303 
306 
310 
312 
313 };
314 
315 } // namespace ns3
316 
317 #endif /* WIMAX_NET_DEVICE_H */
tuple channel
Definition: third.py:85
void SetRtg(uint16_t rtg)
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
uint16_t GetRtg(void) const
NetDevice::PromiscReceiveCallback m_promiscRx
virtual bool DoSend(Ptr< Packet > packet, const Mac48Address &source, const Mac48Address &dest, uint16_t protocolNumber)=0
virtual ~WimaxNetDevice(void)
Forward calls to a chain of Callback.
Ptr< WimaxConnection > m_broadcastConnection
void ForwardUp(Ptr< Packet > packet, const Mac48Address &source, const Mac48Address &dest)
Ptr< BurstProfileManager > m_burstProfileManager
Callback< void > m_linkChange
Dcd GetCurrentDcd(void) const
Ptr< WimaxConnection > GetBroadcastConnection(void) const
void Receive(Ptr< const PacketBurst > burst)
Ptr< ConnectionManager > GetConnectionManager(void) const
void(* TxRxTracedCallback)(Ptr< const Packet > packet, const Mac48Address &mac)
TracedCallback signature for packet and Mac48Address.
a polymophic address class
Definition: address.h:90
static const uint16_t DEFAULT_MSDU_SIZE
virtual bool IsMulticast(void) const
uint32_t GetNrFrames(void) const
virtual void Stop(void)=0
virtual Ptr< Channel > GetChannel(void) const
virtual bool SetMtu(const uint16_t mtu)
WimaxNetDevice & operator=(const WimaxNetDevice &)
static TypeId GetTypeId(void)
tuple phy
Definition: third.py:86
virtual Address GetMulticast(void) const
uint16_t GetTtg(void) const
void SetCurrentDcd(Dcd dcd)
void SetTtg(uint16_t ttg)
Ptr< ConnectionManager > m_connectionManager
Ptr< WimaxConnection > m_initialRangingConnection
virtual void SetIfIndex(const uint32_t index)
Introspection did not find any typical Config paths.
std::vector< uint64_t > m_dlChannels
virtual Ptr< WimaxChannel > DoGetChannel(void) const
Ptr< Object > m_mobility
virtual Address GetBroadcast(void) const
Ptr< WimaxConnection > GetInitialRangingConnection(void) const
Ptr< BandwidthManager > GetBandwidthManager(void) const
static uint32_t m_nrFrames
virtual void SetPromiscReceiveCallback(PromiscReceiveCallback cb)
virtual void Start(void)=0
tuple mac
Definition: third.py:92
virtual void SetConnectionManager(Ptr< ConnectionManager > connectionManager)
Introspection did not find any typical Config paths.
Mac48Address GetMacAddress(void) const
Represents the HT (Header Type) field of generic MAC and bandwidth request headers.
virtual void DoDispose(void)
Destructor implementation.
virtual uint32_t GetIfIndex(void) const
virtual Ptr< Node > GetNode(void) const
void SetBandwidthManager(Ptr< BandwidthManager > bandwidthManager)
virtual Address GetAddress(void) const
Hold together all Wimax-related objects in a NetDevice.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
virtual void SetLinkChangeCallback(Callback< void > callback)
virtual bool IsBroadcast(void) const
void SetBurstProfileManager(Ptr< BurstProfileManager > burstProfileManager)
TracedCallback< Ptr< const Packet >, const Mac48Address & > m_traceTx
Ucd GetCurrentUcd(void) const
an EUI-48 address
Definition: mac48-address.h:43
void SetMacAddress(Mac48Address address)
virtual void DoReceive(Ptr< Packet > packet)=0
virtual bool Enqueue(Ptr< Packet > packet, const MacHeaderType &hdrType, Ptr< WimaxConnection > connection)=0
void SetChannel(Ptr< WimaxChannel > wimaxChannel)
void SetPhy(Ptr< WimaxPhy > phy)
virtual bool IsLinkUp(void) const
NetDevice::PromiscReceiveCallback GetPromiscReceiveCallback(void)
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
void NotifyPromiscTrace(Ptr< Packet > p)
virtual bool SupportsSendFrom(void) const
Ptr< BurstProfileManager > GetBurstProfileManager(void) const
Describes an IPv6 address.
Definition: ipv6-address.h:48
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:40
virtual void AddLinkChangeCallback(Callback< void > callback)
void SetNrFrames(uint32_t nrFrames)
virtual bool IsPointToPoint(void) const
Return true if the net device is on a point-to-point link.
Network layer to device interface.
Definition: net-device.h:405
virtual bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber)
void SetCurrentUcd(Ucd ucd)
virtual uint16_t GetMtu(void) const
void ForwardDown(Ptr< PacketBurst > burst, WimaxPhy::ModulationType modulationType)
Ptr< WimaxPhy > GetPhy(void) const
virtual Ptr< Channel > GetPhyChannel(void) const
void CreateDefaultConnections(void)
Creates the initial ranging and broadcast connections.
NetDevice::ReceiveCallback m_forwardUp
TracedCallback< Ptr< const Packet >, const Mac48Address & > m_traceRx
virtual Address MakeMulticastAddress(Ipv4Address multicastGroup) const
void Attach(Ptr< WimaxChannel > channel)
void SetState(uint8_t state)
virtual std::string GetName(void) const
static const uint16_t MAX_MSDU_SIZE
virtual void SetName(const std::string name)
tuple address
Definition: first.py:37
virtual void SetAddress(Address address)
Set the address of this interface.
virtual bool IsBridge(void) const
Return true if the net device is acting as a bridge.
Ptr< WimaxPhy > m_phy
virtual void SetNode(Ptr< Node > node)
virtual bool NeedsArp(void) const
Ptr< BandwidthManager > m_bandwidthManager
a unique identifier for an interface.
Definition: type-id.h:58
static Time m_frameStartTime
uint8_t GetState(void) const
static uint8_t m_direction