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:
46  friend class PeerManagementProtocol;
48  static TypeId GetTypeId ();
50  PeerLink ();
51  ~PeerLink ();
52  void DoDispose ();
54  enum PeerState {
61  };
63  void SetBeaconInformation (Time lastBeacon, Time BeaconInterval);
75  void SetPeerAddress (Mac48Address macaddr);
77  void SetInterface (uint32_t interface);
78  void SetLocalLinkId (uint16_t id);
79  void SetLocalAid (uint16_t aid);
80  uint16_t GetPeerAid () const;
81  void SetBeaconTimingElement (IeBeaconTiming beaconTiming);
83  uint16_t GetLocalAid () const;
84  Time GetLastBeacon () const;
85  Time GetBeaconInterval () const;
87  //IePeerManagement GetPeerLinkDescriptorElement ()const;
88  //\}
89 
94  void MLMECancelPeerLink (PmpReasonCode reason);
97  void MLMEActivePeerLinkOpen ();
103  void MLMESetSignalStatusCallback (SignalStatusCallback);
105  void TransmissionSuccess ();
106  void TransmissionFailure ();
107  //\}
109  void Report (std::ostream & os) const;
110 private:
113  {
124  TOC,
125  TOH,
126  };
137  void Close (uint16_t localLinkID, uint16_t peerLinkID, PmpReasonCode reason);
140  void OpenAccept (uint16_t localLinkId, IeConfiguration conf, Mac48Address peerMp);
142  void OpenReject (uint16_t localLinkId, IeConfiguration conf, Mac48Address peerMp, PmpReasonCode reason);
144  void ConfirmAccept (
145  uint16_t localLinkId,
146  uint16_t peerLinkId,
147  uint16_t peerAid,
149  Mac48Address peerMp
150  );
152  void ConfirmReject (
153  uint16_t localLinkId,
154  uint16_t peerLinkId,
156  Mac48Address peerMp,
157  PmpReasonCode reason
158  );
159  //\}
161  bool LinkIsEstab () const;
163  bool LinkIsIdle () const;
173  void ClearRetryTimer ();
174  void ClearConfirmTimer ();
175  void ClearHoldingTimer ();
176  void SetHoldingTimer ();
177  void SetRetryTimer ();
178  void SetConfirmTimer ();
179  //\}
180 
185  void SendPeerLinkClose (PmpReasonCode reasoncode);
186  void SendPeerLinkOpen ();
187  void SendPeerLinkConfirm ();
188  //\}
189 
194  void HoldingTimeout ();
195  void RetryTimeout ();
196  void ConfirmTimeout ();
197  //\}
199  void BeaconLoss ();
200 private:
201 
202  PeerLink& operator= (const PeerLink &);
203  PeerLink (const PeerLink &);
204 
206  uint32_t m_interface;
215  uint16_t m_localLinkId;
217  uint16_t m_peerLinkId;
219  uint16_t m_assocId;
221  uint16_t m_peerAssocId;
222 
228  uint16_t m_packetFail;
229 
239 
248 
252  uint16_t m_retryCounter;
254  uint16_t m_maxBeaconLoss;
255  uint16_t m_maxPacketFail;
256  // \}
258  SignalStatusCallback m_linkStatusCallback;
259 };
260 
261 } // namespace dot11s
262 } // namespace ns3
263 
264 #endif /* PEER_LINK_H */
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:102
Callback template class.
Definition: callback.h:1176
PeerLinkOpen_Reject.
Definition: peer-link.h:118
Definition: conf.py:1
PeerState
Peer Link state:
Definition: peer-link.h:54
Timeout of confirm timer.
Definition: peer-link.h:124
See 7.3.2.89 of 802.11s draft 2.07.
PeerLinkConfirm_Accept.
Definition: peer-link.h:120
PeerLinkOpen_Accept.
Definition: peer-link.h:117
Timeout of holding (graceful closing) timer.
Definition: peer-link.h:125
Every class exported by the ns3 library is enclosed in the ns3 namespace.
an EUI-48 address
Definition: mac48-address.h:43
PeerLinkConfirm_Reject.
Definition: peer-link.h:121
Cancel peer link.
Definition: peer-link.h:114
also timeout of retry timer
Definition: peer-link.h:123
Active peer link open.
Definition: peer-link.h:115
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.
PeerEvent
Peer link events, see 802.11s draft 11B.3.3.2.
Definition: peer-link.h:112
A base class which provides memory management and object aggregation.
Definition: object.h:87
PeerLinkOpenReject by internal reason.
Definition: peer-link.h:119
PeerLinkClose_Accept.
Definition: peer-link.h:116
a unique identifier for an interface.
Definition: type-id.h:58
Timeout of retry timer.
Definition: peer-link.h:122
802.11s Peer Management Protocol model