A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
mesh-wifi-interface-mac.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 IITP RAS
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: Kirill Andreev <andreev@iitp.ru>
19  * Pavel Boyko <boyko@iitp.ru>
20  */
21 
22 #ifndef MESH_WIFI_INTERFACE_MAC_H
23 #define MESH_WIFI_INTERFACE_MAC_H
24 
25 #include <stdint.h>
26 #include <map>
27 #include "ns3/mac48-address.h"
28 #include "ns3/mgt-headers.h"
29 #include "ns3/callback.h"
30 #include "ns3/packet.h"
31 #include "ns3/nstime.h"
32 #include "ns3/wifi-remote-station-manager.h"
33 #include "ns3/regular-wifi-mac.h"
34 #include "ns3/mesh-wifi-interface-mac-plugin.h"
35 #include "ns3/event-id.h"
36 #include "qos-utils.h"
37 
38 namespace ns3 {
39 
40 class WifiMacHeader;
41 class DcaTxop;
42 class UniformRandomVariable;
55 {
56 public:
58  static TypeId GetTypeId ();
62  virtual ~MeshWifiInterfaceMac ();
63 
65  // \{
66  virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from);
67  virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to);
68  virtual bool SupportsSendFrom () const;
69  virtual void SetLinkUpCallback (Callback<void> linkUp);
70  // \}
72  // \{
75  // \}
77  // \{
79  void SetRandomStartDelay (Time interval);
81  void SetBeaconInterval (Time interval);
83  Time GetBeaconInterval () const;
89  Time GetTbtt () const;
97  void ShiftTbtt (Time shift);
98  // \}
99 
101  // \{
105  // \}
106 
114  // \{
116  uint16_t GetFrequencyChannel () const;
118  void SwitchFrequencyChannel (uint16_t new_id);
119  // \}
120 
124  bool CheckSupportedRates (SupportedRates rates) const;
128  // \{
130  uint32_t GetLinkMetric (Mac48Address peerAddress);
131  // \}
133  void Report (std::ostream &) const;
134  void ResetStats ();
136  void SetBeaconGeneration (bool enable);
138  virtual void FinishConfigureStandard (enum WifiPhyStandard standard);
147  int64_t AssignStreams (int64_t stream);
148 private:
150  void Receive (Ptr<Packet> packet, WifiMacHeader const *hdr);
153  void ForwardDown (Ptr<const Packet> packet, Mac48Address from, Mac48Address to);
155  void SendBeacon ();
157  void ScheduleNextBeacon ();
159  bool GetBeaconGeneration () const;
161  virtual void DoDispose ();
162 
163 private:
164  typedef std::vector<Ptr<MeshWifiInterfaceMacPlugin> > PluginList;
165 
166  virtual void DoInitialize ();
167 
169  // \{
178  // \}
179 
182 
189  // \{
190  struct Statistics
191  {
192  uint16_t recvBeacons;
193  uint32_t sentFrames;
194  uint32_t sentBytes;
195  uint32_t recvFrames;
196  uint32_t recvBytes;
197  void
198  Print (std::ostream & os) const;
199  Statistics ();
200  };
202  // \}
205 
208 };
209 
210 } // namespace ns3
211 
212 #endif /* MESH_WIFI_INTERFACE_MAC_H */