A Discrete-Event Network Simulator
API
hwmp-protocol-mac.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2008,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  * Author: Kirill Andreev <andreev@iitp.ru>
19  */
20 
21 #ifndef HWMP_STATE_H
22 #define HWMP_STATE_H
23 
24 #include "ns3/mesh-wifi-interface-mac-plugin.h"
25 #include "ns3/hwmp-protocol.h"
26 
27 namespace ns3 {
28 
29 class MeshWifiInterfaceMac;
30 class WifiActionHeader;
31 
32 namespace dot11s {
33 
34 class IePreq;
35 class IePrep;
36 class IePerr;
37 
44 {
45 public:
52  HwmpProtocolMac (uint32_t ifIndex, Ptr<HwmpProtocol> protocol);
54 
55  // Inherited from MAC plugin
57  bool Receive (Ptr<Packet> packet, const WifiMacHeader & header);
59  // Update beacon is empty, because HWMP does not know anything about beacons
60  void UpdateBeacon (MeshWifiBeacon & beacon) const {};
61  int64_t AssignStreams (int64_t stream);
62 
63 private:
65  friend class HwmpProtocol;
72 
76  void SendPreq (IePreq preq);
81  void SendPreq (std::vector<IePreq> preq);
87  void SendPrep (IePrep prep, Mac48Address receiver);
93  void ForwardPerr (std::vector<HwmpProtocol::FailedDestination> destinations, std::vector<Mac48Address> receivers);
99  void InitiatePerr (std::vector<HwmpProtocol::FailedDestination> destinations, std::vector<Mac48Address> receivers);
107  void RequestDestination (Mac48Address dest, uint32_t originator_seqno, uint32_t dst_seqno);
109 
111  void SendMyPreq ();
113  void SendMyPerr ();
118  uint32_t GetLinkMetric (Mac48Address peerAddress) const;
123  uint16_t GetChannelId () const;
128  void Report (std::ostream & os) const;
130  void ResetStats ();
131 private:
133  uint32_t m_ifIndex;
135 
139  std::vector<IePreq> m_myPreq;
140 
146  struct MyPerr {
147  std::vector<HwmpProtocol::FailedDestination> destinations;
148  std::vector<Mac48Address> receivers;
149  };
151 
155 
159  struct Statistics
160  {
161  uint16_t txPreq;
162  uint16_t rxPreq;
163  uint16_t txPrep;
164  uint16_t rxPrep;
165  uint16_t txPerr;
166  uint16_t rxPerr;
167  uint16_t txMgt;
168  uint32_t txMgtBytes;
169  uint16_t rxMgt;
170  uint32_t rxMgtBytes;
171  uint16_t txData;
172  uint32_t txDataBytes;
173  uint16_t rxData;
174  uint32_t rxDataBytes;
175 
179  void Print (std::ostream & os) const;
180  Statistics ();
181  };
182 
184 
186 private:
194  bool ReceiveData (Ptr<Packet> packet, const WifiMacHeader & header);
202  bool ReceiveAction (Ptr<Packet> packet, const WifiMacHeader & header);
203 };
204 } // namespace dot11s
205 } // namespace ns3
206 #endif
ns3::MeshWifiInterfaceMacPlugin
Common interface for mesh point interface MAC plugins.
Definition: mesh-wifi-interface-mac-plugin.h:41
ns3::dot11s::HwmpProtocolMac::m_ifIndex
uint32_t m_ifIndex
IF index.
Definition: hwmp-protocol-mac.h:133
ns3::dot11s::HwmpProtocolMac::GetChannelId
uint16_t GetChannelId() const
Get the channel ID.
Definition: hwmp-protocol-mac.cc:451
ns3::dot11s::HwmpProtocolMac::SendMyPreq
void SendMyPreq()
Sends one PREQ when PreqMinInterval after last PREQ expires (if any PREQ exists in rhe queue)
Definition: hwmp-protocol-mac.cc:288
ns3::dot11s::HwmpProtocolMac::ReceiveData
bool ReceiveData(Ptr< Packet > packet, const WifiMacHeader &header)
Receive data frame.
Definition: hwmp-protocol-mac.cc:56
ns3::dot11s::HwmpProtocolMac::m_perrTimer
EventId m_perrTimer
PERR.
Definition: hwmp-protocol-mac.h:144
ns3::dot11s::HwmpProtocolMac::GetLinkMetric
uint32_t GetLinkMetric(Mac48Address peerAddress) const
Definition: hwmp-protocol-mac.cc:446
ns3::EventId
An identifier for simulation events.
Definition: event-id.h:54
ns3::dot11s::HwmpProtocolMac::~HwmpProtocolMac
~HwmpProtocolMac()
Definition: hwmp-protocol-mac.cc:45
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::dot11s::HwmpProtocolMac::MyPerr
MyPerr structure.
Definition: hwmp-protocol-mac.h:146
ns3::dot11s::HwmpProtocolMac::SetParent
void SetParent(Ptr< MeshWifiInterfaceMac > parent)
Each plugin must be installed on an interface to work.
Definition: hwmp-protocol-mac.cc:49
ns3::dot11s::HwmpProtocolMac::UpdateOutcomingFrame
bool UpdateOutcomingFrame(Ptr< Packet > packet, WifiMacHeader &header, Mac48Address from, Mac48Address to)
Update frame before it will be forwarded down.
Definition: hwmp-protocol-mac.cc:192
ns3::dot11s::HwmpProtocolMac::ReceiveAction
bool ReceiveAction(Ptr< Packet > packet, const WifiMacHeader &header)
Receive action management frame.
Definition: hwmp-protocol-mac.cc:98
ns3::dot11s::HwmpProtocolMac::Statistics::rxMgt
uint16_t rxMgt
receive management
Definition: hwmp-protocol-mac.h:169
ns3::Mac48Address
an EUI-48 address
Definition: mac48-address.h:44
ns3::dot11s::HwmpProtocolMac::SendMyPerr
void SendMyPerr()
Send PERR function.
Definition: hwmp-protocol-mac.cc:433
ns3::dot11s::HwmpProtocolMac::Statistics::rxPreq
uint16_t rxPreq
receive PREQ
Definition: hwmp-protocol-mac.h:162
ns3::dot11s::HwmpProtocolMac::Statistics::txMgt
uint16_t txMgt
transmit management
Definition: hwmp-protocol-mac.h:167
ns3::dot11s::HwmpProtocolMac::InitiatePerr
void InitiatePerr(std::vector< HwmpProtocol::FailedDestination > destinations, std::vector< Mac48Address > receivers)
initiate my own path error
Definition: hwmp-protocol-mac.cc:384
ns3::dot11s::HwmpProtocolMac::Statistics::rxPrep
uint16_t rxPrep
receive PREP
Definition: hwmp-protocol-mac.h:164
ns3::dot11s::HwmpProtocolMac::Statistics::Print
void Print(std::ostream &os) const
Print function.
Definition: hwmp-protocol-mac.cc:461
ns3::MeshWifiBeacon
Beacon is beacon header + list of arbitrary information elements.
Definition: mesh-wifi-beacon.h:41
ns3::dot11s::HwmpProtocolMac::ForwardPerr
void ForwardPerr(std::vector< HwmpProtocol::FailedDestination > destinations, std::vector< Mac48Address > receivers)
Forward a path error.
Definition: hwmp-protocol-mac.cc:330
ns3::WifiMacHeader
Implements the IEEE 802.11 MAC header.
Definition: wifi-mac-header.h:85
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
ns3::WifiActionHeader
See IEEE 802.11 chapter 7.3.1.11 Header format: | category: 1 | action value: 1 |.
Definition: mgt-headers.h:885
ns3::dot11s::HwmpProtocolMac::AssignStreams
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: hwmp-protocol-mac.cc:495
ns3::dot11s::HwmpProtocolMac::Statistics::rxMgtBytes
uint32_t rxMgtBytes
receive management bytes
Definition: hwmp-protocol-mac.h:170
ns3::dot11s::IePreq
See 7.3.2.96 of 802.11s draft 2.07.
Definition: ie-dot11s-preq.h:103
ns3::dot11s::HwmpProtocolMac::RequestDestination
void RequestDestination(Mac48Address dest, uint32_t originator_seqno, uint32_t dst_seqno)
Request a destination.
Definition: hwmp-protocol-mac.cc:264
ns3::dot11s::HwmpProtocolMac::ResetStats
void ResetStats()
Reset statistics.
Definition: hwmp-protocol-mac.cc:488
ns3::dot11s::HwmpProtocolMac::SendPreq
void SendPreq(IePreq preq)
Send PREQ function.
Definition: hwmp-protocol-mac.cc:226
ns3::dot11s::HwmpProtocolMac::m_myPerr
MyPerr m_myPerr
PERR.
Definition: hwmp-protocol-mac.h:150
ns3::dot11s::HwmpProtocolMac::m_protocol
Ptr< HwmpProtocol > m_protocol
protocol
Definition: hwmp-protocol-mac.h:134
ns3::dot11s::HwmpProtocolMac::MyPerr::destinations
std::vector< HwmpProtocol::FailedDestination > destinations
destinations
Definition: hwmp-protocol-mac.h:147
ns3::dot11s::HwmpProtocolMac::Statistics
Statistics structure.
Definition: hwmp-protocol-mac.h:160
ns3::dot11s::HwmpProtocol
Hybrid wireless mesh protocol – a mesh routing protocol defined in IEEE 802.11-2012 standard.
Definition: hwmp-protocol.h:63
ns3::dot11s::HwmpProtocolMac::MyPerr::receivers
std::vector< Mac48Address > receivers
receivers
Definition: hwmp-protocol-mac.h:148
ns3::dot11s::HwmpProtocolMac::Statistics::rxData
uint16_t rxData
receive data
Definition: hwmp-protocol-mac.h:173
ns3::dot11s::HwmpProtocolMac::SendPrep
void SendPrep(IePrep prep, Mac48Address receiver)
Send PREP function.
Definition: hwmp-protocol-mac.cc:306
ns3::dot11s::HwmpProtocolMac::Receive
bool Receive(Ptr< Packet > packet, const WifiMacHeader &header)
Process received frame.
Definition: hwmp-protocol-mac.cc:172
ns3::dot11s::HwmpProtocolMac
Interface MAC plugin for HWMP – 802.11s routing protocol.
Definition: hwmp-protocol-mac.h:44
ns3::dot11s::HwmpProtocolMac::m_parent
Ptr< MeshWifiInterfaceMac > m_parent
parent
Definition: hwmp-protocol-mac.h:132
ns3::dot11s::HwmpProtocolMac::Statistics::txData
uint16_t txData
transmit data
Definition: hwmp-protocol-mac.h:171
ns3::dot11s::HwmpProtocolMac::m_preqTimer
EventId m_preqTimer
Timer for PREQs.
Definition: hwmp-protocol-mac.h:138
ns3::dot11s::HwmpProtocolMac::m_myPreq
std::vector< IePreq > m_myPreq
container of PREQs
Definition: hwmp-protocol-mac.h:139
ns3::dot11s::IePrep
See 7.3.2.97 of 802.11s draft 2.07.
Definition: ie-dot11s-prep.h:34
ns3::dot11s::HwmpProtocolMac::Statistics::txPrep
uint16_t txPrep
transmit PREP
Definition: hwmp-protocol-mac.h:163
ns3::dot11s::HwmpProtocolMac::Statistics::txMgtBytes
uint32_t txMgtBytes
transmit management bytes
Definition: hwmp-protocol-mac.h:168
ns3::dot11s::HwmpProtocolMac::Statistics::Statistics
Statistics()
Definition: hwmp-protocol-mac.cc:455
ns3::dot11s::HwmpProtocolMac::Statistics::txDataBytes
uint32_t txDataBytes
transmit data bytes
Definition: hwmp-protocol-mac.h:172
ns3::dot11s::HwmpProtocolMac::GetWifiActionHeader
static WifiActionHeader GetWifiActionHeader()
Definition: hwmp-protocol-mac.cc:217
ns3::dot11s::HwmpProtocolMac::UpdateBeacon
void UpdateBeacon(MeshWifiBeacon &beacon) const
Update beacon before it will be formed and sent.
Definition: hwmp-protocol-mac.h:60
ns3::dot11s::HwmpProtocolMac::Report
void Report(std::ostream &os) const
Report statistics.
Definition: hwmp-protocol-mac.cc:480
ns3::dot11s::HwmpProtocolMac::HwmpProtocolMac
HwmpProtocolMac(uint32_t ifIndex, Ptr< HwmpProtocol > protocol)
Constructor.
Definition: hwmp-protocol-mac.cc:40
ns3::dot11s::HwmpProtocolMac::Statistics::txPerr
uint16_t txPerr
transmit PERR
Definition: hwmp-protocol-mac.h:165
ns3::dot11s::HwmpProtocolMac::Statistics::rxDataBytes
uint32_t rxDataBytes
receive data bytes
Definition: hwmp-protocol-mac.h:174
ns3::dot11s::HwmpProtocolMac::m_stats
Statistics m_stats
statistics
Definition: hwmp-protocol-mac.h:183
ns3::dot11s::HwmpProtocolMac::Statistics::txPreq
uint16_t txPreq
transmit PREQ
Definition: hwmp-protocol-mac.h:161
ns3::dot11s::HwmpProtocolMac::Statistics::rxPerr
uint16_t rxPerr
receive PERR
Definition: hwmp-protocol-mac.h:166