A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
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
25namespace ns3
26{
27class MeshWifiInterfaceMac;
28class WifiMpdu;
29enum WifiMacDropReason : uint8_t; // opaque enum declaration
30
31namespace dot11s
32{
33class PeerManagementProtocol;
34class IeConfiguration;
35class IePeerManagement;
36class PeerManagementProtocol;
37
38/**
39 * \ingroup dot11s
40 *
41 * \brief This is plugin to Mesh WiFi MAC, which implements the
42 * interface to dot11s peer management protocol: it takes proper
43 * frames from MAC-layer, extracts peer link management information
44 * element and mesh configuration element and passes it to main part
45 * of protocol
46 */
48{
49 public:
50 /**
51 * Constructor
52 *
53 * \param interface interface index
54 * \param protocol peer management protocol
55 */
58
59 // Inherited from plugin abstract class
60 /**
61 * Set pointer to parent
62 * \param parent Ptr<MeshWifiInterfaceMac>
63 */
64 void SetParent(Ptr<MeshWifiInterfaceMac> parent) override;
65 /**
66 * Receive and process a packet
67 * \param packet the packet received
68 * \param header the header
69 * \returns true if received
70 */
71 bool Receive(Ptr<Packet> packet, const WifiMacHeader& header) override;
72 /**
73 * This method appears to test a few conditions. If an action frame,
74 * it returns true if SELF_PROTECTED. It then checks if it is either
75 * a broadcast or sent on an active link, and returns true if so.
76 * Otherwise, it returns false (indicating it is to be dropped)
77 * \param packet the packet
78 * \param header the header
79 * \param from the MAC address of the sender
80 * \param to the MAC address of the receiver
81 * \returns true if successful, false if to be dropped
82 */
84 WifiMacHeader& header,
85 Mac48Address from,
86 Mac48Address to) override;
87 /**
88 * Add beacon timing and mesh ID information elements, and notify beacon sent
89 * \param beacon the beacon
90 */
91 void UpdateBeacon(MeshWifiBeacon& beacon) const override;
92 /**
93 * Assign the streams
94 * \param stream the stream to assign
95 * \return the assigned stream
96 */
97 int64_t AssignStreams(int64_t stream) override;
98
99 /// \name Statistics
100 ///@{
101 /**
102 * \brief Report statistics
103 * \param os the output stream
104 */
105 void Report(std::ostream&) const;
106 /// Reset stats
107 void ResetStats();
108 /**
109 * Get the link metric
110 * \param peerAddress the peer address
111 * \return The metric
112 */
114 ///@}
115
116 private:
117 /**
118 * assignment operator
119 *
120 * \param peer the object to assign
121 * \returns the assigned value
122 */
124 /// type conversion operator
126
127 /// allow PeerManagementProtocol class access friend access
129 /// allow PeerLink class access friend access
130 friend class PeerLink;
131
132 ///\name Create peer link management frames
133 // \{
134 /**
135 * \brief This structure keeps all fields in peer link management frame,
136 * which are not subclasses of WifiInformationElement
137 */
139 {
140 uint8_t subtype; ///< subtype
141 uint16_t aid; ///< aid
143 uint16_t qos; ///< QOS
144 };
145
146 /**
147 * Create peer link open frame function
148 * \returns the packet
149 */
151 /**
152 * Create peer link confirm frame function
153 * \returns the packet
154 */
156 /**
157 * Create peer link clode frame function
158 * \returns the packet
159 */
161 /**
162 * Parses the start of the frame, where no WifiInformationElements exist
163 * \param packet the packet
164 * \returns PlinkFrameStart
165 */
167 // \}
168 /**
169 * Closes link when a proper number of successive transmissions have failed
170 * \param reason the reason why the MPDU was dropped
171 * \param mpdu the dropped MPDU
172 */
174 /**
175 * Transmit OK function
176 * \param mpdu the MPDU
177 */
178 void TxOk(Ptr<const WifiMpdu> mpdu);
179 // BCA functionality
180 /**
181 * Set beacon shift function
182 * \param shift the beacon time shift
183 */
184 void SetBeaconShift(Time shift);
185 /**
186 * Set peer manager protocol function
187 * \param protocol the peer manager protocol
188 */
190 /**
191 * Send peer link management frame function
192 * \param peerAddress the peer MAC address
193 * \param peerMpAddress the peer MP address
194 * \param aid the AID
195 * \param peerElement IePeerManagement
196 * \param meshConfig IeConfiguration
197 */
199 Mac48Address peerMpAddress,
200 uint16_t aid,
201 IePeerManagement peerElement,
202 IeConfiguration meshConfig);
203 /**
204 * \brief debug only, used to print established links
205 * \returns the MAC address
206 */
207 Mac48Address GetAddress() const;
208
209 /// Statistics structure
211 {
212 uint16_t txOpen; ///< transmit open
213 uint16_t txConfirm; ///< transmit confirm
214 uint16_t txClose; ///< transmit close
215 uint16_t rxOpen; ///< receive open
216 uint16_t rxConfirm; ///< receive confirm
217 uint16_t rxClose; ///< receive close
218 uint16_t dropped; ///< dropped
219 uint16_t brokenMgt; ///< broken management
220 uint16_t txMgt; ///< transmit management
221 uint32_t txMgtBytes; ///< transmit management bytes
222 uint16_t rxMgt; ///< receive management
223 uint32_t rxMgtBytes; ///< receive management bytes
224 uint16_t beaconShift; ///< beacon shift
225
226 /// constructor
227 Statistics();
228 /**
229 * Print function
230 * \param os the output stream
231 */
232 void Print(std::ostream& os) const;
233 };
234
235 private:
236 Statistics m_stats; ///< statistics
237 ///\name Information about MAC and protocol:
239 uint32_t m_ifIndex; ///< IF index
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...
Ptr< Packet > CreatePeerLinkConfirmFrame()
Create peer link confirm frame function.
PeerManagementProtocolMac & operator=(const PeerManagementProtocolMac &peer)
assignment operator
PeerManagementProtocolMac(const PeerManagementProtocolMac &)
type conversion operator
void SetParent(Ptr< MeshWifiInterfaceMac > parent) override
Set pointer to parent.
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.
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 > CreatePeerLinkCloseFrame()
Create peer link clode 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.
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.
Ptr< Packet > CreatePeerLinkOpenFrame()
Create peer link open frame function.
WifiMacDropReason
The reason why an MPDU was dropped.
Definition: wifi-mac.h:80
Every class exported by the ns3 library is enclosed in the ns3 namespace.