A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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/packet.h"
26 #include "ns3/traced-callback.h"
27 #include "ns3/mac48-address.h"
28 #include <string>
29 
30 namespace ns3 {
31 
32 class WifiRemoteStationManager;
33 class WifiChannel;
34 class WifiPhy;
35 class WifiMac;
36 
51 class WifiNetDevice : public NetDevice
52 {
53 public:
54  static TypeId GetTypeId (void);
55 
56  WifiNetDevice ();
57  virtual ~WifiNetDevice ();
58 
62  void SetMac (Ptr<WifiMac> mac);
66  void SetPhy (Ptr<WifiPhy> phy);
74  Ptr<WifiMac> GetMac (void) const;
78  Ptr<WifiPhy> GetPhy (void) const;
83 
84 
85  // inherited from NetDevice base class.
86  virtual void SetIfIndex (const uint32_t index);
87  virtual uint32_t GetIfIndex (void) const;
88  virtual Ptr<Channel> GetChannel (void) const;
89  virtual void SetAddress (Address address);
90  virtual Address GetAddress (void) const;
91  virtual bool SetMtu (const uint16_t mtu);
92  virtual uint16_t GetMtu (void) const;
93  virtual bool IsLinkUp (void) const;
94  virtual void AddLinkChangeCallback (Callback<void> callback);
95  virtual bool IsBroadcast (void) const;
96  virtual Address GetBroadcast (void) const;
97  virtual bool IsMulticast (void) const;
98  virtual Address GetMulticast (Ipv4Address multicastGroup) const;
99  virtual bool IsPointToPoint (void) const;
100  virtual bool IsBridge (void) const;
101  virtual bool Send (Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber);
102  virtual Ptr<Node> GetNode (void) const;
103  virtual void SetNode (Ptr<Node> node);
104  virtual bool NeedsArp (void) const;
106 
107  virtual Address GetMulticast (Ipv6Address addr) const;
108 
109  virtual bool SendFrom (Ptr<Packet> packet, const Address& source, const Address& dest, uint16_t protocolNumber);
111  virtual bool SupportsSendFrom (void) const;
112 
113 private:
114  // This value conforms to the 802.11 specification
115  static const uint16_t MAX_MSDU_SIZE = 2304;
116 
117  virtual void DoDispose (void);
118  virtual void DoStart (void);
119  void ForwardUp (Ptr<Packet> packet, Mac48Address from, Mac48Address to);
120  void LinkUp (void);
121  void LinkDown (void);
122  void Setup (void);
123  Ptr<WifiChannel> DoGetChannel (void) const;
124  void CompleteConfig (void);
125 
132 
135 
136  uint32_t m_ifIndex;
137  bool m_linkUp;
139  mutable uint16_t m_mtu;
141 };
142 
143 } // namespace ns3
144 
145 #endif /* WIFI_NET_DEVICE_H */