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);
93  // \{
94  void Report (std::ostream &) const;
95  void ResetStats ();
96  uint32_t GetLinkMetric (Mac48Address peerAddress);
97  // \}
98 
99 private:
109 
113  friend class PeerLink;
115  // \{
121  {
122  uint8_t subtype;
123  uint16_t aid;
125  uint16_t qos;
126  };
148  // \}
160  // BCA functionality
165  void SetBeaconShift (Time shift);
180  Mac48Address peerAddress,
181  Mac48Address peerMpAddress,
182  uint16_t aid,
183  IePeerManagement peerElement,
184  IeConfiguration meshConfig
185  );
190  Mac48Address GetAddress () const;
192  struct Statistics
193  {
194  uint16_t txOpen;
195  uint16_t txConfirm;
196  uint16_t txClose;
197  uint16_t rxOpen;
198  uint16_t rxConfirm;
199  uint16_t rxClose;
200  uint16_t dropped;
201  uint16_t brokenMgt;
202  uint16_t txMgt;
203  uint32_t txMgtBytes;
204  uint16_t rxMgt;
205  uint32_t rxMgtBytes;
206  uint16_t beaconShift;
207 
209  Statistics ();
214  void Print (std::ostream & os) const;
215  };
216 
217 private:
221  uint32_t m_ifIndex;
223 };
224 
225 } // namespace dot11s
226 } // namespace ns3
227 
228 #endif /* PEER_MANAGEMENT_PROTOCOL_MAC_H */
229 
Ptr< Packet > CreatePeerLinkOpenFrame()
Create peer link open frame function.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:73
void TxError(WifiMacDropReason reason, Ptr< const WifiMacQueueItem > mpdu)
Closes link when a proper number of successive transmissions have failed.
void SetBeaconShift(Time shift)
Set beacon shift function.
void UpdateBeacon(MeshWifiBeacon &beacon) const
Add beacon timing and mesh ID information elements, and notify beacon sent.
void SetPeerManagerProtcol(Ptr< PeerManagementProtocol > protocol)
Set peer manager protocol function.
int64_t AssignStreams(int64_t stream)
Assign the streams.
The Supported Rates Information ElementThis class knows how to serialise and deserialise the Supporte...
according to IEEE 802.11 - 2012
PeerManagementProtocolMac(uint32_t interface, Ptr< PeerManagementProtocol > protocol)
Constructor.
bool UpdateOutcomingFrame(Ptr< Packet > packet, WifiMacHeader &header, Mac48Address from, Mac48Address to)
This method appears to test a few conditions.
uint32_t GetLinkMetric(Mac48Address peerAddress)
PeerManagementProtocolMac & operator=(const PeerManagementProtocolMac &peer)
assignment operator
Ptr< Packet > CreatePeerLinkCloseFrame()
Create peer link clode frame function.
void TxOk(Ptr< const WifiMacQueueItem > mpdu)
Transmit OK function.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Common interface for mesh point interface MAC plugins.
void SendPeerLinkManagementFrame(Mac48Address peerAddress, Mac48Address peerMpAddress, uint16_t aid, IePeerManagement peerElement, IeConfiguration meshConfig)
Send peer link management frame function.
void Print(std::ostream &os) const
Print function.
an EUI-48 address
Definition: mac48-address.h:43
Beacon is beacon header + list of arbitrary information elements.
Ptr< MeshWifiInterfaceMac > m_parent
parent
PlinkFrameStart ParsePlinkFrame(Ptr< const Packet > packet)
Parses the start of the frame, where no WifiInformationElements exist.
Describes Mesh Configuration Element see 7.3.2.86 of 802.11s draft 3.0.
This is plugin to Mesh WiFi MAC, which implements the interface to dot11s peer management protocol: i...
bool Receive(Ptr< Packet > packet, const WifiMacHeader &header)
Receive and process a packet.
Mac48Address GetAddress() const
debug only, used to print established links
void SetParent(Ptr< MeshWifiInterfaceMac > parent)
Set pointer to parent.
Ptr< PeerManagementProtocol > m_protocol
protocol
WifiMacDropReason
The reason why an MPDU was dropped.
Definition: wifi-mac.h:54
Ptr< Packet > CreatePeerLinkConfirmFrame()
Create peer link confirm frame function.
Implements the IEEE 802.11 MAC header.
802.11s Peer Management Protocol model