Headers: structured
This commit is contained in:
@@ -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<FailedDestination> destinations; ///< destination list: Mac48Address and sequence number
|
||||
std::vector<std::pair<uint32_t, Mac48Address> > receivers; ///< list of PathError receivrs (in case of unicast PERR)
|
||||
};
|
||||
/// Packet waiting its routing information
|
||||
struct QueuedPacket
|
||||
{
|
||||
Ptr<Packet> 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<uint32_t, Ptr<HwmpProtocolMac> > HwmpProtocolMacMap;
|
||||
/// Like RequestRoute, but for unicast packets
|
||||
bool ForwardUnicast (uint32_t sourceIface, const Mac48Address source, const Mac48Address destination,
|
||||
Ptr<Packet> 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<FailedDestination> destinations;
|
||||
/// interface-address
|
||||
std::vector<std::pair<uint32_t, Mac48Address> > 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<Packet> 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<uint32_t, Ptr<HwmpProtocolMac> > 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<QueuedPacket> 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 <std::vector<Mac48Address>, uint32_t> m_neighboursCallback;
|
||||
};
|
||||
} //namespace dot11s
|
||||
|
||||
@@ -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<void, uint32_t, Mac48Address, Mac48Address, PeerLink::PeerState, PeerLink::PeerState> 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<PeerManagementProtocolMac> 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;
|
||||
};
|
||||
|
||||
@@ -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<Packet> CreatePeerLinkOpenFrame ();
|
||||
Ptr<Packet> CreatePeerLinkConfirmFrame ();
|
||||
Ptr<Packet> 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<const Packet> 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<MeshWifiInterfaceMac> m_parent;
|
||||
uint32_t m_ifIndex;
|
||||
Ptr<PeerManagementProtocol> m_protocol;
|
||||
///\}
|
||||
///\name Create peer link management frames:
|
||||
///\{
|
||||
Ptr<Packet> CreatePeerLinkOpenFrame ();
|
||||
Ptr<Packet> CreatePeerLinkConfirmFrame ();
|
||||
Ptr<Packet> 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<const Packet> 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<MeshWifiInterfaceMac> m_parent;
|
||||
uint32_t m_ifIndex;
|
||||
Ptr<PeerManagementProtocol> m_protocol;
|
||||
///\}
|
||||
};
|
||||
|
||||
} // namespace dot11s
|
||||
|
||||
@@ -236,7 +236,8 @@ private:
|
||||
*/
|
||||
Callback <void, Mac48Address, Mac48Address, uint32_t, bool> 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
|
||||
|
||||
@@ -166,7 +166,8 @@ private:
|
||||
/// Current routing protocol, used mainly by GetRoutingProtocol
|
||||
Ptr<MeshL2RoutingProtocol> 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
|
||||
|
||||
@@ -180,9 +180,10 @@ private:
|
||||
virtual void DoDispose ();
|
||||
|
||||
private:
|
||||
typedef std::map<AccessClass, Ptr<DcaTxop> > Queues;
|
||||
typedef std::vector<Ptr<MeshWifiInterfaceMacPlugin> > PluginList;
|
||||
///\name Wifi MAC internals
|
||||
//\{
|
||||
typedef std::map<AccessClass, Ptr<DcaTxop> > Queues;
|
||||
Queues m_queues;
|
||||
Ptr<DcaTxop> m_beaconDca;
|
||||
Ptr<WifiRemoteStationManager> m_stationManager;
|
||||
@@ -225,8 +226,6 @@ private:
|
||||
|
||||
/// "Timer" for the next beacon
|
||||
EventId m_beaconSendEvent;
|
||||
|
||||
typedef std::vector<Ptr<MeshWifiInterfaceMacPlugin> > PluginList;
|
||||
/// List of all installed plugins
|
||||
PluginList m_plugins;
|
||||
Callback<uint32_t, Mac48Address, Ptr<MeshWifiInterfaceMac> > m_linkMetricCallback;
|
||||
|
||||
@@ -143,8 +143,8 @@ public:
|
||||
bool AddInformationElement (Ptr<WifiInformationElement> element);
|
||||
Ptr<WifiInformationElement> FindFirst (enum WifiElementId id) const;
|
||||
private:
|
||||
uint32_t GetSize () const;
|
||||
typedef std::vector<Ptr<WifiInformationElement> > IE_VECTOR;
|
||||
uint32_t GetSize () const;
|
||||
IE_VECTOR m_elements;
|
||||
/// Size in bytes (actually, max packet length)
|
||||
uint16_t m_maxSize;
|
||||
|
||||
Reference in New Issue
Block a user