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-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
{
55
IDLE
,
56
OPN_SNT
,
57
CNF_RCVD
,
58
OPN_RCVD
,
59
ESTAB
,
60
HOLDING
,
61
};
63
void
SetBeaconInformation
(
Time
lastBeacon,
Time
BeaconInterval);
70
void
SetLinkStatusCallback
(
Callback<void, uint32_t, Mac48Address, bool>
cb);
75
void
SetPeerAddress
(
Mac48Address
macaddr);
76
void
SetPeerMeshPointAddress
(
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);
82
Mac48Address
GetPeerAddress
()
const
;
83
uint16_t
GetLocalAid
()
const
;
84
Time
GetLastBeacon
()
const
;
85
Time
GetBeaconInterval
()
const
;
86
IeBeaconTiming
GetBeaconTimingElement
()
const
;
87
//IePeerManagement GetPeerLinkDescriptorElement ()const;
88
//\}
89
94
95
void
MLMECancelPeerLink
(
PmpReasonCode
reason);
97
void
MLMEActivePeerLinkOpen
();
99
void
MLMEPeeringRequestReject
();
101
typedef
Callback<void, uint32_t, Mac48Address, Mac48Address, PeerLink::PeerState, PeerLink::PeerState>
SignalStatusCallback
;
103
void
MLMESetSignalStatusCallback
(
SignalStatusCallback
);
105
void
TransmissionSuccess
();
106
void
TransmissionFailure
();
107
//\}
109
void
Report
(std::ostream & os)
const
;
110
private
:
112
enum
PeerEvent
113
{
114
CNCL
,
115
ACTOPN
,
116
CLS_ACPT
,
117
OPN_ACPT
,
118
OPN_RJCT
,
119
REQ_RJCT
,
120
CNF_ACPT
,
121
CNF_RJCT
,
122
TOR1
,
123
TOR2
,
124
TOC
,
125
TOH
,
126
};
128
void
StateMachine
(
PeerEvent
event,
PmpReasonCode
=
REASON11S_RESERVED
);
137
138
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,
148
IeConfiguration
conf,
149
Mac48Address
peerMp
150
);
152
void
ConfirmReject
(
153
uint16_t localLinkId,
154
uint16_t peerLinkId,
155
IeConfiguration
conf,
156
Mac48Address
peerMp,
157
PmpReasonCode
reason
158
);
159
//\}
161
bool
LinkIsEstab
()
const
;
163
bool
LinkIsIdle
()
const
;
168
void
SetMacPlugin
(
Ptr<PeerManagementProtocolMac>
plugin);
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
;
208
Ptr<PeerManagementProtocolMac>
m_macPlugin
;
210
Mac48Address
m_peerAddress
;
213
Mac48Address
m_peerMeshPointAddress
;
215
uint16_t
m_localLinkId
;
217
uint16_t
m_peerLinkId
;
219
uint16_t
m_assocId
;
221
uint16_t
m_peerAssocId
;
222
224
Time
m_lastBeacon
;
226
Time
m_beaconInterval
;
228
uint16_t
m_packetFail
;
229
231
PeerState
m_state
;
236
IeConfiguration
m_configuration
;
238
IeBeaconTiming
m_beaconTiming
;
239
244
uint16_t
m_dot11MeshMaxRetries
;
245
Time
m_dot11MeshRetryTimeout
;
246
Time
m_dot11MeshHoldingTimeout
;
247
Time
m_dot11MeshConfirmTimeout
;
248
249
EventId
m_retryTimer
;
250
EventId
m_holdingTimer
;
251
EventId
m_confirmTimer
;
252
uint16_t
m_retryCounter
;
253
EventId
m_beaconLossTimer
;
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 */
src
mesh
model
dot11s
peer-link.h
Generated on Tue May 14 2013 11:08:28 for ns-3 by
1.8.1.2