A Discrete-Event Network Simulator
API
peer-management-protocol-mac.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 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 PEER_MANAGEMENT_PROTOCOL_MAC_H
21 #define PEER_MANAGEMENT_PROTOCOL_MAC_H
22 
23 #include "ns3/mesh-wifi-interface-mac-plugin.h"
24 
25 namespace ns3
26 {
27 class MeshWifiInterfaceMac;
28 class WifiMpdu;
29 enum WifiMacDropReason : uint8_t; // opaque enum declaration
30 
31 namespace dot11s
32 {
33 class PeerManagementProtocol;
34 class IeConfiguration;
35 class IePeerManagement;
36 class PeerManagementProtocol;
37 
48 {
49  public:
56  PeerManagementProtocolMac(uint32_t interface, Ptr<PeerManagementProtocol> protocol);
57  ~PeerManagementProtocolMac() override;
58 
59  // Inherited from plugin abstract class
64  void SetParent(Ptr<MeshWifiInterfaceMac> parent) override;
71  bool Receive(Ptr<Packet> packet, const WifiMacHeader& header) override;
84  WifiMacHeader& header,
85  Mac48Address from,
86  Mac48Address to) override;
91  void UpdateBeacon(MeshWifiBeacon& beacon) const override;
97  int64_t AssignStreams(int64_t stream) override;
98 
101 
105  void Report(std::ostream&) const;
107  void ResetStats();
113  uint32_t GetLinkMetric(Mac48Address peerAddress);
115 
116  private:
126 
130  friend class PeerLink;
131 
133  // \{
139  {
140  uint8_t subtype;
141  uint16_t aid;
143  uint16_t qos;
144  };
145 
167  // \}
173  void TxError(WifiMacDropReason reason, Ptr<const WifiMpdu> mpdu);
178  void TxOk(Ptr<const WifiMpdu> mpdu);
179  // BCA functionality
184  void SetBeaconShift(Time shift);
198  void SendPeerLinkManagementFrame(Mac48Address peerAddress,
199  Mac48Address peerMpAddress,
200  uint16_t aid,
201  IePeerManagement peerElement,
202  IeConfiguration meshConfig);
207  Mac48Address GetAddress() const;
208 
210  struct Statistics
211  {
212  uint16_t txOpen;
213  uint16_t txConfirm;
214  uint16_t txClose;
215  uint16_t rxOpen;
216  uint16_t rxConfirm;
217  uint16_t rxClose;
218  uint16_t dropped;
219  uint16_t brokenMgt;
220  uint16_t txMgt;
221  uint32_t txMgtBytes;
222  uint16_t rxMgt;
223  uint32_t rxMgtBytes;
224  uint16_t beaconShift;
225 
227  Statistics();
232  void Print(std::ostream& os) const;
233  };
234 
235  private:
239  uint32_t m_ifIndex;
241 };
242 
243 } // namespace dot11s
244 } // namespace ns3
245 
246 #endif /* PEER_MANAGEMENT_PROTOCOL_MAC_H */
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:77
The Supported Rates Information Element.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
Implements the IEEE 802.11 MAC header.
Describes Mesh Configuration Element see 7.3.2.86 of 802.11s draft 3.0.
according to IEEE 802.11 - 2012
802.11s Peer Management Protocol model
This is plugin to Mesh WiFi MAC, which implements the interface to dot11s peer management protocol: i...
PeerManagementProtocolMac(const PeerManagementProtocolMac &)
type conversion operator
void SetParent(Ptr< MeshWifiInterfaceMac > parent) override
Set pointer to parent.
Ptr< Packet > CreatePeerLinkOpenFrame()
Create peer link open frame function.
PeerManagementProtocolMac(uint32_t interface, Ptr< PeerManagementProtocol > protocol)
Constructor.
void SetPeerManagerProtocol(Ptr< PeerManagementProtocol > protocol)
Set peer manager protocol function.
void Report(std::ostream &) const
Report statistics.
Mac48Address GetAddress() const
debug only, used to print established links
void UpdateBeacon(MeshWifiBeacon &beacon) const override
Add beacon timing and mesh ID information elements, and notify beacon sent.
Ptr< Packet > CreatePeerLinkCloseFrame()
Create peer link clode frame function.
bool UpdateOutcomingFrame(Ptr< Packet > packet, WifiMacHeader &header, Mac48Address from, Mac48Address to) override
This method appears to test a few conditions.
void TxError(WifiMacDropReason reason, Ptr< const WifiMpdu > mpdu)
Closes link when a proper number of successive transmissions have failed.
Ptr< Packet > CreatePeerLinkConfirmFrame()
Create peer link confirm frame function.
int64_t AssignStreams(int64_t stream) override
Assign the streams.
PlinkFrameStart ParsePlinkFrame(Ptr< const Packet > packet)
Parses the start of the frame, where no WifiInformationElements exist.
void SendPeerLinkManagementFrame(Mac48Address peerAddress, Mac48Address peerMpAddress, uint16_t aid, IePeerManagement peerElement, IeConfiguration meshConfig)
Send peer link management frame function.
void TxOk(Ptr< const WifiMpdu > mpdu)
Transmit OK function.
PeerManagementProtocolMac & operator=(const PeerManagementProtocolMac &peer)
assignment operator
uint32_t GetLinkMetric(Mac48Address peerAddress)
Get the link metric.
bool Receive(Ptr< Packet > packet, const WifiMacHeader &header) override
Receive and process a packet.
Ptr< PeerManagementProtocol > m_protocol
protocol
void SetBeaconShift(Time shift)
Set beacon shift function.
WifiMacDropReason
The reason why an MPDU was dropped.
Definition: wifi-mac.h:77
Every class exported by the ns3 library is enclosed in the ns3 namespace.