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 #include "wifi-standards.h"
27 
28 namespace ns3 {
29 
30 class WifiRemoteStationManager;
31 class WifiPhy;
32 class WifiMac;
33 class HtConfiguration;
34 class VhtConfiguration;
35 class HeConfiguration;
36 
38 static const uint16_t MAX_MSDU_SIZE = 2304;
39 
54 class WifiNetDevice : public NetDevice
55 {
56 public:
61  static TypeId GetTypeId (void);
62 
63  WifiNetDevice ();
64  virtual ~WifiNetDevice ();
65 
66  // Delete copy constructor and assignment operator to avoid misuse
67  WifiNetDevice (const WifiNetDevice &o) = delete;
69 
75  void SetStandard (WifiStandard standard);
81  WifiStandard GetStandard (void) const;
82 
86  void SetMac (const Ptr<WifiMac> mac);
90  void SetPhy (const Ptr<WifiPhy> phy);
98  Ptr<WifiMac> GetMac (void) const;
102  Ptr<WifiPhy> GetPhy (void) const;
107 
111  void SetHtConfiguration (Ptr<HtConfiguration> htConfiguration);
119  void SetVhtConfiguration (Ptr<VhtConfiguration> vhtConfiguration);
127  void SetHeConfiguration (Ptr<HeConfiguration> heConfiguration);
132 
133  void SetIfIndex (const uint32_t index) override;
134  uint32_t GetIfIndex (void) const override;
135  Ptr<Channel> GetChannel (void) const override;
136  void SetAddress (Address address) override;
137  Address GetAddress (void) const override;
138  bool SetMtu (const uint16_t mtu) override;
139  uint16_t GetMtu (void) const override;
140  bool IsLinkUp (void) const override;
141  void AddLinkChangeCallback (Callback<void> callback) override;
142  bool IsBroadcast (void) const override;
143  Address GetBroadcast (void) const override;
144  bool IsMulticast (void) const override;
145  Address GetMulticast (Ipv4Address multicastGroup) const override;
146  bool IsPointToPoint (void) const override;
147  bool IsBridge (void) const override;
148  bool Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber) override;
149  Ptr<Node> GetNode (void) const override;
150  void SetNode (const Ptr<Node> node) override;
151  bool NeedsArp (void) const override;
153  Address GetMulticast (Ipv6Address addr) const override;
154  bool SendFrom (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber) override;
156  bool SupportsSendFrom (void) const override;
157 
158 
159 protected:
160  void DoDispose (void) override;
161  void DoInitialize (void) override;
170  void ForwardUp (Ptr<const Packet> packet, Mac48Address from, Mac48Address to);
171 
172 
173 private:
178  void LinkUp (void);
182  void LinkDown (void);
187  void CompleteConfig (void);
188 
198 
201 
203  uint32_t m_ifIndex;
204  bool m_linkUp;
206  mutable uint16_t m_mtu;
208 };
209 
210 } //namespace ns3
211 
212 #endif /* WIFI_NET_DEVICE_H */
a polymophic address class
Definition: address.h:91
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:41
Describes an IPv6 address.
Definition: ipv6-address.h:50
an EUI-48 address
Definition: mac48-address.h:44
Network layer to device interface.
Definition: net-device.h:96
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
Forward calls to a chain of Callback.
a unique identifier for an interface.
Definition: type-id.h:59
Hold together all Wifi-related objects.
void ForwardUp(Ptr< const Packet > packet, Mac48Address from, Mac48Address to)
Receive a packet from the lower layer and pass the packet up the stack.
bool NeedsArp(void) const override
void LinkUp(void)
Set that the link is up.
void SetMac(const Ptr< WifiMac > mac)
Ptr< HtConfiguration > m_htConfiguration
the HtConfiguration
uint16_t GetMtu(void) const override
bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber) override
Ptr< HtConfiguration > GetHtConfiguration(void) const
bool IsMulticast(void) const override
void DoInitialize(void) override
Initialize() implementation.
void SetHeConfiguration(Ptr< HeConfiguration > heConfiguration)
bool IsBroadcast(void) const override
void LinkDown(void)
Set that the link is down (i.e.
void SetHtConfiguration(Ptr< HtConfiguration > htConfiguration)
Ptr< WifiMac > GetMac(void) const
bool SetMtu(const uint16_t mtu) override
bool IsPointToPoint(void) const override
Return true if the net device is on a point-to-point link.
uint32_t m_ifIndex
IF index.
Ptr< VhtConfiguration > m_vhtConfiguration
the VhtConfiguration
bool m_configComplete
configuration complete
void SetPromiscReceiveCallback(PromiscReceiveCallback cb) override
void SetIfIndex(const uint32_t index) override
TracedCallback< Ptr< const Packet >, Mac48Address > m_txLogger
transmit trace callback
Ptr< Channel > GetChannel(void) const override
NetDevice::ReceiveCallback m_forwardUp
forward up callback
bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber) override
Address GetAddress(void) const override
bool SupportsSendFrom(void) const override
bool IsLinkUp(void) const override
Ptr< HeConfiguration > m_heConfiguration
the HeConfiguration
WifiStandard GetStandard(void) const
Get the Wifi standard.
Address GetBroadcast(void) const override
WifiNetDevice & operator=(const WifiNetDevice &)=delete
void SetVhtConfiguration(Ptr< VhtConfiguration > vhtConfiguration)
NetDevice::PromiscReceiveCallback m_promiscRx
promiscuous receive callback
Ptr< WifiPhy > GetPhy(void) const
TracedCallback m_linkChanges
link change callback
void CompleteConfig(void)
Complete the configuration of this Wi-Fi device by connecting all lower components (e....
void SetRemoteStationManager(const Ptr< WifiRemoteStationManager > manager)
static TypeId GetTypeId(void)
Get the type ID.
void SetNode(const Ptr< Node > node) override
void SetReceiveCallback(NetDevice::ReceiveCallback cb) override
Ptr< WifiRemoteStationManager > m_stationManager
the station manager
uint32_t GetIfIndex(void) const override
Ptr< VhtConfiguration > GetVhtConfiguration(void) const
void SetAddress(Address address) override
Set the address of this interface.
Ptr< WifiPhy > m_phy
the phy
void SetStandard(WifiStandard standard)
Set the Wifi standard.
Address GetMulticast(Ipv4Address multicastGroup) const override
Make and return a MAC multicast address using the provided multicast group.
bool IsBridge(void) const override
Return true if the net device is acting as a bridge.
WifiNetDevice(const WifiNetDevice &o)=delete
Ptr< WifiRemoteStationManager > GetRemoteStationManager(void) const
Ptr< Node > m_node
the node
WifiStandard m_standard
Wifi standard.
void SetPhy(const Ptr< WifiPhy > phy)
Ptr< WifiMac > m_mac
the MAC
TracedCallback< Ptr< const Packet >, Mac48Address > m_rxLogger
receive trace callback
void AddLinkChangeCallback(Callback< void > callback) override
void DoDispose(void) override
Destructor implementation.
Ptr< HeConfiguration > GetHeConfiguration(void) const
Ptr< Node > GetNode(void) const override
WifiStandard
Identifies the IEEE 802.11 specifications that a Wifi device can be configured to use.
address
Definition: first.py:44
Every class exported by the ns3 library is enclosed in the ns3 namespace.
static const uint16_t MAX_MSDU_SIZE
This value conforms to the 802.11 specification.
mac
Definition: third.py:99
phy
Definition: third.py:93