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);
88  void SetPeerAddress (Mac48Address macaddr);
90  void SetInterface (uint32_t interface);
91  void SetLocalLinkId (uint16_t id);
92  void SetLocalAid (uint16_t aid);
93  uint16_t GetPeerAid () const;
94  void SetBeaconTimingElement (IeBeaconTiming beaconTiming);
96  uint16_t GetLocalAid () const;
97  Time GetLastBeacon () const;
98  Time GetBeaconInterval () const;
100  //IePeerManagement GetPeerLinkDescriptorElement ()const;
101  //\}
102 
111  void MLMECancelPeerLink (PmpReasonCode reason);
113  void MLMEActivePeerLinkOpen ();
115  void MLMEPeeringRequestReject ();
124  void TransmissionSuccess ();
125  void TransmissionFailure ();
126  //\}
131  void Report (std::ostream & os) const;
132 private:
135  {
146  TOC,
148  };
171  void Close (uint16_t localLinkID, uint16_t peerLinkID, PmpReasonCode reason);
179  void OpenAccept (uint16_t localLinkId, IeConfiguration conf, Mac48Address peerMp);
188  void OpenReject (uint16_t localLinkId, IeConfiguration conf, Mac48Address peerMp, PmpReasonCode reason);
198  void ConfirmAccept (
199  uint16_t localLinkId,
200  uint16_t peerLinkId,
201  uint16_t peerAid,
203  Mac48Address peerMp
204  );
214  void ConfirmReject (
215  uint16_t localLinkId,
216  uint16_t peerLinkId,
218  Mac48Address peerMp,
219  PmpReasonCode reason
220  );
221  //\}
225  bool LinkIsEstab () const;
229  bool LinkIsIdle () const;
240  void ClearRetryTimer ();
241  void ClearConfirmTimer ();
242  void ClearHoldingTimer ();
243  void SetHoldingTimer ();
244  void SetRetryTimer ();
245  void SetConfirmTimer ();
246  //\}
247 
252  void SendPeerLinkClose (PmpReasonCode reasoncode);
253  void SendPeerLinkOpen ();
254  void SendPeerLinkConfirm ();
255  //\}
256 
261  void HoldingTimeout ();
262  void RetryTimeout ();
263  void ConfirmTimeout ();
264  //\}
266  void BeaconLoss ();
267 private:
268 
274  PeerLink& operator= (const PeerLink & link);
279  PeerLink (const PeerLink &);
280 
282  uint32_t m_interface;
291  uint16_t m_localLinkId;
293  uint16_t m_peerLinkId;
295  uint16_t m_assocId;
297  uint16_t m_peerAssocId;
298 
304  uint16_t m_packetFail;
305 
315 
324 
328  uint16_t m_retryCounter;
330  uint16_t m_maxBeaconLoss;
331  uint16_t m_maxPacketFail;
332  // \}
335 };
336 
337 } // namespace dot11s
338 } // namespace ns3
339 
340 #endif /* PEER_LINK_H */
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
Callback template class.
Definition: callback.h:1176
Definition: conf.py:1
See 7.3.2.89 of 802.11s draft 2.07.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
an EUI-48 address
Definition: mac48-address.h:43
An identifier for simulation events.
Definition: event-id.h:53
PmpReasonCode
Codes used by 802.11s Peer Management Protocol.
Describes Mesh Configuration Element see 7.3.2.86 of 802.11s draft 3.0.
A base class which provides memory management and object aggregation.
Definition: object.h:87
a unique identifier for an interface.
Definition: type-id.h:58
802.11s Peer Management Protocol model