A Discrete-Event Network Simulator
API
peer-link.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 IITP RAS
4  *
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
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Authors: Kirill Andreev <andreev@iitp.ru>
19  * Aleksey Kovalenko <kovalenko@iitp.ru>
20  */
21 
22 #ifndef PEER_LINK_H
23 #define PEER_LINK_H
24 
25 #include "ns3/nstime.h"
26 #include "ns3/object.h"
27 #include "ns3/callback.h"
28 #include "ns3/mac48-address.h"
29 #include "ns3/event-id.h"
30 #include "ns3/ie-dot11s-beacon-timing.h"
31 #include "ns3/ie-dot11s-peer-management.h"
32 #include "ns3/ie-dot11s-configuration.h"
33 
34 namespace ns3 {
35 namespace dot11s {
36 
37 class PeerManagementProtocolMac;
43 class PeerLink : public Object
44 {
45 public:
47  friend class PeerManagementProtocol;
52  static TypeId GetTypeId ();
54  PeerLink ();
55  ~PeerLink ();
56  void DoDispose ();
58  enum PeerState {
65  };
69  static const char* const PeerStateNames[6];
76  void SetBeaconInformation (Time lastBeacon, Time BeaconInterval);
86 
90  void SetPeerAddress (Mac48Address macaddr);
100  void SetInterface (uint32_t interface);
105  void SetLocalLinkId (uint16_t id);
110  void SetLocalAid (uint16_t aid);
115  uint16_t GetPeerAid () const;
120  void SetBeaconTimingElement (IeBeaconTiming beaconTiming);
125  Mac48Address GetPeerAddress () const;
130  uint16_t GetLocalAid () const;
135  Time GetLastBeacon () const;
140  Time GetBeaconInterval () const;
146  //IePeerManagement GetPeerLinkDescriptorElement ()const;
148 
151 
155  void MLMECancelPeerLink (PmpReasonCode reason);
157  void MLMEActivePeerLinkOpen ();
159  void MLMEPeeringRequestReject ();
168  void TransmissionSuccess ();
169  void TransmissionFailure ();
171 
176  void Report (std::ostream & os) const;
177 private:
180  {
191  TOC,
192  TOH
193  };
209 
216  void Close (uint16_t localLinkID, uint16_t peerLinkID, PmpReasonCode reason);
224  void OpenAccept (uint16_t localLinkId, IeConfiguration conf, Mac48Address peerMp);
233  void OpenReject (uint16_t localLinkId, IeConfiguration conf, Mac48Address peerMp, PmpReasonCode reason);
243  void ConfirmAccept (
244  uint16_t localLinkId,
245  uint16_t peerLinkId,
246  uint16_t peerAid,
248  Mac48Address peerMp
249  );
259  void ConfirmReject (
260  uint16_t localLinkId,
261  uint16_t peerLinkId,
263  Mac48Address peerMp,
264  PmpReasonCode reason
265  );
267 
271  bool LinkIsEstab () const;
275  bool LinkIsIdle () const;
287  void ClearRetryTimer ();
289  void ClearConfirmTimer ();
291  void ClearHoldingTimer ();
293  void SetHoldingTimer ();
295  void SetRetryTimer ();
297  void SetConfirmTimer ();
299 
304 
308  void SendPeerLinkClose (PmpReasonCode reasoncode);
310  void SendPeerLinkOpen ();
312  void SendPeerLinkConfirm ();
314 
320  void HoldingTimeout ();
322  void RetryTimeout ();
324  void ConfirmTimeout ();
326 
328  void BeaconLoss ();
329 private:
330 
336  PeerLink& operator= (const PeerLink & link);
341  PeerLink (const PeerLink & o);
342 
344  uint32_t m_interface;
353  uint16_t m_localLinkId;
355  uint16_t m_peerLinkId;
357  uint16_t m_assocId;
359  uint16_t m_peerAssocId;
360 
366  uint16_t m_packetFail;
367 
377 
386 
390  uint16_t m_retryCounter;
392  uint16_t m_maxBeaconLoss;
393  uint16_t m_maxPacketFail;
395 
398 };
399 
400 } // namespace dot11s
401 } // namespace ns3
402 
403 #endif /* PEER_LINK_H */
Callback template class.
Definition: callback.h:1279
An identifier for simulation events.
Definition: event-id.h:54
an EUI-48 address
Definition: mac48-address.h:44
A base class which provides memory management and object aggregation.
Definition: object.h:88
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
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.