A Discrete-Event Network Simulator
API
peer-management-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) 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 PEER_MANAGEMENT_PROTOCOL_MAC_H
22 #define PEER_MANAGEMENT_PROTOCOL_MAC_H
23 
24 #include "ns3/mesh-wifi-interface-mac-plugin.h"
25 
26 namespace ns3 {
27 class MeshWifiInterfaceMac;
28 class WifiMacQueueItem;
29 enum WifiMacDropReason : uint8_t; // opaque enum declaration
30 namespace dot11s {
31 class PeerManagementProtocol;
32 class IeConfiguration;
33 class IePeerManagement;
34 class PeerManagementProtocol;
45 {
46 public:
53  PeerManagementProtocolMac (uint32_t interface, Ptr<PeerManagementProtocol> protocol);
55 
56  // Inherited from plugin abstract class
68  bool Receive (Ptr<Packet> packet, const WifiMacHeader & header);
85  void UpdateBeacon (MeshWifiBeacon & beacon) const;
91  int64_t AssignStreams (int64_t stream);
92 
95 
99  void Report (std::ostream &) const;
101  void ResetStats ();
107  uint32_t GetLinkMetric (Mac48Address peerAddress);
109 
110 private:
120 
124  friend class PeerLink;
126  // \{
132  {
133  uint8_t subtype;
134  uint16_t aid;
136  uint16_t qos;
137  };
159  // \}
171  // BCA functionality
176  void SetBeaconShift (Time shift);
191  Mac48Address peerAddress,
192  Mac48Address peerMpAddress,
193  uint16_t aid,
194  IePeerManagement peerElement,
195  IeConfiguration meshConfig
196  );
203  struct Statistics
204  {
205  uint16_t txOpen;
206  uint16_t txConfirm;
207  uint16_t txClose;
208  uint16_t rxOpen;
209  uint16_t rxConfirm;
210  uint16_t rxClose;
211  uint16_t dropped;
212  uint16_t brokenMgt;
213  uint16_t txMgt;
214  uint32_t txMgtBytes;
215  uint16_t rxMgt;
216  uint32_t rxMgtBytes;
217  uint16_t beaconShift;
218 
220  Statistics ();
225  void Print (std::ostream & os) const;
226  };
227 
228 private:
229  struct Statistics m_stats;
232  uint32_t m_ifIndex;
234 };
235 
236 } // namespace dot11s
237 } // namespace ns3
238 
239 #endif /* PEER_MANAGEMENT_PROTOCOL_MAC_H */
240 
ns3::dot11s::PeerManagementProtocolMac::m_parent
Ptr< MeshWifiInterfaceMac > m_parent
parent
Definition: peer-management-protocol-mac.h:231
ns3::dot11s::PeerManagementProtocolMac::Statistics::txConfirm
uint16_t txConfirm
transmit confirm
Definition: peer-management-protocol-mac.h:206
ns3::dot11s::PeerManagementProtocolMac::Statistics::rxMgt
uint16_t rxMgt
receive management
Definition: peer-management-protocol-mac.h:215
ns3::MeshWifiInterfaceMacPlugin
Common interface for mesh point interface MAC plugins.
Definition: mesh-wifi-interface-mac-plugin.h:41
ns3::dot11s::PeerManagementProtocolMac::UpdateBeacon
void UpdateBeacon(MeshWifiBeacon &beacon) const
Add beacon timing and mesh ID information elements, and notify beacon sent.
Definition: peer-management-protocol-mac.cc:240
ns3::dot11s::PeerManagementProtocolMac::Statistics::rxConfirm
uint16_t rxConfirm
receive confirm
Definition: peer-management-protocol-mac.h:209
ns3::dot11s::PeerManagementProtocolMac::Statistics::Print
void Print(std::ostream &os) const
Print function.
Definition: peer-management-protocol-mac.cc:353
ns3::dot11s::PeerManagementProtocolMac::PeerManagementProtocolMac
PeerManagementProtocolMac(uint32_t interface, Ptr< PeerManagementProtocol > protocol)
Constructor.
Definition: peer-management-protocol-mac.cc:37
ns3::WifiMacDropReason
WifiMacDropReason
The reason why an MPDU was dropped.
Definition: wifi-mac.h:55
ns3::dot11s::PeerManagementProtocolMac::Statistics::txClose
uint16_t txClose
transmit close
Definition: peer-management-protocol-mac.h:207
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::dot11s::PeerManagementProtocolMac::Statistics::Statistics
Statistics()
constructor
Definition: peer-management-protocol-mac.cc:347
ns3::dot11s::PeerManagementProtocolMac::SetBeaconShift
void SetBeaconShift(Time shift)
Set beacon shift function.
Definition: peer-management-protocol-mac.cc:339
ns3::dot11s::PeerManagementProtocolMac::TxError
void TxError(WifiMacDropReason reason, Ptr< const WifiMacQueueItem > mpdu)
Closes link when a proper number of successive transmissions have failed.
Definition: peer-management-protocol-mac.cc:56
ns3::dot11s::PeerManagementProtocolMac::Statistics::rxMgtBytes
uint32_t rxMgtBytes
receive management bytes
Definition: peer-management-protocol-mac.h:216
ns3::dot11s::PeerManagementProtocolMac::PeerManagementProtocolMac
PeerManagementProtocolMac(const PeerManagementProtocolMac &)
type conversion operator
ns3::dot11s::IeConfiguration
Describes Mesh Configuration Element see 7.3.2.86 of 802.11s draft 3.0.
Definition: ie-dot11s-configuration.h:128
ns3::Mac48Address
an EUI-48 address
Definition: mac48-address.h:44
ns3::dot11s::PeerManagementProtocolMac::Report
void Report(std::ostream &) const
Report statistics.
Definition: peer-management-protocol-mac.cc:371
ns3::MeshWifiBeacon
Beacon is beacon header + list of arbitrary information elements.
Definition: mesh-wifi-beacon.h:41
ns3::dot11s::PeerManagementProtocolMac::Statistics::txMgt
uint16_t txMgt
transmit management
Definition: peer-management-protocol-mac.h:213
ns3::WifiMacHeader
Implements the IEEE 802.11 MAC header.
Definition: wifi-mac-header.h:85
ns3::dot11s::PeerManagementProtocolMac::Statistics
Statistics structure.
Definition: peer-management-protocol-mac.h:204
ns3::SupportedRates
The Supported Rates Information Element.
Definition: supported-rates.h:96
ns3::Ptr
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
ns3::dot11s::PeerManagementProtocolMac::SetParent
void SetParent(Ptr< MeshWifiInterfaceMac > parent)
Set pointer to parent.
Definition: peer-management-protocol-mac.cc:49
ns3::dot11s::PeerManagementProtocolMac::Statistics::rxOpen
uint16_t rxOpen
receive open
Definition: peer-management-protocol-mac.h:208
ns3::dot11s::PeerManagementProtocolMac::SendPeerLinkManagementFrame
void SendPeerLinkManagementFrame(Mac48Address peerAddress, Mac48Address peerMpAddress, uint16_t aid, IePeerManagement peerElement, IeConfiguration meshConfig)
Send peer link management frame function.
Definition: peer-management-protocol-mac.cc:252
ns3::dot11s::PeerManagementProtocolMac::CreatePeerLinkOpenFrame
Ptr< Packet > CreatePeerLinkOpenFrame()
Create peer link open frame function.
ns3::dot11s::PeerManagementProtocolMac::CreatePeerLinkConfirmFrame
Ptr< Packet > CreatePeerLinkConfirmFrame()
Create peer link confirm frame function.
ns3::dot11s::PeerManagementProtocol
802.11s Peer Management Protocol model
Definition: peer-management-protocol.h:50
ns3::dot11s::PeerManagementProtocolMac::GetLinkMetric
uint32_t GetLinkMetric(Mac48Address peerAddress)
Get the link metric.
Definition: peer-management-protocol-mac.cc:384
ns3::dot11s::PeerManagementProtocolMac::ParsePlinkFrame
PlinkFrameStart ParsePlinkFrame(Ptr< const Packet > packet)
Parses the start of the frame, where no WifiInformationElements exist.
ns3::dot11s::PeerManagementProtocolMac
This is plugin to Mesh WiFi MAC, which implements the interface to dot11s peer management protocol: i...
Definition: peer-management-protocol-mac.h:45
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
ns3::dot11s::PeerManagementProtocolMac::m_ifIndex
uint32_t m_ifIndex
IF index.
Definition: peer-management-protocol-mac.h:232
ns3::dot11s::PeerManagementProtocolMac::Statistics::txMgtBytes
uint32_t txMgtBytes
transmit management bytes
Definition: peer-management-protocol-mac.h:214
ns3::dot11s::PeerManagementProtocolMac::Statistics::txOpen
uint16_t txOpen
transmit open
Definition: peer-management-protocol-mac.h:205
ns3::dot11s::PeerManagementProtocolMac::Receive
bool Receive(Ptr< Packet > packet, const WifiMacHeader &header)
Receive and process a packet.
Definition: peer-management-protocol-mac.cc:66
ns3::dot11s::PeerManagementProtocolMac::TxOk
void TxOk(Ptr< const WifiMacQueueItem > mpdu)
Transmit OK function.
Definition: peer-management-protocol-mac.cc:61
ns3::dot11s::PeerManagementProtocolMac::operator=
PeerManagementProtocolMac & operator=(const PeerManagementProtocolMac &peer)
assignment operator
ns3::dot11s::PeerManagementProtocolMac::Statistics::dropped
uint16_t dropped
dropped
Definition: peer-management-protocol-mac.h:211
ns3::dot11s::PeerManagementProtocolMac::m_stats
struct Statistics m_stats
statistics
Definition: peer-management-protocol-mac.h:229
ns3::dot11s::PeerManagementProtocolMac::GetAddress
Mac48Address GetAddress() const
debug only, used to print established links
Definition: peer-management-protocol-mac.cc:327
ns3::dot11s::PeerManagementProtocolMac::m_protocol
Ptr< PeerManagementProtocol > m_protocol
protocol
Definition: peer-management-protocol-mac.h:233
ns3::dot11s::PeerManagementProtocolMac::AssignStreams
int64_t AssignStreams(int64_t stream)
Assign the streams.
Definition: peer-management-protocol-mac.cc:389
ns3::dot11s::PeerManagementProtocolMac::UpdateOutcomingFrame
bool UpdateOutcomingFrame(Ptr< Packet > packet, WifiMacHeader &header, Mac48Address from, Mac48Address to)
This method appears to test a few conditions.
Definition: peer-management-protocol-mac.cc:209
ns3::dot11s::PeerManagementProtocolMac::~PeerManagementProtocolMac
~PeerManagementProtocolMac()
Definition: peer-management-protocol-mac.cc:44
ns3::dot11s::PeerManagementProtocolMac::ResetStats
void ResetStats()
Reset stats.
Definition: peer-management-protocol-mac.cc:379
ns3::dot11s::PeerManagementProtocolMac::Statistics::beaconShift
uint16_t beaconShift
beacon shift
Definition: peer-management-protocol-mac.h:217
ns3::dot11s::PeerManagementProtocolMac::Statistics::rxClose
uint16_t rxClose
receive close
Definition: peer-management-protocol-mac.h:210
ns3::dot11s::PeerManagementProtocolMac::SetPeerManagerProtcol
void SetPeerManagerProtcol(Ptr< PeerManagementProtocol > protocol)
Set peer manager protocol function.
ns3::dot11s::IePeerManagement
according to IEEE 802.11 - 2012
Definition: ie-dot11s-peer-management.h:51
ns3::dot11s::PeerManagementProtocolMac::CreatePeerLinkCloseFrame
Ptr< Packet > CreatePeerLinkCloseFrame()
Create peer link clode frame function.
ns3::dot11s::PeerManagementProtocolMac::Statistics::brokenMgt
uint16_t brokenMgt
broken management
Definition: peer-management-protocol-mac.h:212