OLD | NEW |
(Empty) | |
| 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_MANAGER_MAC_PLUGIN_H_ |
| 22 #define PEER_MANAGER_MAC_PLUGIN_H_ |
| 23 |
| 24 #include "ns3/mesh-wifi-interface-mac-plugin.h" |
| 25 |
| 26 namespace ns3 { |
| 27 class MeshWifiInterfaceMac; |
| 28 namespace dot11s { |
| 29 class PeerManagementProtocol; |
| 30 class IeConfiguration; |
| 31 class IePeerManagement; |
| 32 class PeerManagementProtocol; |
| 33 /** |
| 34 * \ingroup dot11s |
| 35 * |
| 36 * \brief This is plugin to Mesh WiFi MAC, which implements |
| 37 * interface to dot11s peer management protocol: it takes proper |
| 38 * frames from MAC-layer, extracts peer link management information |
| 39 * element and mesh configuration element and passes it to main part |
| 40 * of protocol |
| 41 */ |
| 42 class PeerManagementProtocolMac : public MeshWifiInterfaceMacPlugin |
| 43 { |
| 44 public: |
| 45 PeerManagementProtocolMac (uint32_t interface, Ptr<PeerManagementProtocol> pro
tocol); |
| 46 ~PeerManagementProtocolMac (); |
| 47 ///\name Inherited from plugin abstract class |
| 48 ///\{ |
| 49 void SetParent (Ptr<MeshWifiInterfaceMac> parent); |
| 50 bool Receive (Ptr<Packet> packet, const WifiMacHeader & header); |
| 51 bool UpdateOutcomingFrame (Ptr<Packet> packet, WifiMacHeader & header, Mac48Ad
dress from, Mac48Address to); |
| 52 void UpdateBeacon (MeshWifiBeacon & beacon) const; |
| 53 ///\} |
| 54 ///\name Statistics: |
| 55 ///\{ |
| 56 void Report (std::ostream &) const; |
| 57 void ResetStats (); |
| 58 uint32_t GetLinkMetric (Mac48Address peerAddress); |
| 59 ///\} |
| 60 private: |
| 61 friend class PeerManagementProtocol; |
| 62 friend class PeerLink; |
| 63 ///\name Create peer link management frames: |
| 64 ///\{ |
| 65 struct PlinkFrameStart |
| 66 { |
| 67 uint8_t subtype; |
| 68 uint16_t aid; |
| 69 SupportedRates rates; |
| 70 uint16_t qos; |
| 71 }; |
| 72 Ptr<Packet> CreatePeerLinkOpenFrame (); |
| 73 Ptr<Packet> CreatePeerLinkConfirmFrame (); |
| 74 Ptr<Packet> CreatePeerLinkCloseFrame (); |
| 75 /** |
| 76 * \brief This structure keeps all fields in peer link management frame, |
| 77 * which are not subclasses of WifiInformationElement |
| 78 */ |
| 79 /// \name Parses the start of the frame, where there are no |
| 80 /// WifiInformationElements exist |
| 81 PlinkFrameStart ParsePlinkFrame (Ptr<const Packet> packet); |
| 82 ///\} |
| 83 ///// Closes link when a proper number of successive transmissions have failed |
| 84 void TxError (WifiMacHeader const &hdr); |
| 85 void TxOk (WifiMacHeader const &hdr); |
| 86 ///\name BCA functionallity: |
| 87 ///\{ |
| 88 ///\brief Fills TBTT and beacon interval. Needed by BCA |
| 89 ///functionallity |
| 90 ///\param first in retval is TBTT |
| 91 ///\param second in retval is beacon interval |
| 92 std::pair<Time, Time> GetBeaconInfo () const; |
| 93 void SetBeaconShift (Time shift); |
| 94 ///\} |
| 95 void SetPeerManagerProtcol (Ptr<PeerManagementProtocol> protocol); |
| 96 void SendPeerLinkManagementFrame ( |
| 97 Mac48Address peerAddress, |
| 98 Mac48Address peerMpAddress, |
| 99 uint16_t aid, |
| 100 IePeerManagement peerElement, |
| 101 IeConfiguration meshConfig |
| 102 ); |
| 103 ///\brief DUBUG only - to print established links |
| 104 Mac48Address GetAddress () const; |
| 105 ///\name Statistics |
| 106 struct Statistics |
| 107 { |
| 108 uint16_t txOpen; |
| 109 uint16_t txConfirm; |
| 110 uint16_t txClose; |
| 111 uint16_t rxOpen; |
| 112 uint16_t rxConfirm; |
| 113 uint16_t rxClose; |
| 114 uint16_t dropped; |
| 115 uint16_t brokenMgt; |
| 116 uint16_t txMgt; |
| 117 uint32_t txMgtBytes; |
| 118 uint16_t rxMgt; |
| 119 uint32_t rxMgtBytes; |
| 120 uint16_t beaconShift; |
| 121 |
| 122 Statistics (); |
| 123 void Print (std::ostream & os) const; |
| 124 }; |
| 125 private: |
| 126 struct Statistics m_stats; |
| 127 ///\} |
| 128 ///\name Information about MAC and protocol: |
| 129 ///\{ |
| 130 Ptr<MeshWifiInterfaceMac> m_parent; |
| 131 uint32_t m_ifIndex; |
| 132 Ptr<PeerManagementProtocol> m_protocol; |
| 133 ///\} |
| 134 }; |
| 135 |
| 136 } // namespace dot11s |
| 137 } //namespace ns3 |
| 138 #endif |
| 139 |
OLD | NEW |