A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Portuguese
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
peer-management-protocol.h
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2008,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 DOT11S_PEER_MAN_H
23
#define DOT11S_PEER_MAN_H
24
25
#include "ns3/mac48-address.h"
26
#include "ns3/net-device.h"
27
#include "ns3/event-id.h"
28
#include "ns3/nstime.h"
29
#include "ns3/traced-value.h"
30
#include "
ie-dot11s-beacon-timing.h
"
31
#include "
ie-dot11s-peer-management.h
"
32
#include "
peer-link.h
"
33
34
#include <map>
35
namespace
ns3 {
36
class
MeshPointDevice;
37
class
UniformRandomVariable;
38
namespace
dot11s {
39
class
PeerManagementProtocolMac;
40
class
PeerLink;
41
class
IeMeshId;
42
class
IePeerManagement;
43
class
IeConfiguration;
49
class
PeerManagementProtocol
:
public
Object
50
{
51
public
:
52
PeerManagementProtocol
();
53
~PeerManagementProtocol
();
54
static
TypeId
GetTypeId
();
55
void
DoDispose
();
64
bool
Install
(
Ptr<MeshPointDevice>
);
77
Ptr<IeBeaconTiming>
GetBeaconTimingElement
(uint32_t interface);
85
void
ReceiveBeacon
(uint32_t interface,
Mac48Address
peerAddress,
Time
beaconInterval,
Ptr<IeBeaconTiming>
beaconTiming);
86
// \}
104
void
ReceivePeerLinkFrame
(
105
uint32_t interface,
106
Mac48Address
peerAddress,
107
Mac48Address
peerMeshPointAddress,
108
uint16_t aid,
109
IePeerManagement
peerManagementElement,
110
IeConfiguration
meshConfig
111
);
116
void
ConfigurationMismatch
(uint32_t interface,
Mac48Address
peerAddress);
120
void
TransmissionFailure
(uint32_t interface,
const
Mac48Address
peerAddress);
124
void
TransmissionSuccess
(uint32_t interface,
const
Mac48Address
peerAddress);
128
bool
IsActiveLink
(uint32_t interface,
Mac48Address
peerAddress);
129
// \}
131
// \{
133
void
SetPeerLinkStatusCallback
(
Callback<void, Mac48Address, Mac48Address, uint32_t, bool>
cb);
135
Ptr<PeerLink>
FindPeerLink
(uint32_t interface,
Mac48Address
peerAddress);
137
std::vector < Ptr<PeerLink> >
GetPeerLinks
()
const
;
139
std::vector<Mac48Address>
GetPeers
(uint32_t interface)
const
;
142
Mac48Address
GetAddress
();
143
uint8_t
GetNumberOfLinks
();
144
void
SetMeshId
(std::string
s
);
145
Ptr<IeMeshId>
GetMeshId
()
const
;
147
void
SetBeaconCollisionAvoidance
(
bool
enable);
148
bool
GetBeaconCollisionAvoidance
()
const
;
150
void
NotifyBeaconSent
(uint32_t interface,
Time
beaconInterval);
152
void
Report
(std::ostream &)
const
;
153
void
ResetStats
();
162
int64_t
AssignStreams
(int64_t stream);
163
164
private
:
165
virtual
void
DoInitialize
();
170
171
struct
BeaconInfo
172
{
173
uint16_t
aid
;
//Assoc ID
174
Time
referenceTbtt
;
//When one of my station's beacons was put into a beacon queue;
175
Time
beaconInterval
;
//Beacon interval of my station;
176
};
179
typedef
std::vector<Ptr<PeerLink> >
PeerLinksOnInterface
;
181
typedef
std::map<uint32_t, PeerLinksOnInterface>
PeerLinksMap
;
183
typedef
std::map<Mac48Address, BeaconInfo>
BeaconsOnInterface
;
185
typedef
std::map<uint32_t, BeaconsOnInterface>
BeaconInfoMap
;
187
typedef
std::map<uint32_t, Ptr<PeerManagementProtocolMac> >
PeerManagementProtocolMacMap
;
188
// \}
189
private
:
190
PeerManagementProtocol
&
operator=
(
const
PeerManagementProtocol
&);
191
PeerManagementProtocol
(
const
PeerManagementProtocol
&);
192
193
Ptr<PeerLink>
InitiateLink
(
194
uint32_t interface,
195
Mac48Address
peerAddress,
196
Mac48Address
peerMeshPointAddress
197
);
202
bool
ShouldSendOpen
(uint32_t interface,
Mac48Address
peerAddress);
203
bool
ShouldAcceptOpen
(uint32_t interface,
Mac48Address
peerAddress,
PmpReasonCode
& reasonCode);
208
void
PeerLinkStatus
(uint32_t interface,
Mac48Address
peerAddress,
Mac48Address
peerMeshPointAddres,
PeerLink::PeerState
ostate,
PeerLink::PeerState
nstate);
210
void
CheckBeaconCollisions
(uint32_t interface);
211
void
ShiftOwnBeacon
(uint32_t interface);
216
Time
TuToTime
(
int
x
);
217
int
TimeToTu
(
Time
x
);
218
// \}
219
221
void
NotifyLinkOpen
(
Mac48Address
peerMp,
Mac48Address
peerIface,
Mac48Address
myIface, uint32_t interface);
223
void
NotifyLinkClose
(
Mac48Address
peerMp,
Mac48Address
peerIface,
Mac48Address
myIface, uint32_t interface);
224
private
:
225
PeerManagementProtocolMacMap
m_plugins
;
226
Mac48Address
m_address
;
227
Ptr<IeMeshId>
m_meshId
;
228
229
uint16_t
m_lastAssocId
;
230
uint16_t
m_lastLocalLinkId
;
231
uint8_t
m_maxNumberOfPeerLinks
;
233
bool
m_enableBca
;
235
uint16_t
m_maxBeaconShift
;
237
std::map<uint32_t, Time>
m_lastBeacon
;
239
std::map<uint32_t, Time>
m_beaconInterval
;
240
245
PeerLinksMap
m_peerLinks
;
256
Callback <void, Mac48Address, Mac48Address, uint32_t, bool>
m_peerStatusCallback
;
257
259
typedef
TracedCallback <Mac48Address, Mac48Address>
LinkEventCallback
;
261
LinkEventCallback
m_linkOpenTraceSrc
;
263
LinkEventCallback
m_linkCloseTraceSrc
;
264
266
// \{
267
struct
Statistics
{
268
uint16_t
linksTotal
;
269
uint16_t
linksOpened
;
270
uint16_t
linksClosed
;
271
272
Statistics
(uint16_t t = 0);
273
void
Print
(std::ostream & os)
const
;
274
};
275
struct
Statistics
m_stats
;
276
// \}
278
Ptr<UniformRandomVariable>
m_beaconShift
;
279
};
280
281
}
// namespace dot11s
282
}
// namespace ns3
283
#endif
src
mesh
model
dot11s
peer-management-protocol.h
Generated on Fri Aug 30 2013 01:42:58 for ns-3 by
1.8.1.2