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 
24 #include "ns3/callback.h"
25 #include "ns3/event-id.h"
26 #include "ns3/ie-dot11s-beacon-timing.h"
27 #include "ns3/ie-dot11s-configuration.h"
28 #include "ns3/ie-dot11s-peer-management.h"
29 #include "ns3/mac48-address.h"
30 #include "ns3/nstime.h"
31 #include "ns3/object.h"
32 
33 namespace ns3
34 {
35 namespace dot11s
36 {
37 
38 class PeerManagementProtocolMac;
39 
45 class PeerLink : public Object
46 {
47  public:
49  friend class PeerManagementProtocol;
54  static TypeId GetTypeId();
56  PeerLink();
57  ~PeerLink() override;
58 
59  // Delete copy constructor and assignment operator to avoid misuse
60  PeerLink(const PeerLink&) = delete;
61  PeerLink& operator=(const PeerLink&) = delete;
62 
63  void DoDispose() override;
64 
66  enum PeerState
67  {
74  };
75 
79  static const char* const PeerStateNames[6];
86  void SetBeaconInformation(Time lastBeacon, Time BeaconInterval);
96 
100  void SetPeerAddress(Mac48Address macaddr);
110  void SetInterface(uint32_t interface);
115  void SetLocalLinkId(uint16_t id);
120  void SetLocalAid(uint16_t aid);
125  uint16_t GetPeerAid() const;
130  void SetBeaconTimingElement(IeBeaconTiming beaconTiming);
140  uint16_t GetLocalAid() const;
145  Time GetLastBeacon() const;
150  Time GetBeaconInterval() const;
156  // IePeerManagement GetPeerLinkDescriptorElement ()const;
158 
161 
165  void MLMECancelPeerLink(PmpReasonCode reason);
167  void MLMEActivePeerLinkOpen();
171  typedef Callback<void,
172  uint32_t,
173  Mac48Address,
174  Mac48Address,
184  void TransmissionSuccess();
185  void TransmissionFailure();
187 
192  void Report(std::ostream& os) const;
193 
194  private:
197  {
208  TOC,
209  TOH
210  };
211 
227 
234  void Close(uint16_t localLinkID, uint16_t peerLinkID, PmpReasonCode reason);
242  void OpenAccept(uint16_t localLinkId, IeConfiguration conf, Mac48Address peerMp);
251  void OpenReject(uint16_t localLinkId,
253  Mac48Address peerMp,
254  PmpReasonCode reason);
264  void ConfirmAccept(uint16_t localLinkId,
265  uint16_t peerLinkId,
266  uint16_t peerAid,
268  Mac48Address peerMp);
278  void ConfirmReject(uint16_t localLinkId,
279  uint16_t peerLinkId,
281  Mac48Address peerMp,
282  PmpReasonCode reason);
284 
288  bool LinkIsEstab() const;
292  bool LinkIsIdle() const;
304  void ClearRetryTimer();
306  void ClearConfirmTimer();
308  void ClearHoldingTimer();
310  void SetHoldingTimer();
312  void SetRetryTimer();
314  void SetConfirmTimer();
316 
321 
325  void SendPeerLinkClose(PmpReasonCode reasoncode);
327  void SendPeerLinkOpen();
329  void SendPeerLinkConfirm();
331 
337  void HoldingTimeout();
339  void RetryTimeout();
341  void ConfirmTimeout();
343 
345  void BeaconLoss();
346 
347  private:
349  uint32_t m_interface;
358  uint16_t m_localLinkId;
360  uint16_t m_peerLinkId;
362  uint16_t m_assocId;
364  uint16_t m_peerAssocId;
365 
371  uint16_t m_packetFail;
372 
382 
391 
395  uint16_t m_retryCounter;
397  uint16_t m_maxBeaconLoss;
398  uint16_t m_maxPacketFail;
400 
403 };
404 
405 } // namespace dot11s
406 } // namespace ns3
407 
408 #endif /* PEER_LINK_H */
Callback template class.
Definition: callback.h:443
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:60
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.