/usr/include/ns3.27/ns3/mesh-wifi-interface-mac.h is in libns3-dev 3.27+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2009 IITP RAS
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Kirill Andreev <andreev@iitp.ru>
* Pavel Boyko <boyko@iitp.ru>
*/
#ifndef MESH_WIFI_INTERFACE_MAC_H
#define MESH_WIFI_INTERFACE_MAC_H
#include <stdint.h>
#include <map>
#include "ns3/mac48-address.h"
#include "ns3/mgt-headers.h"
#include "ns3/callback.h"
#include "ns3/packet.h"
#include "ns3/nstime.h"
#include "ns3/wifi-remote-station-manager.h"
#include "ns3/regular-wifi-mac.h"
#include "ns3/mesh-wifi-interface-mac-plugin.h"
#include "ns3/event-id.h"
#include "qos-utils.h"
namespace ns3 {
class WifiMacHeader;
class DcaTxop;
class UniformRandomVariable;
/**
* \ingroup mesh
*
* \brief Basic MAC of mesh point Wi-Fi interface. Its function is extendable through plugins mechanism.
*
* Now only three output queues are used:
* - beacons (PIFS and no backoff),
* - background traffic,
* - management and priority traffic.
*
*/
class MeshWifiInterfaceMac : public RegularWifiMac
{
public:
/**
* \brief Get the type ID.
* \return the object TypeId
*/
static TypeId GetTypeId ();
/// C-tor
MeshWifiInterfaceMac ();
/// D-tor
virtual ~MeshWifiInterfaceMac ();
// Inherited from WifiMac
virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to, Mac48Address from);
virtual void Enqueue (Ptr<const Packet> packet, Mac48Address to);
virtual bool SupportsSendFrom () const;
virtual void SetLinkUpCallback (Callback<void> linkUp);
///\name Each mesh point interface must know the mesh point address
// \{
void SetMeshPointAddress (Mac48Address);
Mac48Address GetMeshPointAddress () const;
// \}
///\name Beacons
// \{
/// Set maximum initial random delay before first beacon
void SetRandomStartDelay (Time interval);
/// Set interval between two successive beacons
void SetBeaconInterval (Time interval);
/// \return interval between two beacons
Time GetBeaconInterval () const;
/**
* \brief Next beacon frame time
* \return TBTT time
*
* This is supposed to be used by any entity managing beacon collision avoidance (e.g. Peer management protocol in 802.11s)
*/
Time GetTbtt () const;
/**
* \brief Shift TBTT.
* \param shift
*
* This is supposed to be used by any entity managing beacon collision avoidance (e.g. Peer management protocol in 802.11s)
*
* \attention User of ShiftTbtt () must take care to not shift it to the past.
*/
void ShiftTbtt (Time shift);
// \}
/**
* Install plugin.
*
* \param plugin
*
* \todo return unique ID to allow user to unregister plugins
*/
void InstallPlugin (Ptr<MeshWifiInterfaceMacPlugin> plugin);
/*
* Channel center frequency = Channel starting frequency + 5 * channel_id (MHz),
* where Starting channel frequency is standard-dependent as defined in IEEE 802.11-2007 17.3.8.3.2.
*
* Number of channels to use must be limited elsewhere.
*/
/**
* Current channel Id
* \returns the frequency channel
*/
uint16_t GetFrequencyChannel () const;
/**
* Switch frequency channel.
*
* \param new_id
*/
void SwitchFrequencyChannel (uint16_t new_id);
/**
* To be used by plugins sending management frames.
*
* \param frame the management frame
* \param hdr the wifi MAC header
*/
void SendManagementFrame (Ptr<Packet> frame, const WifiMacHeader& hdr);
/**
* Check supported rates.
*
* \param rates
* \return true if rates are supported
*/
bool CheckSupportedRates (SupportedRates rates) const;
/// \return list of supported bitrates
SupportedRates GetSupportedRates () const;
///\name Metric Calculation routines:
// \{
void SetLinkMetricCallback (Callback<uint32_t, Mac48Address, Ptr<MeshWifiInterfaceMac> > cb);
uint32_t GetLinkMetric (Mac48Address peerAddress);
// \}
///\brief Statistics:
void Report (std::ostream &) const;
/// Reset statistics
void ResetStats ();
/**
* Enable/disable beacons
*
* \param enable enable / disable flag
*/
void SetBeaconGeneration (bool enable);
/**
* Get phy standard in use
*
* \returns the wifi phy standard
*/
WifiPhyStandard GetPhyStandard () const;
/**
* Finish configuration based on the WifiPhyStandard being provided
*
* \param standard the WifiPhyStandard being configured
*/
virtual void FinishConfigureStandard (enum WifiPhyStandard standard);
/**
* Assign a fixed random variable stream number to the random variables
* used by this model. Return the number of streams (possibly zero) that
* have been assigned.
*
* \param stream first stream index to use
* \return the number of stream indices assigned by this model
*/
int64_t AssignStreams (int64_t stream);
private:
/**
* Frame receive handler
*
* \param packet the received packet
* \param hdr the wifi MAC header
*/
void Receive (Ptr<Packet> packet, WifiMacHeader const *hdr);
/**
* Send frame. Frame is supposed to be tagged by routing information.
*
* \param packet the packet to forward
* \param from the from address
* \param to the to address
*/
void ForwardDown (Ptr<const Packet> packet, Mac48Address from, Mac48Address to);
/// Send beacon
void SendBeacon ();
/// Schedule next beacon
void ScheduleNextBeacon ();
/**
* Get current beaconing status
*
* \returns true if beacon active
*/
bool GetBeaconGeneration () const;
/// Real d-tor
virtual void DoDispose ();
private:
typedef std::vector<Ptr<MeshWifiInterfaceMacPlugin> > PluginList; ///< PluginList typedef
virtual void DoInitialize ();
///\name Mesh timing intervals
// \{
/// whether beaconing is enabled
bool m_beaconEnable;
/// Beaconing interval.
Time m_beaconInterval;
/// Maximum delay before first beacon
Time m_randomStart;
/// Time for the next frame
Time m_tbtt;
// \}
/// Mesh point address
Mac48Address m_mpAddress;
/// "Timer" for the next beacon
EventId m_beaconSendEvent;
/// List of all installed plugins
PluginList m_plugins;
Callback<uint32_t, Mac48Address, Ptr<MeshWifiInterfaceMac> > m_linkMetricCallback; ///< linkMetricCallback
/// Statistics:
struct Statistics
{
uint16_t recvBeacons; ///< receive beacons
uint32_t sentFrames; ///< sent frames
uint32_t sentBytes; ///< sent bytes
uint32_t recvFrames; ///< receive frames
uint32_t recvBytes; ///< receive bytes
/**
* Print statistics.
*
* \param os
*/
void Print (std::ostream & os) const;
/// constructor
Statistics ();
};
Statistics m_stats; ///< statistics
/// Current PHY standard: needed to configure metric
WifiPhyStandard m_standard;
/// Add randomness to beacon generation
Ptr<UniformRandomVariable> m_coefficient;
};
} // namespace ns3
#endif /* MESH_WIFI_INTERFACE_MAC_H */
|