author | Kirill Andreev <andreev@iitp.ru> |
Wed, 22 Jul 2009 16:43:43 +0400 | |
changeset 5132 | aee541a30256 |
parent 5130 | b5062e8e0da1 |
child 5154 | bb06787ed7fe |
permissions | -rw-r--r-- |
4856
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
5129 | 2 |
/* |
4856
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
3 |
* Copyright (c) 2009 IITP RAS |
5129 | 4 |
* |
4856
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
5 |
* This program is free software; you can redistribute it and/or modify |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
6 |
* it under the terms of the GNU General Public License version 2 as |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation; |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
8 |
* |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
9 |
* This program is distributed in the hope that it will be useful, |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
12 |
* GNU General Public License for more details. |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
13 |
* |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
14 |
* You should have received a copy of the GNU General Public License |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
15 |
* along with this program; if not, write to the Free Software |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
5129 | 17 |
* |
4856
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
18 |
* Author: Kirill Andreev <andreev@iitp.ru> |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
19 |
*/ |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
20 |
|
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
21 |
#ifndef PEER_MANAGER_MAC_PLUGIN_H_ |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
22 |
#define PEER_MANAGER_MAC_PLUGIN_H_ |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
23 |
|
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
24 |
#include "ns3/mesh-wifi-interface-mac-plugin.h" |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
25 |
|
5132
aee541a30256
Restored newline at namespace
Kirill Andreev <andreev@iitp.ru>
parents:
5130
diff
changeset
|
26 |
namespace ns3 { |
4856
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
27 |
class MeshWifiInterfaceMac; |
5132
aee541a30256
Restored newline at namespace
Kirill Andreev <andreev@iitp.ru>
parents:
5130
diff
changeset
|
28 |
namespace dot11s { |
4887
cbf02c77d5c1
HWMP is attached to mesh point device and MAC layer with zero functionality
Kirill Andreev <andreev@iitp.ru>
parents:
4882
diff
changeset
|
29 |
class PeerManagementProtocol; |
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4874
diff
changeset
|
30 |
class IeConfiguration; |
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4874
diff
changeset
|
31 |
class IePeerManagement; |
4919
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4887
diff
changeset
|
32 |
class PeerManagementProtocol; |
4860
bb5194d57734
New peer management protocol moved to 802.11s/
Pavel Boyko <boyko@iitp.ru>
parents:
4858
diff
changeset
|
33 |
/** |
bb5194d57734
New peer management protocol moved to 802.11s/
Pavel Boyko <boyko@iitp.ru>
parents:
4858
diff
changeset
|
34 |
* \ingroup dot11s |
5129 | 35 |
* |
4860
bb5194d57734
New peer management protocol moved to 802.11s/
Pavel Boyko <boyko@iitp.ru>
parents:
4858
diff
changeset
|
36 |
* \brief This is plugin to Mesh WiFi MAC, which implements |
bb5194d57734
New peer management protocol moved to 802.11s/
Pavel Boyko <boyko@iitp.ru>
parents:
4858
diff
changeset
|
37 |
* interface to dot11s peer management protocol: it takes proper |
bb5194d57734
New peer management protocol moved to 802.11s/
Pavel Boyko <boyko@iitp.ru>
parents:
4858
diff
changeset
|
38 |
* frames from MAC-layer, extracts peer link management information |
bb5194d57734
New peer management protocol moved to 802.11s/
Pavel Boyko <boyko@iitp.ru>
parents:
4858
diff
changeset
|
39 |
* element and mesh configuration element and passes it to main part |
bb5194d57734
New peer management protocol moved to 802.11s/
Pavel Boyko <boyko@iitp.ru>
parents:
4858
diff
changeset
|
40 |
* of protocol |
bb5194d57734
New peer management protocol moved to 802.11s/
Pavel Boyko <boyko@iitp.ru>
parents:
4858
diff
changeset
|
41 |
*/ |
5086
fccfd0073ea3
Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents:
5038
diff
changeset
|
42 |
class PeerManagementProtocolMac : public MeshWifiInterfaceMacPlugin |
4856
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
43 |
{ |
4860
bb5194d57734
New peer management protocol moved to 802.11s/
Pavel Boyko <boyko@iitp.ru>
parents:
4858
diff
changeset
|
44 |
public: |
5086
fccfd0073ea3
Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents:
5038
diff
changeset
|
45 |
PeerManagementProtocolMac (uint32_t interface, Ptr<PeerManagementProtocol> protocol); |
fccfd0073ea3
Fixed names: now protocols are called *-protocol.[h,cc], plugin is called
Kirill Andreev <andreev@iitp.ru>
parents:
5038
diff
changeset
|
46 |
~PeerManagementProtocolMac (); |
4874
f7ea3717e668
Code cleanups. Software delay is removed
Kirill Andreev <andreev@iitp.ru>
parents:
4873
diff
changeset
|
47 |
///\name Inherited from plugin abstract class |
f7ea3717e668
Code cleanups. Software delay is removed
Kirill Andreev <andreev@iitp.ru>
parents:
4873
diff
changeset
|
48 |
///\{ |
4860
bb5194d57734
New peer management protocol moved to 802.11s/
Pavel Boyko <boyko@iitp.ru>
parents:
4858
diff
changeset
|
49 |
void SetParent (Ptr<MeshWifiInterfaceMac> parent); |
bb5194d57734
New peer management protocol moved to 802.11s/
Pavel Boyko <boyko@iitp.ru>
parents:
4858
diff
changeset
|
50 |
bool Receive (Ptr<Packet> packet, const WifiMacHeader & header); |
5012 | 51 |
bool UpdateOutcomingFrame (Ptr<Packet> packet, WifiMacHeader & header, Mac48Address from, Mac48Address to); |
4860
bb5194d57734
New peer management protocol moved to 802.11s/
Pavel Boyko <boyko@iitp.ru>
parents:
4858
diff
changeset
|
52 |
void UpdateBeacon (MeshWifiBeacon & beacon) const; |
5013 | 53 |
///\} |
5015 | 54 |
///\name Statistics: |
55 |
///\{ |
|
5009
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
4933
diff
changeset
|
56 |
void Report (std::ostream &) const; |
5013 | 57 |
void ResetStats (); |
5015 | 58 |
uint32_t GetLinkMetric (Mac48Address peerAddress); |
59 |
///\} |
|
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4874
diff
changeset
|
60 |
private: |
4919
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4887
diff
changeset
|
61 |
friend class PeerManagementProtocol; |
5129 | 62 |
friend class PeerLink; |
4879 | 63 |
///\name BCA functionallity: |
64 |
///\{ |
|
65 |
///\brief Fills TBTT and beacon interval. Needed by BCA |
|
66 |
///functionallity |
|
67 |
///\param first in retval is TBTT |
|
68 |
///\param second in retval is beacon interval |
|
5130 | 69 |
std::pair<Time, Time> GetBeaconInfo () const; |
70 |
void SetBeaconShift (Time shift); |
|
4879 | 71 |
///\} |
5130 | 72 |
void SetPeerManagerProtcol (Ptr<PeerManagementProtocol> protocol); |
73 |
void SendPeerLinkManagementFrame ( |
|
4861 | 74 |
Mac48Address peerAddress, |
4933
72f0481cfb2d
Peer link restructured to support multi-interface
Kirill Andreev <andreev@iitp.ru>
parents:
4919
diff
changeset
|
75 |
Mac48Address peerMpAddress, |
4861 | 76 |
uint16_t aid, |
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4874
diff
changeset
|
77 |
IePeerManagement peerElement, |
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4874
diff
changeset
|
78 |
IeConfiguration meshConfig |
4860
bb5194d57734
New peer management protocol moved to 802.11s/
Pavel Boyko <boyko@iitp.ru>
parents:
4858
diff
changeset
|
79 |
); |
4874
f7ea3717e668
Code cleanups. Software delay is removed
Kirill Andreev <andreev@iitp.ru>
parents:
4873
diff
changeset
|
80 |
///\brief DUBUG only - to print established links |
4869 | 81 |
Mac48Address GetAddress () const; |
4860
bb5194d57734
New peer management protocol moved to 802.11s/
Pavel Boyko <boyko@iitp.ru>
parents:
4858
diff
changeset
|
82 |
private: |
4874
f7ea3717e668
Code cleanups. Software delay is removed
Kirill Andreev <andreev@iitp.ru>
parents:
4873
diff
changeset
|
83 |
///\name Information about MAC and protocol: |
f7ea3717e668
Code cleanups. Software delay is removed
Kirill Andreev <andreev@iitp.ru>
parents:
4873
diff
changeset
|
84 |
///\{ |
4860
bb5194d57734
New peer management protocol moved to 802.11s/
Pavel Boyko <boyko@iitp.ru>
parents:
4858
diff
changeset
|
85 |
Ptr<MeshWifiInterfaceMac> m_parent; |
4861 | 86 |
uint32_t m_ifIndex; |
4919
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4887
diff
changeset
|
87 |
Ptr<PeerManagementProtocol> m_protocol; |
4874
f7ea3717e668
Code cleanups. Software delay is removed
Kirill Andreev <andreev@iitp.ru>
parents:
4873
diff
changeset
|
88 |
///\} |
f7ea3717e668
Code cleanups. Software delay is removed
Kirill Andreev <andreev@iitp.ru>
parents:
4873
diff
changeset
|
89 |
///\name Create peer link management frames: |
f7ea3717e668
Code cleanups. Software delay is removed
Kirill Andreev <andreev@iitp.ru>
parents:
4873
diff
changeset
|
90 |
///\{ |
5130 | 91 |
Ptr<Packet> CreatePeerLinkOpenFrame (); |
92 |
Ptr<Packet> CreatePeerLinkConfirmFrame (); |
|
93 |
Ptr<Packet> CreatePeerLinkCloseFrame (); |
|
4874
f7ea3717e668
Code cleanups. Software delay is removed
Kirill Andreev <andreev@iitp.ru>
parents:
4873
diff
changeset
|
94 |
///This structure keeps all fields in peer link management frame, |
f7ea3717e668
Code cleanups. Software delay is removed
Kirill Andreev <andreev@iitp.ru>
parents:
4873
diff
changeset
|
95 |
///which are not subclasses of WifiInformationElement |
4865
e331ed5d3662
Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents:
4861
diff
changeset
|
96 |
struct PlinkFrameStart { |
e331ed5d3662
Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents:
4861
diff
changeset
|
97 |
uint8_t subtype; |
e331ed5d3662
Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents:
4861
diff
changeset
|
98 |
uint16_t aid; |
e331ed5d3662
Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents:
4861
diff
changeset
|
99 |
SupportedRates rates; |
e331ed5d3662
Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents:
4861
diff
changeset
|
100 |
uint16_t qos; |
e331ed5d3662
Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents:
4861
diff
changeset
|
101 |
}; |
4874
f7ea3717e668
Code cleanups. Software delay is removed
Kirill Andreev <andreev@iitp.ru>
parents:
4873
diff
changeset
|
102 |
/// \name Parses the start of the frame, where there are no |
f7ea3717e668
Code cleanups. Software delay is removed
Kirill Andreev <andreev@iitp.ru>
parents:
4873
diff
changeset
|
103 |
/// WifiInformationElements exist |
5130 | 104 |
PlinkFrameStart ParsePlinkFrame (Ptr<const Packet> packet); |
4874
f7ea3717e668
Code cleanups. Software delay is removed
Kirill Andreev <andreev@iitp.ru>
parents:
4873
diff
changeset
|
105 |
///\} |
5009
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
4933
diff
changeset
|
106 |
//Keeps statistics |
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
4933
diff
changeset
|
107 |
struct Statistics { |
5038 | 108 |
uint16_t txOpen; |
109 |
uint16_t txConfirm; |
|
110 |
uint16_t txClose; |
|
111 |
uint16_t rxOpen; |
|
112 |
uint16_t rxConfirm; |
|
113 |
uint16_t rxClose; |
|
5009
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
4933
diff
changeset
|
114 |
uint16_t dropped; |
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
4933
diff
changeset
|
115 |
uint16_t brokenMgt; |
5038 | 116 |
uint16_t txMgt; |
117 |
uint32_t txMgtBytes; |
|
118 |
uint16_t rxMgt; |
|
119 |
uint32_t rxMgtBytes; |
|
5013 | 120 |
uint16_t beaconShift; |
5129 | 121 |
|
5009
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
4933
diff
changeset
|
122 |
Statistics (); |
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
4933
diff
changeset
|
123 |
void Print (std::ostream & os) const; |
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
4933
diff
changeset
|
124 |
}; |
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
4933
diff
changeset
|
125 |
struct Statistics m_stats; |
4856
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
126 |
}; |
5129 | 127 |
|
4872 | 128 |
} // namespace dot11s |
4856
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
129 |
} //namespace ns3 |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
130 |
#endif |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
131 |