LEFT | RIGHT |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2008,2009 IITP RAS | 3 * Copyright (c) 2008,2009 IITP RAS |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 30 matching lines...) Expand all Loading... |
41 * | 41 * |
42 * \brief Interface MAC plugin for HWMP -- 802.11s routing protocol | 42 * \brief Interface MAC plugin for HWMP -- 802.11s routing protocol |
43 */ | 43 */ |
44 class HwmpProtocolMac : public MeshWifiInterfaceMacPlugin | 44 class HwmpProtocolMac : public MeshWifiInterfaceMacPlugin |
45 { | 45 { |
46 public: | 46 public: |
47 /** | 47 /** |
48 * Constructor | 48 * Constructor |
49 * | 49 * |
50 * \param ifIndex interface index | 50 * \param ifIndex interface index |
51 * \param protocol HWMP protocol | 51 * \param protocol pointer to HWMP protocol instance |
52 */ | 52 */ |
53 HwmpProtocolMac (uint32_t ifIndex, Ptr<HwmpProtocol> protocol); | 53 HwmpProtocolMac (uint32_t ifIndex, Ptr<HwmpProtocol> protocol); |
54 ~HwmpProtocolMac (); | 54 ~HwmpProtocolMac (); |
55 ///\name Inherited from MAC plugin | 55 ///\name Inherited from MAC plugin |
56 //\{ | 56 //\{ |
57 void SetParent (Ptr<MeshWifiInterfaceMac> parent); | 57 void SetParent (Ptr<MeshWifiInterfaceMac> parent); |
58 bool Receive (Ptr<Packet> packet, const WifiMacHeader & header); | 58 bool Receive (Ptr<Packet> packet, const WifiMacHeader & header); |
59 bool UpdateOutcomingFrame (Ptr<Packet> packet, WifiMacHeader & header, Mac48Ad
dress from, Mac48Address to); | 59 bool UpdateOutcomingFrame (Ptr<Packet> packet, WifiMacHeader & header, Mac48Ad
dress from, Mac48Address to); |
60 /// Update beacon is empty, because HWMP does not know anything about beacons | 60 /// Update beacon is empty, because HWMP does not know anything about beacons |
61 void UpdateBeacon (MeshWifiBeacon & beacon) const {}; | 61 void UpdateBeacon (MeshWifiBeacon & beacon) const {}; |
62 int64_t AssignStreams (int64_t stream); | 62 int64_t AssignStreams (int64_t stream); |
63 //\} | 63 //\} |
64 | 64 |
65 private: | 65 private: |
| 66 /// allow HwmpProtocol class friend access |
66 friend class HwmpProtocol; | 67 friend class HwmpProtocol; |
67 /** | 68 /** |
68 * \returns a path selection action header | 69 * \returns a path selection action header |
69 */ | 70 */ |
70 static WifiActionHeader GetWifiActionHeader (); | 71 static WifiActionHeader GetWifiActionHeader (); |
71 ///\name Interaction with HWMP: | 72 ///\name Interaction with HWMP: |
72 //\{ | 73 //\{ |
73 /** | 74 /** |
74 * Send PREQ function | 75 * Send PREQ function |
75 * \param preq the PREQ | 76 * \param preq the PREQ |
76 */ | 77 */ |
77 void SendPreq (IePreq preq); | 78 void SendPreq (IePreq preq); |
78 /** | 79 /** |
79 * Send PREQ function | 80 * Send PREQ function |
80 * \param preq the PREQ | 81 * \param preq vector of PREQ information elements |
81 */ | 82 */ |
82 void SendPreq (std::vector<IePreq> preq); | 83 void SendPreq (std::vector<IePreq> preq); |
83 /** | 84 /** |
84 * Send PREP function | 85 * Send PREP function |
85 * \param prep the PREP | 86 * \param prep the PREP information element |
86 * \param receiver the MAC address | 87 * \param receiver the MAC address of the receiver |
87 */ | 88 */ |
88 void SendPrep (IePrep prep, Mac48Address receiver); | 89 void SendPrep (IePrep prep, Mac48Address receiver); |
89 /** | 90 /** |
90 * Forward a path error | 91 * Forward a path error |
91 * \param destinations path error | 92 * \param destinations vector of failed destinations |
92 * \param receivers the receivers | 93 * \param receivers vector of receivers |
93 */ | 94 */ |
94 void ForwardPerr (std::vector<HwmpProtocol::FailedDestination> destinations, s
td::vector<Mac48Address> receivers); | 95 void ForwardPerr (std::vector<HwmpProtocol::FailedDestination> destinations, s
td::vector<Mac48Address> receivers); |
95 /** | 96 /** |
96 * initiate my own path error | 97 * initiate my own path error |
97 * \param destinations the path error | 98 * \param destinations vector of failed destinations |
98 * \param receivers the receivers | 99 * \param receivers vector of receivers |
99 */ | 100 */ |
100 void InitiatePerr (std::vector<HwmpProtocol::FailedDestination> destinations,
std::vector<Mac48Address> receivers); | 101 void InitiatePerr (std::vector<HwmpProtocol::FailedDestination> destinations,
std::vector<Mac48Address> receivers); |
101 /** \brief Request a destination. If can not send preq immediately - | 102 /** |
102 * add a destination to existing PREQ generated by me and stored in | 103 * Request a destination. If cannot send PREQ immediately, add a |
103 * PREQ queue | 104 * destination to existing PREQ generated by me and stored in PREQ queue |
104 * \param dest is the destination to be resolved | 105 * \param dest is the destination to be resolved |
105 * \param originator_seqno is a sequence number that shall be preq originator
sequenece number | 106 * \param originator_seqno is a sequence number that shall be preq originator
sequenece number |
106 * \param dst_seqno is a sequence number taken from routing table | 107 * \param dst_seqno is a sequence number taken from routing table |
107 */ | 108 */ |
108 void RequestDestination (Mac48Address dest, uint32_t originator_seqno, uint32_
t dst_seqno); | 109 void RequestDestination (Mac48Address dest, uint32_t originator_seqno, uint32_
t dst_seqno); |
109 //\} | 110 //\} |
110 | 111 |
111 /// Sends one PREQ when PreqMinInterval after last PREQ expires (if any PREQ e
xists in rhe queue) | 112 /// Sends one PREQ when PreqMinInterval after last PREQ expires (if any PREQ e
xists in rhe queue) |
112 void SendMyPreq (); | 113 void SendMyPreq (); |
113 /// Send PERR function | 114 /// Send PERR function |
114 void SendMyPerr (); | 115 void SendMyPerr (); |
115 /** | 116 /** |
116 * \param peerAddress peer address | 117 * \param peerAddress peer address |
117 * \return metric to HWMP protocol, needed only by metrics to add peer as rout
ing entry | 118 * \return metric to HWMP protocol, needed only by metrics to add peer as rout
ing entry |
118 */ | 119 */ |
119 uint32_t GetLinkMetric (Mac48Address peerAddress) const; | 120 uint32_t GetLinkMetric (Mac48Address peerAddress) const; |
120 /** | 121 /** |
121 * Get channel ID function | 122 * Get the channel ID· |
122 * \returns the channel ID | 123 * \returns the channel ID |
123 */ | 124 */ |
124 uint16_t GetChannelId () const; | 125 uint16_t GetChannelId () const; |
125 /** | 126 /** |
126 * Report statistics | 127 * Report statistics |
127 * \param os The output stream | 128 * \param os The output stream on which to report |
128 */ | 129 */ |
129 void Report (std::ostream & os) const; | 130 void Report (std::ostream & os) const; |
130 /// Reset statistics | 131 /// Reset statistics |
131 void ResetStats (); | 132 void ResetStats (); |
132 private: | 133 private: |
133 Ptr<MeshWifiInterfaceMac> m_parent; ///< parent | 134 Ptr<MeshWifiInterfaceMac> m_parent; ///< parent |
134 uint32_t m_ifIndex; ///< IF index | 135 uint32_t m_ifIndex; ///< IF index |
135 Ptr<HwmpProtocol> m_protocol; ///< protocol | 136 Ptr<HwmpProtocol> m_protocol; ///< protocol |
136 | 137 |
137 ///\name my PREQ and PREQ timer: | 138 ///\name my PREQ and PREQ timer: |
(...skipping 22 matching lines...) Expand all Loading... |
160 uint16_t txPerr; ///< transmit PERR | 161 uint16_t txPerr; ///< transmit PERR |
161 uint16_t rxPerr; ///< receive PERR | 162 uint16_t rxPerr; ///< receive PERR |
162 uint16_t txMgt; ///< transmit management | 163 uint16_t txMgt; ///< transmit management |
163 uint32_t txMgtBytes; ///< transmit management bytes | 164 uint32_t txMgtBytes; ///< transmit management bytes |
164 uint16_t rxMgt; ///< receive management | 165 uint16_t rxMgt; ///< receive management |
165 uint32_t rxMgtBytes; ///< receive management bytes· | 166 uint32_t rxMgtBytes; ///< receive management bytes· |
166 uint16_t txData; ///< transmit data | 167 uint16_t txData; ///< transmit data |
167 uint32_t txDataBytes; ///< transmit data bytes | 168 uint32_t txDataBytes; ///< transmit data bytes |
168 uint16_t rxData; ///< receive data | 169 uint16_t rxData; ///< receive data |
169 uint32_t rxDataBytes; ///< receive data bytes | 170 uint32_t rxDataBytes; ///< receive data bytes |
170 /// Print function | 171 /** |
| 172 * Print function |
| 173 * \param os the output stream |
| 174 */ |
171 void Print (std::ostream & os) const; | 175 void Print (std::ostream & os) const; |
172 Statistics (); | 176 Statistics (); |
173 }; | 177 }; |
174 Statistics m_stats; ///< statistics | 178 Statistics m_stats; ///< statistics |
175 //\} | 179 //\} |
176 private: | 180 private: |
177 /** | 181 /** |
178 * Receive data frame | 182 * Receive data frame |
179 * | 183 * |
180 * \param packet· | 184 * \param packet· |
181 * \param header | 185 * \param header |
182 * \returns true if a packet was received | 186 * \returns true if a packet was received |
183 */ | 187 */ |
184 bool ReceiveData (Ptr<Packet> packet, const WifiMacHeader & header); | 188 bool ReceiveData (Ptr<Packet> packet, const WifiMacHeader & header); |
185 /** | 189 /** |
186 * Receive action management frame | 190 * Receive action management frame |
187 * | 191 * |
188 * \param packet· | 192 * \param packet· |
189 * \param header | 193 * \param header |
190 * \returns true if a packet was received | 194 * \returns true if a packet was received |
191 */ | 195 */ |
192 bool ReceiveAction (Ptr<Packet> packet, const WifiMacHeader & header); | 196 bool ReceiveAction (Ptr<Packet> packet, const WifiMacHeader & header); |
193 }; | 197 }; |
194 } // namespace dot11s | 198 } // namespace dot11s |
195 } // namespace ns3 | 199 } // namespace ns3 |
196 #endif | 200 #endif |
LEFT | RIGHT |