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