A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
hwmp-protocol-mac.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008,2009 IITP RAS
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation;
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 *
17 * Author: Kirill Andreev <andreev@iitp.ru>
18 */
19
20#ifndef HWMP_STATE_H
21#define HWMP_STATE_H
22
23#include "ns3/hwmp-protocol.h"
24#include "ns3/mesh-wifi-interface-mac-plugin.h"
25
26namespace ns3
27{
28
29class MeshWifiInterfaceMac;
30class WifiActionHeader;
31
32namespace dot11s
33{
34
35class IePreq;
36class IePrep;
37class IePerr;
38
45{
46 public:
54 ~HwmpProtocolMac() override;
55
56 // Inherited from MAC plugin
57 void SetParent(Ptr<MeshWifiInterfaceMac> parent) override;
58 bool Receive(Ptr<Packet> packet, const WifiMacHeader& header) override;
60 WifiMacHeader& header,
61 Mac48Address from,
62 Mac48Address to) override;
63 // Update beacon is empty, because HWMP does not know anything about beacons
64 void UpdateBeacon(MeshWifiBeacon& beacon) const override{};
65 int64_t AssignStreams(int64_t stream) override;
66
67 private:
69 friend class HwmpProtocol;
76
80 void SendPreq(IePreq preq);
85 void SendPreqVector(std::vector<IePreq> preq);
91 void SendPrep(IePrep prep, Mac48Address receiver);
97 void ForwardPerr(std::vector<HwmpProtocol::FailedDestination> destinations,
98 std::vector<Mac48Address> receivers);
104 void InitiatePerr(std::vector<HwmpProtocol::FailedDestination> destinations,
105 std::vector<Mac48Address> receivers);
113 void RequestDestination(Mac48Address dest, uint32_t originator_seqno, uint32_t dst_seqno);
115
118 void SendMyPreq();
120 void SendMyPerr();
125 uint32_t GetLinkMetric(Mac48Address peerAddress) const;
130 uint16_t GetChannelId() const;
135 void Report(std::ostream& os) const;
137 void ResetStats();
138
139 private:
143
147 std::vector<IePreq> m_myPreq;
149
153
155 struct MyPerr
156 {
157 std::vector<HwmpProtocol::FailedDestination> destinations;
158 std::vector<Mac48Address> receivers;
159 };
160
162
164
167
172 {
173 uint16_t txPreq;
174 uint16_t rxPreq;
175 uint16_t txPrep;
176 uint16_t rxPrep;
177 uint16_t txPerr;
178 uint16_t rxPerr;
179 uint16_t txMgt;
181 uint16_t rxMgt;
183 uint16_t txData;
185 uint16_t rxData;
191 void Print(std::ostream& os) const;
192 Statistics();
193 };
194
197
198 private:
206 bool ReceiveData(Ptr<Packet> packet, const WifiMacHeader& header);
214 bool ReceiveAction(Ptr<Packet> packet, const WifiMacHeader& header);
215};
216} // namespace dot11s
217} // namespace ns3
218#endif
An identifier for simulation events.
Definition: event-id.h:55
an EUI-48 address
Definition: mac48-address.h:46
Beacon is beacon header + list of arbitrary information elements.
Common interface for mesh point interface MAC plugins.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
See IEEE 802.11 chapter 7.3.1.11 Header format: | category: 1 | action value: 1 |.
Definition: mgt-headers.h:539
Implements the IEEE 802.11 MAC header.
Hybrid wireless mesh protocol – a mesh routing protocol defined in IEEE 802.11-2012 standard.
Definition: hwmp-protocol.h:68
Interface MAC plugin for HWMP – 802.11s routing protocol.
static WifiActionHeader GetWifiActionHeader()
void SendMyPreq()
Sends one PREQ when PreqMinInterval after last PREQ expires (if any PREQ exists in rhe queue)
void SendPreq(IePreq preq)
Send PREQ function.
void SetParent(Ptr< MeshWifiInterfaceMac > parent) override
Each plugin must be installed on an interface to work.
void SendPreqVector(std::vector< IePreq > preq)
Send PREQ function for vector of PREQ.
void SendPrep(IePrep prep, Mac48Address receiver)
Send PREP function.
void SendMyPerr()
Send PERR function.
uint16_t GetChannelId() const
Get the channel ID.
void UpdateBeacon(MeshWifiBeacon &beacon) const override
Update beacon before it will be formed and sent.
bool Receive(Ptr< Packet > packet, const WifiMacHeader &header) override
Process received frame.
void ForwardPerr(std::vector< HwmpProtocol::FailedDestination > destinations, std::vector< Mac48Address > receivers)
Forward a path error.
Ptr< HwmpProtocol > m_protocol
protocol
bool ReceiveData(Ptr< Packet > packet, const WifiMacHeader &header)
Receive data frame.
Statistics m_stats
statistics
EventId m_preqTimer
Timer for PREQs.
void ResetStats()
Reset statistics.
uint32_t GetLinkMetric(Mac48Address peerAddress) const
bool ReceiveAction(Ptr< Packet > packet, const WifiMacHeader &header)
Receive action management frame.
void InitiatePerr(std::vector< HwmpProtocol::FailedDestination > destinations, std::vector< Mac48Address > receivers)
initiate my own path error
int64_t AssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
std::vector< IePreq > m_myPreq
container of PREQs
void Report(std::ostream &os) const
Report statistics.
bool UpdateOutcomingFrame(Ptr< Packet > packet, WifiMacHeader &header, Mac48Address from, Mac48Address to) override
Update frame before it will be forwarded down.
Ptr< MeshWifiInterfaceMac > m_parent
parent
void RequestDestination(Mac48Address dest, uint32_t originator_seqno, uint32_t dst_seqno)
Request a destination.
See 7.3.2.97 of 802.11s draft 2.07.
See 7.3.2.96 of 802.11s draft 2.07.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::vector< HwmpProtocol::FailedDestination > destinations
destinations
std::vector< Mac48Address > receivers
receivers
uint32_t txMgtBytes
transmit management bytes
void Print(std::ostream &os) const
Print function.
uint32_t txDataBytes
transmit data bytes
uint32_t rxMgtBytes
receive management bytes