/usr/include/ns3.27/ns3/peer-link.h is in libns3-dev 3.27+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2009 IITP RAS
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Authors: Kirill Andreev <andreev@iitp.ru>
* Aleksey Kovalenko <kovalenko@iitp.ru>
*/
#ifndef PEER_LINK_H
#define PEER_LINK_H
#include "ns3/nstime.h"
#include "ns3/object.h"
#include "ns3/callback.h"
#include "ns3/mac48-address.h"
#include "ns3/event-id.h"
#include "ns3/ie-dot11s-beacon-timing.h"
#include "ns3/ie-dot11s-peer-management.h"
#include "ns3/ie-dot11s-configuration.h"
namespace ns3 {
namespace dot11s {
class PeerManagementProtocolMac;
/**
* \ingroup dot11s
*
* \brief Peer link model for 802.11s Peer Management protocol
*/
class PeerLink : public Object
{
public:
/// allow PeerManagementProtocol class friend access
friend class PeerManagementProtocol;
/**
* \brief Get the type ID.
* \return the object TypeId
*/
static TypeId GetTypeId ();
/// C-tor create empty link
PeerLink ();
~PeerLink ();
void DoDispose ();
/// Peer Link state:
enum PeerState {
IDLE,
OPN_SNT,
CNF_RCVD,
OPN_RCVD,
ESTAB,
HOLDING,
};
/**
* \brief Literal names of Mesh Peer Management states for use in log messages
*/
static const char* const PeerStateNames[6];
/**
* Process beacon received from peer
*
* \param lastBeacon the last beacon
* \param BeaconInterval the beacon interval
*/
void SetBeaconInformation (Time lastBeacon, Time BeaconInterval);
/**
* \brief Method used to detect peer link changes
*
* \param cb is a callback, which notifies, that on interface (uint32_t), peer link
* with address (Mac48Address) was opened (bool is true) or closed (bool is false)
*/
void SetLinkStatusCallback (Callback<void, uint32_t, Mac48Address, bool> cb);
/**
* \name Peer link getters/setters
* \{
*/
void SetPeerAddress (Mac48Address macaddr);
void SetPeerMeshPointAddress (Mac48Address macaddr);
void SetInterface (uint32_t interface);
void SetLocalLinkId (uint16_t id);
void SetLocalAid (uint16_t aid);
uint16_t GetPeerAid () const;
void SetBeaconTimingElement (IeBeaconTiming beaconTiming);
Mac48Address GetPeerAddress () const;
uint16_t GetLocalAid () const;
Time GetLastBeacon () const;
Time GetBeaconInterval () const;
IeBeaconTiming GetBeaconTimingElement () const;
//IePeerManagement GetPeerLinkDescriptorElement ()const;
//\}
/**
* \name MLME
* \{
*/
/**
* MLME-CancelPeerLink.request
* \param reason the reason for the request
*/
void MLMECancelPeerLink (PmpReasonCode reason);
/// MLME-ActivePeerLinkOpen.request
void MLMEActivePeerLinkOpen ();
/// MLME-PeeringRequestReject
void MLMEPeeringRequestReject ();
/// Callback type for MLME-SignalPeerLinkStatus event
typedef Callback<void, uint32_t, Mac48Address, Mac48Address, PeerLink::PeerState, PeerLink::PeerState> SignalStatusCallback;
/**
* Set callback
* \param cb the callback function
*/
void MLMESetSignalStatusCallback (SignalStatusCallback cb);
/// Reports about transmission success/failure
void TransmissionSuccess ();
void TransmissionFailure ();
//\}
/**
* \brief Statistics
* \param os the output stream
*/
void Report (std::ostream & os) const;
private:
/// Peer link events, see 802.11s draft 11B.3.3.2
enum PeerEvent
{
CNCL, ///< Cancel peer link
ACTOPN, ///< Active peer link open
CLS_ACPT, ///< PeerLinkClose_Accept
OPN_ACPT, ///< PeerLinkOpen_Accept
OPN_RJCT, ///< PeerLinkOpen_Reject
REQ_RJCT, ///< PeerLinkOpenReject by internal reason
CNF_ACPT, ///< PeerLinkConfirm_Accept
CNF_RJCT, ///< PeerLinkConfirm_Reject
TOR1, ///< Timeout of retry timer
TOR2, ///< also timeout of retry timer
TOC, ///< Timeout of confirm timer
TOH ///< Timeout of holding (graceful closing) timer
};
/**
* State transition
*
* \param event the event to update the state machine
* \param reasoncode the reason for the state transition
*/
void StateMachine (PeerEvent event, PmpReasonCode = REASON11S_RESERVED);
/**
* \name Link response to received management frames
*
* \attention In all this methods {local/peer}LinkID correspond to _peer_ station, as written in
* received frame, e.g. I am peerLinkID and peer link is localLinkID .
*
* \{
*/
/**
* Close link
*
* \param localLinkID the local link ID
* \param peerLinkID the peer link ID
* \param reason the reason to close
*/
void Close (uint16_t localLinkID, uint16_t peerLinkID, PmpReasonCode reason);
/**
* Accept open link
*
* \param localLinkId the local link ID
* \param conf the IE configuration
* \param peerMp the peer MP
*/
void OpenAccept (uint16_t localLinkId, IeConfiguration conf, Mac48Address peerMp);
/**
* Reject open link
*
* \param localLinkId the local link ID
* \param conf the IE configuration
* \param peerMp the peer MP
* \param reason the reason to close
*/
void OpenReject (uint16_t localLinkId, IeConfiguration conf, Mac48Address peerMp, PmpReasonCode reason);
/**
* Confirm accept
*
* \param localLinkId the local link ID
* \param peerLinkId the peer link ID
* \param peerAid the peer AID
* \param conf the IE configuration
* \param peerMp the peer MP
*/
void ConfirmAccept (
uint16_t localLinkId,
uint16_t peerLinkId,
uint16_t peerAid,
IeConfiguration conf,
Mac48Address peerMp
);
/**
* Confirm reject
*
* \param localLinkId the local link ID
* \param peerLinkId the peer link ID
* \param conf the IE configuration
* \param peerMp the peer MP
* \param reason the reason to close
*/
void ConfirmReject (
uint16_t localLinkId,
uint16_t peerLinkId,
IeConfiguration conf,
Mac48Address peerMp,
PmpReasonCode reason
);
//\}
/**
* \returns True if link is established
*/
bool LinkIsEstab () const;
/**
* \returns True if link is idle. Link can be deleted in this state
*/
bool LinkIsIdle () const;
/**
* Set pointer to MAC-plugin, which is responsible for sending peer
* link management frames
* \param plugin the peer management protocol MAC
*/
void SetMacPlugin (Ptr<PeerManagementProtocolMac> plugin);
/**
* \name Event handlers
* \{
*/
void ClearRetryTimer ();
void ClearConfirmTimer ();
void ClearHoldingTimer ();
void SetHoldingTimer ();
void SetRetryTimer ();
void SetConfirmTimer ();
//\}
/**
* \name Work with management frames
* \{
*/
void SendPeerLinkClose (PmpReasonCode reasoncode);
void SendPeerLinkOpen ();
void SendPeerLinkConfirm ();
//\}
/**
* \name Timeout handlers
* \{
*/
void HoldingTimeout ();
void RetryTimeout ();
void ConfirmTimeout ();
//\}
/// Several successive beacons were lost, close link
void BeaconLoss ();
private:
/**
* assignment operator
* \param link the peer link
* \returns the peer link assigned
*/
PeerLink& operator= (const PeerLink & link);
/**
* type conversion operator
* \returns the peer link
*/
PeerLink (const PeerLink &);
/// The number of interface I am associated with
uint32_t m_interface;
/// pointer to MAC plugin, which is responsible for peer management
Ptr<PeerManagementProtocolMac> m_macPlugin;
/// Peer address
Mac48Address m_peerAddress;
/// Mesh point address, equal to peer address in case of single
/// interface mesh point
Mac48Address m_peerMeshPointAddress;
/// My ID of this link
uint16_t m_localLinkId;
/// Peer ID of this link
uint16_t m_peerLinkId;
/// My association ID
uint16_t m_assocId;
/// Assoc Id assigned to me by peer
uint16_t m_peerAssocId;
/// When last beacon was received
Time m_lastBeacon;
/// Current beacon interval on corresponding interface
Time m_beaconInterval;
/// How many successive packets were failed to transmit
uint16_t m_packetFail;
/// Current state
PeerState m_state;
/**
* \brief Mesh interface configuration
* \attention Is not used now, nothing to configure :)
*/
IeConfiguration m_configuration;
/// Beacon timing element received from the peer. Needed by BCA
IeBeaconTiming m_beaconTiming;
/**
* \name Timers & counters used for internal state transitions
* \{
*/
uint16_t m_dot11MeshMaxRetries;
Time m_dot11MeshRetryTimeout;
Time m_dot11MeshHoldingTimeout;
Time m_dot11MeshConfirmTimeout;
EventId m_retryTimer;
EventId m_holdingTimer;
EventId m_confirmTimer;
uint16_t m_retryCounter;
EventId m_beaconLossTimer;
uint16_t m_maxBeaconLoss;
uint16_t m_maxPacketFail;
// \}
/// How to report my status change
SignalStatusCallback m_linkStatusCallback;
};
} // namespace dot11s
} // namespace ns3
#endif /* PEER_LINK_H */
|