author | Kirill Andreev <andreev@iitp.ru> |
Wed, 20 May 2009 19:12:51 +0400 | |
changeset 5013 | 290579bb1c1b |
parent 5012 | c81291702113 |
child 5015 | e460e29f9f78 |
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; -*- */ |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
2 |
/* |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
3 |
* Copyright (c) 2009 IITP RAS |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
4 |
* |
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 |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
17 |
* |
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 |
|
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
26 |
namespace ns3 { |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
27 |
class MeshWifiInterfaceMac; |
4872 | 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 |
bb5194d57734
New peer management protocol moved to 802.11s/
Pavel Boyko <boyko@iitp.ru>
parents:
4858
diff
changeset
|
35 |
* |
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 |
*/ |
4873 | 42 |
class PeerManagerMacPlugin : 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: |
4919
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4887
diff
changeset
|
45 |
PeerManagerMacPlugin (uint32_t interface, Ptr<PeerManagementProtocol> protocol); |
4873 | 46 |
~PeerManagerMacPlugin (); |
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 |
///\} |
54 |
///\brief Statistics: |
|
5009
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
4933
diff
changeset
|
55 |
void Report (std::ostream &) const; |
5013 | 56 |
void ResetStats (); |
4876
d78f1b978dac
Rstructured file names: IeDot11s* no is Ie, because it is in namespace dot11s
Kirill Andreev <andreev@iitp.ru>
parents:
4874
diff
changeset
|
57 |
private: |
4919
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4887
diff
changeset
|
58 |
friend class PeerManagementProtocol; |
4879 | 59 |
friend class PeerLink; |
60 |
///\name BCA functionallity: |
|
61 |
///\{ |
|
62 |
///\brief Fills TBTT and beacon interval. Needed by BCA |
|
63 |
///functionallity |
|
64 |
///\param first in retval is TBTT |
|
65 |
///\param second in retval is beacon interval |
|
66 |
std::pair<Time, Time> GetBeaconInfo() const; |
|
67 |
void SetBeaconShift(Time shift); |
|
68 |
///\} |
|
4919
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4887
diff
changeset
|
69 |
void SetPeerManagerProtcol(Ptr<PeerManagementProtocol> protocol); |
4861 | 70 |
void SendPeerLinkManagementFrame( |
71 |
Mac48Address peerAddress, |
|
4933
72f0481cfb2d
Peer link restructured to support multi-interface
Kirill Andreev <andreev@iitp.ru>
parents:
4919
diff
changeset
|
72 |
Mac48Address peerMpAddress, |
4861 | 73 |
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
|
74 |
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
|
75 |
IeConfiguration meshConfig |
4860
bb5194d57734
New peer management protocol moved to 802.11s/
Pavel Boyko <boyko@iitp.ru>
parents:
4858
diff
changeset
|
76 |
); |
4874
f7ea3717e668
Code cleanups. Software delay is removed
Kirill Andreev <andreev@iitp.ru>
parents:
4873
diff
changeset
|
77 |
///\brief DUBUG only - to print established links |
4869 | 78 |
Mac48Address GetAddress () const; |
4860
bb5194d57734
New peer management protocol moved to 802.11s/
Pavel Boyko <boyko@iitp.ru>
parents:
4858
diff
changeset
|
79 |
private: |
4874
f7ea3717e668
Code cleanups. Software delay is removed
Kirill Andreev <andreev@iitp.ru>
parents:
4873
diff
changeset
|
80 |
///\name Information about MAC and protocol: |
f7ea3717e668
Code cleanups. Software delay is removed
Kirill Andreev <andreev@iitp.ru>
parents:
4873
diff
changeset
|
81 |
///\{ |
4860
bb5194d57734
New peer management protocol moved to 802.11s/
Pavel Boyko <boyko@iitp.ru>
parents:
4858
diff
changeset
|
82 |
Ptr<MeshWifiInterfaceMac> m_parent; |
4861 | 83 |
uint32_t m_ifIndex; |
4919
b8a0476c7e06
Added unicast PREQ, peer link status callback.
Kirill Andreev <andreev@iitp.ru>
parents:
4887
diff
changeset
|
84 |
Ptr<PeerManagementProtocol> m_protocol; |
4874
f7ea3717e668
Code cleanups. Software delay is removed
Kirill Andreev <andreev@iitp.ru>
parents:
4873
diff
changeset
|
85 |
///\} |
f7ea3717e668
Code cleanups. Software delay is removed
Kirill Andreev <andreev@iitp.ru>
parents:
4873
diff
changeset
|
86 |
///\name Create peer link management frames: |
f7ea3717e668
Code cleanups. Software delay is removed
Kirill Andreev <andreev@iitp.ru>
parents:
4873
diff
changeset
|
87 |
///\{ |
4860
bb5194d57734
New peer management protocol moved to 802.11s/
Pavel Boyko <boyko@iitp.ru>
parents:
4858
diff
changeset
|
88 |
Ptr<Packet> CreatePeerLinkOpenFrame(); |
bb5194d57734
New peer management protocol moved to 802.11s/
Pavel Boyko <boyko@iitp.ru>
parents:
4858
diff
changeset
|
89 |
Ptr<Packet> CreatePeerLinkConfirmFrame(); |
bb5194d57734
New peer management protocol moved to 802.11s/
Pavel Boyko <boyko@iitp.ru>
parents:
4858
diff
changeset
|
90 |
Ptr<Packet> CreatePeerLinkCloseFrame(); |
4874
f7ea3717e668
Code cleanups. Software delay is removed
Kirill Andreev <andreev@iitp.ru>
parents:
4873
diff
changeset
|
91 |
///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
|
92 |
///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
|
93 |
struct PlinkFrameStart { |
e331ed5d3662
Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents:
4861
diff
changeset
|
94 |
uint8_t subtype; |
e331ed5d3662
Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents:
4861
diff
changeset
|
95 |
uint16_t aid; |
e331ed5d3662
Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents:
4861
diff
changeset
|
96 |
SupportedRates rates; |
e331ed5d3662
Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents:
4861
diff
changeset
|
97 |
uint16_t qos; |
e331ed5d3662
Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents:
4861
diff
changeset
|
98 |
}; |
4874
f7ea3717e668
Code cleanups. Software delay is removed
Kirill Andreev <andreev@iitp.ru>
parents:
4873
diff
changeset
|
99 |
/// \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
|
100 |
/// WifiInformationElements exist |
4865
e331ed5d3662
Added header for peer link frame (first fields without information element)
Kirill Andreev <andreev@iitp.ru>
parents:
4861
diff
changeset
|
101 |
PlinkFrameStart ParsePlinkFrame(Ptr<const Packet> packet); |
4874
f7ea3717e668
Code cleanups. Software delay is removed
Kirill Andreev <andreev@iitp.ru>
parents:
4873
diff
changeset
|
102 |
///\} |
5009
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
4933
diff
changeset
|
103 |
//Keeps statistics |
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
4933
diff
changeset
|
104 |
struct Statistics { |
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
4933
diff
changeset
|
105 |
uint16_t sendOpen; |
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
4933
diff
changeset
|
106 |
uint16_t sendConfirm; |
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
4933
diff
changeset
|
107 |
uint16_t sendClose; |
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
4933
diff
changeset
|
108 |
uint16_t recvOpen; |
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
4933
diff
changeset
|
109 |
uint16_t recvConfirm; |
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
4933
diff
changeset
|
110 |
uint16_t recvClose; |
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
4933
diff
changeset
|
111 |
uint16_t dropped; |
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
4933
diff
changeset
|
112 |
uint16_t brokenMgt; |
5010
bc885417e41e
Added statistcs structures
Kirill Andreev <andreev@iitp.ru>
parents:
5009
diff
changeset
|
113 |
uint16_t sentMgt; |
bc885417e41e
Added statistcs structures
Kirill Andreev <andreev@iitp.ru>
parents:
5009
diff
changeset
|
114 |
uint32_t sentMgtBytes; |
bc885417e41e
Added statistcs structures
Kirill Andreev <andreev@iitp.ru>
parents:
5009
diff
changeset
|
115 |
uint16_t recvMgt; |
bc885417e41e
Added statistcs structures
Kirill Andreev <andreev@iitp.ru>
parents:
5009
diff
changeset
|
116 |
uint32_t recvMgtBytes; |
5013 | 117 |
uint16_t beaconShift; |
5009
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
4933
diff
changeset
|
118 |
|
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
4933
diff
changeset
|
119 |
Statistics (); |
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
4933
diff
changeset
|
120 |
void Print (std::ostream & os) const; |
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
4933
diff
changeset
|
121 |
}; |
ac0ea6c1e012
Added statistics for PMP-MAC
Kirill Andreev <andreev@iitp.ru>
parents:
4933
diff
changeset
|
122 |
struct Statistics m_stats; |
4856
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
123 |
}; |
4872 | 124 |
|
125 |
} // namespace dot11s |
|
4856
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
126 |
} //namespace ns3 |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
127 |
#endif |
b7241df728a3
Added PM-mac - not implemented
Kirill Andreev <andreev@iitp.ru>
parents:
diff
changeset
|
128 |