A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
hwmp-protocol-mac.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  * Author: Kirill Andreev <andreev@iitp.ru>
19  */
20 
21 #ifndef HWMP_STATE_H
22 #define HWMP_STATE_H
23 
24 #include "ns3/mesh-wifi-interface-mac-plugin.h"
25 #include "ns3/hwmp-protocol.h"
26 
27 namespace ns3 {
28 
29 class MeshWifiInterfaceMac;
30 class WifiActionHeader;
31 
32 namespace dot11s {
33 
34 class HwmpProtocol;
35 class IePreq;
36 class IePrep;
37 class IePerr;
38 
45 {
46 public:
50  //\{
52  bool Receive (Ptr<Packet> packet, const WifiMacHeader & header);
55  void UpdateBeacon (MeshWifiBeacon & beacon) const {};
56  int64_t AssignStreams (int64_t stream);
57  //\}
58 
59 private:
60  friend class HwmpProtocol;
64  //\{
65  void SendPreq (IePreq preq);
66  void SendPreq (std::vector<IePreq> preq);
67  void SendPrep (IePrep prep, Mac48Address receiver);
68  //Forward a path error
69  void ForwardPerr (std::vector<HwmpProtocol::FailedDestination> destinations, std::vector<Mac48Address> receivers);
70  // initiate my own path error
71  void InitiatePerr (std::vector<HwmpProtocol::FailedDestination> destinations, std::vector<Mac48Address> receivers);
79  void RequestDestination (Mac48Address dest, uint32_t originator_seqno, uint32_t dst_seqno);
80  //\}
81 
83  void SendMyPreq ();
84  void SendMyPerr ();
86  //peer as routing entry
87  uint32_t GetLinkMetric (Mac48Address peerAddress) const;
88  uint16_t GetChannelId () const;
90  void Report (std::ostream &) const;
91  void ResetStats ();
92 private:
94  uint32_t m_ifIndex;
96 
98  //\{
100  std::vector<IePreq> m_myPreq;
101  //\}
103  //\{
105  struct MyPerr {
106  std::vector<HwmpProtocol::FailedDestination> destinations;
107  std::vector<Mac48Address> receivers;
108  };
111  //\{
112  struct Statistics
113  {
114  uint16_t txPreq;
115  uint16_t rxPreq;
116  uint16_t txPrep;
117  uint16_t rxPrep;
118  uint16_t txPerr;
119  uint16_t rxPerr;
120  uint16_t txMgt;
121  uint32_t txMgtBytes;
122  uint16_t rxMgt;
123  uint32_t rxMgtBytes;
124  uint16_t txData;
125  uint32_t txDataBytes;
126  uint16_t rxData;
127  uint32_t rxDataBytes;
128  void Print (std::ostream & os) const;
129  Statistics ();
130  };
132  //\}
133 private:
135  bool ReceiveData (Ptr<Packet> packet, const WifiMacHeader & header);
137  bool ReceiveAction (Ptr<Packet> packet, const WifiMacHeader & header);
138 };
139 } // namespace dot11s
140 } // namespace ns3
141 #endif