LEFT | RIGHT |
(no file at all) | |
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) 2009 IITP RAS | 3 * Copyright (c) 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 25 matching lines...) Expand all Loading... |
36 | 36 |
37 class PeerManagementProtocolMac; | 37 class PeerManagementProtocolMac; |
38 /** | 38 /** |
39 * \ingroup dot11s | 39 * \ingroup dot11s |
40 * | 40 * |
41 * \brief Peer link model for 802.11s Peer Management protocol | 41 * \brief Peer link model for 802.11s Peer Management protocol |
42 */ | 42 */ |
43 class PeerLink : public Object | 43 class PeerLink : public Object |
44 { | 44 { |
45 public: | 45 public: |
| 46 /// allow PeerManagementProtocol class friend access |
46 friend class PeerManagementProtocol; | 47 friend class PeerManagementProtocol; |
47 /// Support object system | 48 /** |
| 49 * \brief Get the type ID. |
| 50 * \return the object TypeId |
| 51 */ |
48 static TypeId GetTypeId (); | 52 static TypeId GetTypeId (); |
49 /// C-tor create empty link | 53 /// C-tor create empty link |
50 PeerLink (); | 54 PeerLink (); |
51 ~PeerLink (); | 55 ~PeerLink (); |
52 void DoDispose (); | 56 void DoDispose (); |
53 /// Peer Link state: | 57 /// Peer Link state: |
54 enum PeerState { | 58 enum PeerState { |
55 IDLE, | 59 IDLE, |
56 OPN_SNT, | 60 OPN_SNT, |
57 CNF_RCVD, | 61 CNF_RCVD, |
58 OPN_RCVD, | 62 OPN_RCVD, |
59 ESTAB, | 63 ESTAB, |
60 HOLDING, | 64 HOLDING, |
61 }; | 65 }; |
62 /** | 66 /** |
63 * \brief Literal names of Mesh Peer Management states for use in log messages | 67 * \brief Literal names of Mesh Peer Management states for use in log messages |
64 */ | 68 */ |
65 static const char* const PeerStateNames[6]; | 69 static const char* const PeerStateNames[6]; |
66 /// Process beacon received from peer | 70 /** |
| 71 * Process beacon received from peer |
| 72 *· |
| 73 * \param lastBeacon the last beacon |
| 74 * \param BeaconInterval the beacon interval |
| 75 */ |
67 void SetBeaconInformation (Time lastBeacon, Time BeaconInterval); | 76 void SetBeaconInformation (Time lastBeacon, Time BeaconInterval); |
68 /** | 77 /** |
69 * \brief Method used to detect peer link changes | 78 * \brief Method used to detect peer link changes |
70 * | 79 * |
71 * \param cb is a callback, which notifies, that on interface (uint32_t), peer
link | 80 * \param cb is a callback, which notifies, that on interface (uint32_t), peer
link |
72 * with address (Mac48Address) was opened (bool is true) or closed (bool is fa
lse)· | 81 * with address (Mac48Address) was opened (bool is true) or closed (bool is fa
lse)· |
73 */ | 82 */ |
74 void SetLinkStatusCallback (Callback<void, uint32_t, Mac48Address, bool> cb); | 83 void SetLinkStatusCallback (Callback<void, uint32_t, Mac48Address, bool> cb); |
75 /** | 84 /** |
76 * \name Peer link getters/setters | 85 * \name Peer link getters/setters |
(...skipping 11 matching lines...) Expand all Loading... |
88 Time GetLastBeacon () const; | 97 Time GetLastBeacon () const; |
89 Time GetBeaconInterval () const; | 98 Time GetBeaconInterval () const; |
90 IeBeaconTiming GetBeaconTimingElement () const; | 99 IeBeaconTiming GetBeaconTimingElement () const; |
91 //IePeerManagement GetPeerLinkDescriptorElement ()const; | 100 //IePeerManagement GetPeerLinkDescriptorElement ()const; |
92 //\} | 101 //\} |
93 | 102 |
94 /** | 103 /** |
95 * \name MLME | 104 * \name MLME |
96 * \{ | 105 * \{ |
97 */ | 106 */ |
98 /// MLME-CancelPeerLink.request | 107 /** |
| 108 * MLME-CancelPeerLink.request |
| 109 * \param reason the reason for the request |
| 110 */ |
99 void MLMECancelPeerLink (PmpReasonCode reason); | 111 void MLMECancelPeerLink (PmpReasonCode reason); |
100 /// MLME-ActivePeerLinkOpen.request | 112 /// MLME-ActivePeerLinkOpen.request |
101 void MLMEActivePeerLinkOpen (); | 113 void MLMEActivePeerLinkOpen (); |
102 /// MLME-PeeringRequestReject | 114 /// MLME-PeeringRequestReject |
103 void MLMEPeeringRequestReject (); | 115 void MLMEPeeringRequestReject (); |
104 /// Callback type for MLME-SignalPeerLinkStatus event | 116 /// Callback type for MLME-SignalPeerLinkStatus event |
105 typedef Callback<void, uint32_t, Mac48Address, Mac48Address, PeerLink::PeerSta
te, PeerLink::PeerState> SignalStatusCallback; | 117 typedef Callback<void, uint32_t, Mac48Address, Mac48Address, PeerLink::PeerSta
te, PeerLink::PeerState> SignalStatusCallback; |
106 /// Set callback | 118 /** |
107 void MLMESetSignalStatusCallback (SignalStatusCallback); | 119 * Set callback |
| 120 * \param cb the callback function |
| 121 */ |
| 122 void MLMESetSignalStatusCallback (SignalStatusCallback cb); |
108 /// Reports about transmission success/failure | 123 /// Reports about transmission success/failure |
109 void TransmissionSuccess (); | 124 void TransmissionSuccess (); |
110 void TransmissionFailure (); | 125 void TransmissionFailure (); |
111 //\} | 126 //\} |
112 ///\brief Statistics | 127 /** |
| 128 * \brief Statistics |
| 129 * \param os the outptu stream |
| 130 */ |
113 void Report (std::ostream & os) const; | 131 void Report (std::ostream & os) const; |
114 private: | 132 private: |
115 /// Peer link events, see 802.11s draft 11B.3.3.2 | 133 /// Peer link events, see 802.11s draft 11B.3.3.2 |
116 enum PeerEvent | 134 enum PeerEvent |
117 { | 135 { |
118 CNCL, ///< Cancel peer link | 136 CNCL, ///< Cancel peer link |
119 ACTOPN, ///< Active peer link open | 137 ACTOPN, ///< Active peer link open |
120 CLS_ACPT, ///< PeerLinkClose_Accept | 138 CLS_ACPT, ///< PeerLinkClose_Accept |
121 OPN_ACPT, ///< PeerLinkOpen_Accept | 139 OPN_ACPT, ///< PeerLinkOpen_Accept |
122 OPN_RJCT, ///< PeerLinkOpen_Reject | 140 OPN_RJCT, ///< PeerLinkOpen_Reject |
123 REQ_RJCT, ///< PeerLinkOpenReject by internal reason | 141 REQ_RJCT, ///< PeerLinkOpenReject by internal reason |
124 CNF_ACPT, ///< PeerLinkConfirm_Accept | 142 CNF_ACPT, ///< PeerLinkConfirm_Accept |
125 CNF_RJCT, ///< PeerLinkConfirm_Reject | 143 CNF_RJCT, ///< PeerLinkConfirm_Reject |
126 TOR1, ///< Timeout of retry timer | 144 TOR1, ///< Timeout of retry timer |
127 TOR2, ///< also timeout of retry timer | 145 TOR2, ///< also timeout of retry timer |
128 TOC, ///< Timeout of confirm timer | 146 TOC, ///< Timeout of confirm timer |
129 TOH, ///< Timeout of holding (graceful closing) timer | 147 TOH ///< Timeout of holding (graceful closing) timer |
130 }; | 148 }; |
131 /// State transition | 149 /** |
| 150 * State transition |
| 151 * |
| 152 * \param event the event to update the state machine |
| 153 * \param reasoncode the reason for the state transition |
| 154 */ |
132 void StateMachine (PeerEvent event, PmpReasonCode = REASON11S_RESERVED); | 155 void StateMachine (PeerEvent event, PmpReasonCode = REASON11S_RESERVED); |
133 /** | 156 /** |
134 * \name Link response to received management frames | 157 * \name Link response to received management frames |
135 * | 158 * |
136 * \attention In all this methods {local/peer}LinkID correspond to _peer_ stat
ion, as written in | 159 * \attention In all this methods {local/peer}LinkID correspond to _peer_ stat
ion, as written in |
137 * received frame, e.g. I am peerLinkID and peer link is localLinkID . | 160 * received frame, e.g. I am peerLinkID and peer link is localLinkID . |
138 * | 161 * |
139 * \{ | 162 * \{ |
140 */ | 163 */ |
141 /// Close link | 164 /** |
| 165 * Close link |
| 166 * |
| 167 * \param localLinkID the local link ID |
| 168 * \param peerLinkID the peer link ID |
| 169 * \param reason the reason to close |
| 170 */ |
142 void Close (uint16_t localLinkID, uint16_t peerLinkID, PmpReasonCode reason); | 171 void Close (uint16_t localLinkID, uint16_t peerLinkID, PmpReasonCode reason); |
143 /// Accept open link | 172 /** |
| 173 * Accept open link |
| 174 * |
| 175 * \param localLinkId the local link ID |
| 176 * \param conf the IE configuration |
| 177 * \param peerMp the peer MP |
| 178 */ |
144 void OpenAccept (uint16_t localLinkId, IeConfiguration conf, Mac48Address peer
Mp); | 179 void OpenAccept (uint16_t localLinkId, IeConfiguration conf, Mac48Address peer
Mp); |
145 /// Reject open link | 180 /** |
| 181 * Reject open link |
| 182 * |
| 183 * \param localLinkId the local link ID |
| 184 * \param conf the IE configuration |
| 185 * \param peerMp the peer MP |
| 186 * \param reason the reason to close |
| 187 */ |
146 void OpenReject (uint16_t localLinkId, IeConfiguration conf, Mac48Address peer
Mp, PmpReasonCode reason); | 188 void OpenReject (uint16_t localLinkId, IeConfiguration conf, Mac48Address peer
Mp, PmpReasonCode reason); |
147 /// Confirm accept | 189 /** |
| 190 * Confirm accept |
| 191 * |
| 192 * \param localLinkId the local link ID |
| 193 * \param peerLinkId the peer link ID |
| 194 * \param peerAid the peer AID |
| 195 * \param conf the IE configuration |
| 196 * \param peerMp the peer MP |
| 197 */ |
148 void ConfirmAccept ( | 198 void ConfirmAccept ( |
149 uint16_t localLinkId, | 199 uint16_t localLinkId, |
150 uint16_t peerLinkId, | 200 uint16_t peerLinkId, |
151 uint16_t peerAid, | 201 uint16_t peerAid, |
152 IeConfiguration conf, | 202 IeConfiguration conf, |
153 Mac48Address peerMp | 203 Mac48Address peerMp |
154 ); | 204 ); |
155 /// Confirm reject | 205 /** |
| 206 * Confirm reject |
| 207 * |
| 208 * \param localLinkId the local link ID |
| 209 * \param peerLinkId the peer link ID |
| 210 * \param conf the IE configuration |
| 211 * \param peerMp the peer MP |
| 212 * \param reason the reason to close |
| 213 */ |
156 void ConfirmReject ( | 214 void ConfirmReject ( |
157 uint16_t localLinkId, | 215 uint16_t localLinkId, |
158 uint16_t peerLinkId, | 216 uint16_t peerLinkId, |
159 IeConfiguration conf, | 217 IeConfiguration conf, |
160 Mac48Address peerMp, | 218 Mac48Address peerMp, |
161 PmpReasonCode reason | 219 PmpReasonCode reason |
162 ); | 220 ); |
163 //\} | 221 //\} |
164 /// True if link is established | 222 /** |
| 223 * \returns True if link is established |
| 224 */ |
165 bool LinkIsEstab () const; | 225 bool LinkIsEstab () const; |
166 /// True if link is idle. Link can be deleted in this state | 226 /** |
| 227 * \returns True if link is idle. Link can be deleted in this state |
| 228 */ |
167 bool LinkIsIdle () const; | 229 bool LinkIsIdle () const; |
168 /** | 230 /** |
169 * Set pointer to MAC-plugin, which is responsible for sending peer | 231 * Set pointer to MAC-plugin, which is responsible for sending peer |
170 * link management frames | 232 * link management frames |
| 233 * \param plugin the peer management protocol MAC |
171 */ | 234 */ |
172 void SetMacPlugin (Ptr<PeerManagementProtocolMac> plugin); | 235 void SetMacPlugin (Ptr<PeerManagementProtocolMac> plugin); |
173 /** | 236 /** |
174 * \name Event handlers | 237 * \name Event handlers |
175 * \{ | 238 * \{ |
176 */ | 239 */ |
177 void ClearRetryTimer (); | 240 void ClearRetryTimer (); |
178 void ClearConfirmTimer (); | 241 void ClearConfirmTimer (); |
179 void ClearHoldingTimer (); | 242 void ClearHoldingTimer (); |
180 void SetHoldingTimer (); | 243 void SetHoldingTimer (); |
(...skipping 15 matching lines...) Expand all Loading... |
196 * \{ | 259 * \{ |
197 */ | 260 */ |
198 void HoldingTimeout (); | 261 void HoldingTimeout (); |
199 void RetryTimeout (); | 262 void RetryTimeout (); |
200 void ConfirmTimeout (); | 263 void ConfirmTimeout (); |
201 //\} | 264 //\} |
202 /// Several successive beacons were lost, close link | 265 /// Several successive beacons were lost, close link |
203 void BeaconLoss (); | 266 void BeaconLoss (); |
204 private: | 267 private: |
205 | 268 |
206 /// assignment operator | 269 /** |
207 PeerLink& operator= (const PeerLink &); | 270 * assignment operator |
208 /// type conversion operator | 271 * \param link the peer link |
| 272 * \returns the peer link assigned |
| 273 */ |
| 274 PeerLink& operator= (const PeerLink & link); |
| 275 /** |
| 276 * type conversion operator |
| 277 * \returns the peer link |
| 278 */ |
209 PeerLink (const PeerLink &); | 279 PeerLink (const PeerLink &); |
210 | 280 |
211 /// The number of interface I am associated with | 281 /// The number of interface I am associated with |
212 uint32_t m_interface; | 282 uint32_t m_interface; |
213 /// pointer to MAC plugin, which is responsible for peer management | 283 /// pointer to MAC plugin, which is responsible for peer management |
214 Ptr<PeerManagementProtocolMac> m_macPlugin; | 284 Ptr<PeerManagementProtocolMac> m_macPlugin; |
215 /// Peer address | 285 /// Peer address |
216 Mac48Address m_peerAddress; | 286 Mac48Address m_peerAddress; |
217 /// Mesh point address, equal to peer address in case of single | 287 /// Mesh point address, equal to peer address in case of single |
218 /// interface mesh point | 288 /// interface mesh point |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 uint16_t m_maxPacketFail; | 331 uint16_t m_maxPacketFail; |
262 // \} | 332 // \} |
263 /// How to report my status change | 333 /// How to report my status change |
264 SignalStatusCallback m_linkStatusCallback; | 334 SignalStatusCallback m_linkStatusCallback; |
265 }; | 335 }; |
266 | 336 |
267 } // namespace dot11s | 337 } // namespace dot11s |
268 } // namespace ns3 | 338 } // namespace ns3 |
269 | 339 |
270 #endif /* PEER_LINK_H */ | 340 #endif /* PEER_LINK_H */ |
LEFT | RIGHT |