A Discrete-Event Network Simulator
API
wifi-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) 2005,2006 INRIA
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  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 
21 #ifndef WIFI_NET_DEVICE_H
22 #define WIFI_NET_DEVICE_H
23 
24 #include "ns3/net-device.h"
25 #include "ns3/traced-callback.h"
26 
27 namespace ns3 {
28 
29 class WifiRemoteStationManager;
30 class WifiPhy;
31 class WifiMac;
32 class HtConfiguration;
33 class VhtConfiguration;
34 class HeConfiguration;
35 
37 static const uint16_t MAX_MSDU_SIZE = 2304;
38 
53 class WifiNetDevice : public NetDevice
54 {
55 public:
60  static TypeId GetTypeId (void);
61 
62  WifiNetDevice ();
63  virtual ~WifiNetDevice ();
64 
68  void SetMac (const Ptr<WifiMac> mac);
72  void SetPhy (const Ptr<WifiPhy> phy);
80  Ptr<WifiMac> GetMac (void) const;
84  Ptr<WifiPhy> GetPhy (void) const;
89 
93  void SetHtConfiguration (Ptr<HtConfiguration> htConfiguration);
101  void SetVhtConfiguration (Ptr<VhtConfiguration> vhtConfiguration);
109  void SetHeConfiguration (Ptr<HeConfiguration> heConfiguration);
114 
115  //inherited from NetDevice base class.
116  void SetIfIndex (const uint32_t index);
117  uint32_t GetIfIndex (void) const;
118  Ptr<Channel> GetChannel (void) const;
119  void SetAddress (Address address);
120  Address GetAddress (void) const;
121  bool SetMtu (const uint16_t mtu);
122  uint16_t GetMtu (void) const;
123  bool IsLinkUp (void) const;
124  void AddLinkChangeCallback (Callback<void> callback);
125  bool IsBroadcast (void) const;
126  Address GetBroadcast (void) const;
127  bool IsMulticast (void) const;
128  Address GetMulticast (Ipv4Address multicastGroup) const;
129  bool IsPointToPoint (void) const;
130  bool IsBridge (void) const;
131  bool Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber);
132  Ptr<Node> GetNode (void) const;
133  void SetNode (const Ptr<Node> node);
134  bool NeedsArp (void) const;
136  Address GetMulticast (Ipv6Address addr) const;
137  bool SendFrom (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber);
139  bool SupportsSendFrom (void) const;
140 
141 
142 protected:
143  void DoDispose (void);
144  void DoInitialize (void);
153  void ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to);
154 
155 
156 private:
163  WifiNetDevice (const WifiNetDevice &o);
164 
173 
178  void LinkUp (void);
182  void LinkDown (void);
187  void CompleteConfig (void);
188 
198 
201 
202  uint32_t m_ifIndex;
203  bool m_linkUp;
205  mutable uint16_t m_mtu;
207 };
208 
209 } //namespace ns3
210 
211 #endif /* WIFI_NET_DEVICE_H */
bool m_linkUp
link up
bool SetMtu(const uint16_t mtu)
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
TracedCallback< Ptr< const Packet >, Mac48Address > m_txLogger
transmit trace callback
Ptr< HeConfiguration > GetHeConfiguration(void) const
void LinkUp(void)
Set that the link is up.
Ptr< HeConfiguration > m_heConfiguration
the HeConfiguration
Address GetMulticast(Ipv4Address multicastGroup) const
Make and return a MAC multicast address using the provided multicast group.
Forward calls to a chain of Callback.
Ptr< WifiRemoteStationManager > m_stationManager
the station manager
void SetHtConfiguration(Ptr< HtConfiguration > htConfiguration)
bool SupportsSendFrom(void) const
TracedCallback< Ptr< const Packet >, Mac48Address > m_rxLogger
receive trace callback
void ForwardUp(Ptr< Packet > packet, Mac48Address from, Mac48Address to)
Receive a packet from the lower layer and pass the packet up the stack.
uint32_t GetIfIndex(void) const
Address GetAddress(void) const
uint16_t GetMtu(void) const
a polymophic address class
Definition: address.h:90
phy
Definition: third.py:86
uint16_t m_mtu
MTU.
void SetHeConfiguration(Ptr< HeConfiguration > heConfiguration)
void DoDispose(void)
Destructor implementation.
Ptr< WifiRemoteStationManager > GetRemoteStationManager(void) const
void SetMac(const Ptr< WifiMac > mac)
static const uint16_t MAX_MSDU_SIZE
This value conforms to the 802.11 specification.
bool IsMulticast(void) const
Ptr< WifiMac > m_mac
the MAC
mac
Definition: third.py:92
Ptr< WifiPhy > m_phy
the phy
Address GetBroadcast(void) const
Hold together all Wifi-related objects.
Ptr< Channel > GetChannel(void) const
bool IsBroadcast(void) const
Ptr< WifiPhy > GetPhy(void) const
Every class exported by the ns3 library is enclosed in the ns3 namespace.
TracedCallback m_linkChanges
link change callback
address
Definition: first.py:37
bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
Ptr< Node > m_node
the node
an EUI-48 address
Definition: mac48-address.h:43
void DoInitialize(void)
Initialize() implementation.
uint32_t m_ifIndex
IF index.
bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber)
Describes an IPv6 address.
Definition: ipv6-address.h:49
void SetPhy(const Ptr< WifiPhy > phy)
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:40
void SetIfIndex(const uint32_t index)
Ptr< WifiMac > GetMac(void) const
NetDevice::ReceiveCallback m_forwardUp
forward up callback
bool IsBridge(void) const
Return true if the net device is acting as a bridge.
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:95
Ptr< VhtConfiguration > m_vhtConfiguration
the VhtConfiguration
Ptr< HtConfiguration > m_htConfiguration
the HtConfiguration
void AddLinkChangeCallback(Callback< void > callback)
void CompleteConfig(void)
Complete the configuration of this Wi-Fi device by connecting all lower components (e...
void SetPromiscReceiveCallback(PromiscReceiveCallback cb)
bool IsLinkUp(void) const
WifiNetDevice & operator=(const WifiNetDevice &o)
Assignment operator.
void LinkDown(void)
Set that the link is down (i.e.
Ptr< VhtConfiguration > GetVhtConfiguration(void) const
Ptr< HtConfiguration > GetHtConfiguration(void) const
a unique identifier for an interface.
Definition: type-id.h:58
void SetReceiveCallback(NetDevice::ReceiveCallback cb)
void SetVhtConfiguration(Ptr< VhtConfiguration > vhtConfiguration)
static TypeId GetTypeId(void)
Get the type ID.
NetDevice::PromiscReceiveCallback m_promiscRx
promiscious receive callback
bool m_configComplete
configuration complete
void SetNode(const Ptr< Node > node)
void SetAddress(Address address)
Set the address of this interface.
bool NeedsArp(void) const
void SetRemoteStationManager(const Ptr< WifiRemoteStationManager > manager)
Ptr< Node > GetNode(void) const