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 HwmpProtocol;
35 class IePreq;
36 class IePrep;
37 class IePerr;
38 
45 {
46 public:
53  HwmpProtocolMac (uint32_t ifIndex, Ptr<HwmpProtocol> protocol);
56  //\{
58  bool Receive (Ptr<Packet> packet, const WifiMacHeader & header);
61  void UpdateBeacon (MeshWifiBeacon & beacon) const {};
62  int64_t AssignStreams (int64_t stream);
63  //\}
64 
65 private:
67  friend class HwmpProtocol;
73  //\{
78  void SendPreq (IePreq preq);
83  void SendPreq (std::vector<IePreq> preq);
89  void SendPrep (IePrep prep, Mac48Address receiver);
95  void ForwardPerr (std::vector<HwmpProtocol::FailedDestination> destinations, std::vector<Mac48Address> receivers);
101  void InitiatePerr (std::vector<HwmpProtocol::FailedDestination> destinations, std::vector<Mac48Address> receivers);
109  void RequestDestination (Mac48Address dest, uint32_t originator_seqno, uint32_t dst_seqno);
110  //\}
111 
113  void SendMyPreq ();
115  void SendMyPerr ();
120  uint32_t GetLinkMetric (Mac48Address peerAddress) const;
125  uint16_t GetChannelId () const;
130  void Report (std::ostream & os) const;
132  void ResetStats ();
133 private:
135  uint32_t m_ifIndex;
137 
139  //\{
141  std::vector<IePreq> m_myPreq;
142  //\}
144  //\{
147  struct MyPerr {
148  std::vector<HwmpProtocol::FailedDestination> destinations;
149  std::vector<Mac48Address> receivers;
150  };
152  //\{
155  struct Statistics
156  {
157  uint16_t txPreq;
158  uint16_t rxPreq;
159  uint16_t txPrep;
160  uint16_t rxPrep;
161  uint16_t txPerr;
162  uint16_t rxPerr;
163  uint16_t txMgt;
164  uint32_t txMgtBytes;
165  uint16_t rxMgt;
166  uint32_t rxMgtBytes;
167  uint16_t txData;
168  uint32_t txDataBytes;
169  uint16_t rxData;
170  uint32_t rxDataBytes;
171 
175  void Print (std::ostream & os) const;
176  Statistics ();
177  };
179  //\}
180 private:
188  bool ReceiveData (Ptr<Packet> packet, const WifiMacHeader & header);
196  bool ReceiveAction (Ptr<Packet> packet, const WifiMacHeader & header);
197 };
198 } // namespace dot11s
199 } // namespace ns3
200 #endif
bool ReceiveAction(Ptr< Packet > packet, const WifiMacHeader &header)
Receive action management frame.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
void SendMyPerr()
Send PERR function.
void SetParent(Ptr< MeshWifiInterfaceMac > parent)
Update beacon is empty, because HWMP does not know anything about beacons.
void SendMyPreq()
Sends one PREQ when PreqMinInterval after last PREQ expires (if any PREQ exists in rhe queue) ...
void SendPrep(IePrep prep, Mac48Address receiver)
Send PREP function.
See IEEE 802.11 chapter 7.3.1.11 Header format: | category: 1 | action value: 1 |.
Definition: mgt-headers.h:856
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.
std::vector< IePreq > m_myPreq
uint32_t GetLinkMetric(Mac48Address peerAddress) const
void SendPreq(IePreq preq)
Send PREQ function.
void Print(std::ostream &os) const
Print function.
static WifiActionHeader GetWifiActionHeader()
void ResetStats()
Reset statistics.
Hybrid wireless mesh protocol – a mesh routing protocol defined in IEEE 802.11-2012 standard...
Definition: hwmp-protocol.h:62
See 7.3.2.96 of 802.11s draft 2.07.
uint32_t txDataBytes
transmit data bytes
uint32_t rxMgtBytes
receive management bytes
Ptr< MeshWifiInterfaceMac > m_parent
parent
std::vector< Mac48Address > receivers
receivers
uint32_t txMgtBytes
transmit management bytes
Interface MAC plugin for HWMP – 802.11s routing protocol.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Common interface for mesh point interface MAC plugins.
void Report(std::ostream &os) const
Report statistics.
an EUI-48 address
Definition: mac48-address.h:43
std::vector< HwmpProtocol::FailedDestination > destinations
destinations
uint32_t rxDataBytes
receive data bytes
HwmpProtocolMac(uint32_t ifIndex, Ptr< HwmpProtocol > protocol)
Constructor.
bool UpdateOutcomingFrame(Ptr< Packet > packet, WifiMacHeader &header, Mac48Address from, Mac48Address to)
Update beacon is empty, because HWMP does not know anything about beacons.
Beacon is beacon header + list of arbitrary information elements.
Ptr< HwmpProtocol > m_protocol
protocol
int64_t AssignStreams(int64_t stream)
Update beacon is empty, because HWMP does not know anything about beacons.
bool ReceiveData(Ptr< Packet > packet, const WifiMacHeader &header)
Receive data frame.
An identifier for simulation events.
Definition: event-id.h:53
void ForwardPerr(std::vector< HwmpProtocol::FailedDestination > destinations, std::vector< Mac48Address > receivers)
Forward a path error.
uint16_t GetChannelId() const
Get the channel ID.
bool Receive(Ptr< Packet > packet, const WifiMacHeader &header)
Update beacon is empty, because HWMP does not know anything about beacons.
void InitiatePerr(std::vector< HwmpProtocol::FailedDestination > destinations, std::vector< Mac48Address > receivers)
initiate my own path error
Statistics m_stats
statistics
Implements the IEEE 802.11 MAC header.
void UpdateBeacon(MeshWifiBeacon &beacon) const
Update beacon is empty, because HWMP does not know anything about beacons.