A Discrete-Event Network Simulator
API
peer-link.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009 IITP RAS
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Authors: Kirill Andreev <andreev@iitp.ru>
18  * Aleksey Kovalenko <kovalenko@iitp.ru>
19  */
20 
21 #ifndef PEER_LINK_H
22 #define PEER_LINK_H
23 
27 
28 #include "ns3/callback.h"
29 #include "ns3/event-id.h"
30 #include "ns3/mac48-address.h"
31 #include "ns3/nstime.h"
32 #include "ns3/object.h"
33 
34 namespace ns3
35 {
36 namespace dot11s
37 {
38 
39 class PeerManagementProtocolMac;
40 
46 class PeerLink : public Object
47 {
48  public:
50  friend class PeerManagementProtocol;
55  static TypeId GetTypeId();
57  PeerLink();
58  ~PeerLink() override;
59 
60  // Delete copy constructor and assignment operator to avoid misuse
61  PeerLink(const PeerLink&) = delete;
62  PeerLink& operator=(const PeerLink&) = delete;
63 
64  void DoDispose() override;
65 
67  enum PeerState
68  {
75  };
76 
80  static const char* const PeerStateNames[6];
87  void SetBeaconInformation(Time lastBeacon, Time BeaconInterval);
97 
101  void SetPeerAddress(Mac48Address macaddr);
111  void SetInterface(uint32_t interface);
116  void SetLocalLinkId(uint16_t id);
121  void SetLocalAid(uint16_t aid);
126  uint16_t GetPeerAid() const;
131  void SetBeaconTimingElement(IeBeaconTiming beaconTiming);
141  uint16_t GetLocalAid() const;
146  Time GetLastBeacon() const;
151  Time GetBeaconInterval() const;
157  // IePeerManagement GetPeerLinkDescriptorElement ()const;
159 
162 
166  void MLMECancelPeerLink(PmpReasonCode reason);
168  void MLMEActivePeerLinkOpen();
172  typedef Callback<void,
173  uint32_t,
174  Mac48Address,
175  Mac48Address,
185  void TransmissionSuccess();
186  void TransmissionFailure();
188 
193  void Report(std::ostream& os) const;
194 
195  private:
198  {
209  TOC,
210  TOH
211  };
212 
228 
235  void Close(uint16_t localLinkID, uint16_t peerLinkID, PmpReasonCode reason);
243  void OpenAccept(uint16_t localLinkId, IeConfiguration conf, Mac48Address peerMp);
252  void OpenReject(uint16_t localLinkId,
254  Mac48Address peerMp,
255  PmpReasonCode reason);
265  void ConfirmAccept(uint16_t localLinkId,
266  uint16_t peerLinkId,
267  uint16_t peerAid,
269  Mac48Address peerMp);
279  void ConfirmReject(uint16_t localLinkId,
280  uint16_t peerLinkId,
282  Mac48Address peerMp,
283  PmpReasonCode reason);
285 
289  bool LinkIsEstab() const;
293  bool LinkIsIdle() const;
305  void ClearRetryTimer();
307  void ClearConfirmTimer();
309  void ClearHoldingTimer();
311  void SetHoldingTimer();
313  void SetRetryTimer();
315  void SetConfirmTimer();
317 
322 
326  void SendPeerLinkClose(PmpReasonCode reasoncode);
328  void SendPeerLinkOpen();
330  void SendPeerLinkConfirm();
332 
338  void HoldingTimeout();
340  void RetryTimeout();
342  void ConfirmTimeout();
344 
346  void BeaconLoss();
347 
348  private:
350  uint32_t m_interface;
359  uint16_t m_localLinkId;
361  uint16_t m_peerLinkId;
363  uint16_t m_assocId;
365  uint16_t m_peerAssocId;
366 
372  uint16_t m_packetFail;
373 
383 
392 
396  uint16_t m_retryCounter;
398  uint16_t m_maxBeaconLoss;
399  uint16_t m_maxPacketFail;
401 
404 };
405 
406 } // namespace dot11s
407 } // namespace ns3
408 
409 #endif /* PEER_LINK_H */
Callback template class.
Definition: callback.h:438
An identifier for simulation events.
Definition: event-id.h:55
an EUI-48 address
Definition: mac48-address.h:46
A base class which provides memory management and object aggregation.
Definition: object.h:89
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
See 7.3.2.89 of 802.11s draft 2.07.
Describes Mesh Configuration Element see 7.3.2.86 of 802.11s draft 3.0.
802.11s Peer Management Protocol model
PmpReasonCode
Codes used by 802.11s Peer Management Protocol.
Definition: conf.py:1
Every class exported by the ns3 library is enclosed in the ns3 namespace.