diff --git a/src/devices/mesh/dot11s/hwmp-protocol.h b/src/devices/mesh/dot11s/hwmp-protocol.h index 52d0b5e14..f451468bc 100644 --- a/src/devices/mesh/dot11s/hwmp-protocol.h +++ b/src/devices/mesh/dot11s/hwmp-protocol.h @@ -86,7 +86,28 @@ public: void ResetStats (); private: friend class HwmpProtocolMac; + /** + * \brief Structure of path error: IePerr and list of receivers: + * interfaces and MAC address + */ + struct PathError + { + std::vector destinations; ///< destination list: Mac48Address and sequence number + std::vector > receivers; ///< list of PathError receivrs (in case of unicast PERR) + }; + /// Packet waiting its routing information + struct QueuedPacket + { + Ptr pkt; ///< the packet + Mac48Address src; ///< src address + Mac48Address dst; ///< dst address + uint16_t protocol; ///< protocol number + uint32_t inInterface; ///< incoming device interface ID. (if packet has come from upper layers, this is Mesh point ID) + RouteReplyCallback reply; ///< how to reply + QueuedPacket (); + }; + typedef std::map > HwmpProtocolMacMap; /// Like RequestRoute, but for unicast packets bool ForwardUnicast (uint32_t sourceIface, const Mac48Address source, const Mac48Address destination, Ptr packet, uint16_t protocolType, RouteReplyCallback routeReply, uint32_t ttl); @@ -105,16 +126,6 @@ private: uint32_t destinationSN, uint32_t lifetime, uint32_t interface); - /** - * \brief Structure of path error: IePerr and list of receivers: - * interfaces and MAC address - */ - struct PathError - { - std::vector destinations; - /// interface-address - std::vector > receivers; - }; /** * \brief forms a path error information element when list of destination fails on a given interface * \attention removes all entries from routing table! @@ -141,19 +152,6 @@ private: */ bool DropDataFrame (uint32_t seqno, Mac48Address source); //\} -private: - /// Packet waiting its routing information - struct QueuedPacket { - Ptr pkt; ///< the packet - Mac48Address src; ///< src address - Mac48Address dst; ///< dst address - uint16_t protocol; ///< protocol number - uint32_t inInterface; ///< incoming device interface ID. (if packet has come from upper layers, this is Mesh point ID) - RouteReplyCallback reply; ///< how to reply - - QueuedPacket (); - }; - ///\name Methods related to Queue/Dequeue procedures ///\{ bool QueuePacket (QueuedPacket packet); @@ -177,17 +175,24 @@ private: * When PREQ retry has achieved the maximum level - retry mechanism should be canceled */ void RetryPathDiscovery (Mac48Address dst, uint8_t numOfRetry); - ///\} - - ///\name Proactive Preq routines: - ///\{ + /// Proactive Preq routines: void SendProactivePreq (); ///\} ///\return address of MeshPointDevice Mac48Address GetAddress (); + ///\name Methods needed by HwmpMacLugin to access protocol parameters: + ///\{ + bool GetDoFlag (); + bool GetRfFlag (); + Time GetPreqMinInterval (); + Time GetPerrMinInterval (); + uint8_t GetMaxTtl (); + uint32_t GetNextPreqId (); + uint32_t GetNextHwmpSeqno (); + uint32_t GetActivePathLifetime (); + uint8_t GetUnicastPerrThreshold (); + ///\} private: - typedef std::map > HwmpProtocolMacMap; - HwmpProtocolMacMap m_interfaces; ///\name Statistics: ///\{ struct Statistics @@ -207,6 +212,7 @@ private: }; Statistics m_stats; ///\} + HwmpProtocolMacMap m_interfaces; Mac48Address m_address; uint32_t m_dataSeqno; uint32_t m_hwmpSeqno; @@ -231,10 +237,8 @@ private: /// Random start in Proactive PREQ propagation Time m_randomStart; ///\} - /// Packet Queue std::vector m_rqueue; -private: ///\name HWMP-protocol parameters (attributes of GetTypeId) ///\{ uint16_t m_maxQueueSize; @@ -254,19 +258,6 @@ private: bool m_doFlag; bool m_rfFlag; ///\} - - ///\name Methods needed by HwmpMacLugin to access protocol parameters: - ///\{ - bool GetDoFlag (); - bool GetRfFlag (); - Time GetPreqMinInterval (); - Time GetPerrMinInterval (); - uint8_t GetMaxTtl (); - uint32_t GetNextPreqId (); - uint32_t GetNextHwmpSeqno (); - uint32_t GetActivePathLifetime (); - uint8_t GetUnicastPerrThreshold (); - ///\} Callback , uint32_t> m_neighboursCallback; }; } //namespace dot11s diff --git a/src/devices/mesh/dot11s/peer-link.h b/src/devices/mesh/dot11s/peer-link.h index 030c2cef7..e8b65c4a4 100644 --- a/src/devices/mesh/dot11s/peer-link.h +++ b/src/devices/mesh/dot11s/peer-link.h @@ -48,7 +48,15 @@ public: PeerLink (); ~PeerLink (); void DoDispose (); - + /// Peer Link state: + enum PeerState { + IDLE, + OPN_SNT, + CNF_RCVD, + OPN_RCVD, + ESTAB, + HOLDING, + }; /// Process beacon received from peer void SetBeaconInformation (Time lastBeacon, Time BeaconInterval); /** @@ -89,14 +97,6 @@ public: void MLMEActivePeerLinkOpen (); /// MLME-PeeringRequestReject void MLMEPeeringRequestReject (); - enum PeerState { - IDLE, - OPN_SNT, - CNF_RCVD, - OPN_RCVD, - ESTAB, - HOLDING, - }; /// Callback type for MLME-SignalPeerLinkStatus event typedef Callback SignalStatusCallback; /// Set callback @@ -108,6 +108,24 @@ public: ///\brief Statistics void Report (std::ostream & os) const; private: + /// Peer link events, see 802.11s draft 11B.3.3.2 + enum PeerEvent + { + CNCL, ///< Cancel peer link + ACTOPN, ///< Active peer link open + CLS_ACPT, ///< PeerLinkClose_Accept + OPN_ACPT, ///< PeerLinkOpen_Accept + OPN_RJCT, ///< PeerLinkOpen_Reject + REQ_RJCT, ///< PeerLinkOpenReject by internal reason + CNF_ACPT, ///< PeerLinkConfirm_Accept + CNF_RJCT, ///< PeerLinkConfirm_Reject + TOR1, ///< Timeout of retry timer + TOR2, ///< also timeout of retry timer + TOC, ///< Timeout of confirm timer + TOH, ///< Timeout of holding (gracefull closing) timer + }; + /// State transition + void StateMachine (PeerEvent event, PmpReasonCode = REASON11S_RESERVED); /** * \name Link response to received management frames * @@ -139,7 +157,6 @@ private: PmpReasonCode reason ); //\} - /// True if link is established bool LinkIsEstab () const; /// True if link is idle. Link can be deleted in this state @@ -149,29 +166,6 @@ private: * link management frames */ void SetMacPlugin (Ptr plugin); - /// Peer link states, see 802.11s draft 11B.3.3.1 -private: - /// Peer link events, see 802.11s draft 11B.3.3.2 - enum PeerEvent - { - CNCL, ///< Cancel peer link - ACTOPN, ///< Active peer link open - CLS_ACPT, ///< PeerLinkClose_Accept - OPN_ACPT, ///< PeerLinkOpen_Accept - OPN_RJCT, ///< PeerLinkOpen_Reject - REQ_RJCT, ///< PeerLinkOpenReject by internal reason - CNF_ACPT, ///< PeerLinkConfirm_Accept - CNF_RJCT, ///< PeerLinkConfirm_Reject - TOR1, ///< Timeout of retry timer - TOR2, ///< also timeout of retry timer - TOC, ///< Timeout of confirm timer - TOH, ///< Timeout of holding (gracefull closing) timer - }; - -private: - /// State transition - void StateMachine (PeerEvent event, PmpReasonCode = REASON11S_RESERVED); - /** * \name Event handlers * \{ @@ -201,7 +195,8 @@ private: void RetryTimeout (); void ConfirmTimeout (); //\} - + /// Several successive beacons were lost, close link + void BeaconLoss (); private: ///The number of interface I am associated with uint32_t m_interface; @@ -255,10 +250,6 @@ private: uint16_t m_maxBeaconLoss; uint16_t m_maxPacketFail; //\} - - /// Several successive beacons were lost, close link - void BeaconLoss (); - /// How to report my status change SignalStatusCallback m_linkStatusCallback; }; diff --git a/src/devices/mesh/dot11s/peer-management-protocol-mac.h b/src/devices/mesh/dot11s/peer-management-protocol-mac.h index 13e9777f4..c61d27c86 100644 --- a/src/devices/mesh/dot11s/peer-management-protocol-mac.h +++ b/src/devices/mesh/dot11s/peer-management-protocol-mac.h @@ -60,6 +60,29 @@ public: private: friend class PeerManagementProtocol; friend class PeerLink; + ///\name Create peer link management frames: + ///\{ + struct PlinkFrameStart + { + uint8_t subtype; + uint16_t aid; + SupportedRates rates; + uint16_t qos; + }; + Ptr CreatePeerLinkOpenFrame (); + Ptr CreatePeerLinkConfirmFrame (); + Ptr CreatePeerLinkCloseFrame (); + /** + * \brief This structure keeps all fields in peer link management frame, + * which are not subclasses of WifiInformationElement + */ + /// \name Parses the start of the frame, where there are no + /// WifiInformationElements exist + PlinkFrameStart ParsePlinkFrame (Ptr packet); + ///\} + ///// Closes link when a proper number of successive transmissions have failed + void TxError (WifiMacHeader const &hdr); + void TxOk (WifiMacHeader const &hdr); ///\name BCA functionallity: ///\{ ///\brief Fills TBTT and beacon interval. Needed by BCA @@ -79,35 +102,9 @@ private: ); ///\brief DUBUG only - to print established links Mac48Address GetAddress () const; -private: - ///\name Information about MAC and protocol: - ///\{ - Ptr m_parent; - uint32_t m_ifIndex; - Ptr m_protocol; - ///\} - ///\name Create peer link management frames: - ///\{ - Ptr CreatePeerLinkOpenFrame (); - Ptr CreatePeerLinkConfirmFrame (); - Ptr CreatePeerLinkCloseFrame (); - ///This structure keeps all fields in peer link management frame, - ///which are not subclasses of WifiInformationElement - struct PlinkFrameStart { - uint8_t subtype; - uint16_t aid; - SupportedRates rates; - uint16_t qos; - }; - /// \name Parses the start of the frame, where there are no - /// WifiInformationElements exist - PlinkFrameStart ParsePlinkFrame (Ptr packet); - ///\} - ///// Closes link when a proper number of successive transmissions have failed - void TxError (WifiMacHeader const &hdr); - void TxOk (WifiMacHeader const &hdr); - //Keeps statistics - struct Statistics { + ///\name Statistics + struct Statistics + { uint16_t txOpen; uint16_t txConfirm; uint16_t txClose; @@ -125,7 +122,15 @@ private: Statistics (); void Print (std::ostream & os) const; }; +private: struct Statistics m_stats; + ///\} + ///\name Information about MAC and protocol: + ///\{ + Ptr m_parent; + uint32_t m_ifIndex; + Ptr m_protocol; + ///\} }; } // namespace dot11s diff --git a/src/devices/mesh/dot11s/peer-management-protocol.h b/src/devices/mesh/dot11s/peer-management-protocol.h index 8e3bde51e..164da90fa 100644 --- a/src/devices/mesh/dot11s/peer-management-protocol.h +++ b/src/devices/mesh/dot11s/peer-management-protocol.h @@ -236,7 +236,8 @@ private: */ Callback m_peerStatusCallback; ///\} - //Keeps statistics + ///\name Statistics: + ///\{ struct Statistics { uint16_t linksTotal; uint16_t linksOpened; @@ -246,7 +247,7 @@ private: void Print (std::ostream & os) const; }; struct Statistics m_stats; - + ///\} }; } // namespace dot11s diff --git a/src/devices/mesh/mesh-point-device.h b/src/devices/mesh/mesh-point-device.h index 0f560da1d..475ff43ec 100644 --- a/src/devices/mesh/mesh-point-device.h +++ b/src/devices/mesh/mesh-point-device.h @@ -166,7 +166,8 @@ private: /// Current routing protocol, used mainly by GetRoutingProtocol Ptr m_routingProtocol; - /// Device statistics counters + ///\name Device statistics counters + ///\{ struct Statistics { uint32_t unicastData; @@ -178,6 +179,7 @@ private: }; /// Counters Statistics m_rxStats, m_txStats, m_fwdStats; + ///\} }; } //namespace ns3 #endif diff --git a/src/devices/mesh/mesh-wifi-interface-mac.h b/src/devices/mesh/mesh-wifi-interface-mac.h index 4ea934f4d..99bffce06 100644 --- a/src/devices/mesh/mesh-wifi-interface-mac.h +++ b/src/devices/mesh/mesh-wifi-interface-mac.h @@ -180,9 +180,10 @@ private: virtual void DoDispose (); private: + typedef std::map > Queues; + typedef std::vector > PluginList; ///\name Wifi MAC internals //\{ - typedef std::map > Queues; Queues m_queues; Ptr m_beaconDca; Ptr m_stationManager; @@ -225,8 +226,6 @@ private: /// "Timer" for the next beacon EventId m_beaconSendEvent; - - typedef std::vector > PluginList; /// List of all installed plugins PluginList m_plugins; Callback > m_linkMetricCallback; diff --git a/src/devices/mesh/wifi-information-element-vector.h b/src/devices/mesh/wifi-information-element-vector.h index f7825946e..cf9687d67 100644 --- a/src/devices/mesh/wifi-information-element-vector.h +++ b/src/devices/mesh/wifi-information-element-vector.h @@ -143,8 +143,8 @@ public: bool AddInformationElement (Ptr element); Ptr FindFirst (enum WifiElementId id) const; private: - uint32_t GetSize () const; typedef std::vector > IE_VECTOR; + uint32_t GetSize () const; IE_VECTOR m_elements; /// Size in bytes (actually, max packet length) uint16_t m_maxSize;