A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
mac-rx-middle.h
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2005 INRIA
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
19  */
20 
21 #ifndef MAC_RX_MIDDLE_H
22 #define MAC_RX_MIDDLE_H
23 
24 #include <map>
25 #include <utility>
26 #include "ns3/callback.h"
27 #include "ns3/mac48-address.h"
28 #include "ns3/packet.h"
29 
30 namespace ns3 {
31 
32 class WifiMacHeader;
33 class OriginatorRxStatus;
34 
41 {
42 public:
44 
45  MacRxMiddle ();
46  ~MacRxMiddle ();
47 
48  void SetForwardCallback (ForwardUpCallback callback);
49 
50  void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
51 private:
52  friend class MacRxMiddleTest;
53  OriginatorRxStatus* Lookup (const WifiMacHeader* hdr);
54  bool IsDuplicate (const WifiMacHeader* hdr, OriginatorRxStatus *originator) const;
55  Ptr<Packet> HandleFragments (Ptr<Packet> packet, const WifiMacHeader* hdr,
56  OriginatorRxStatus *originator);
57 
58  typedef std::map <Mac48Address, OriginatorRxStatus *, std::less<Mac48Address> > Originators;
59  typedef std::map <std::pair<Mac48Address, uint8_t>, OriginatorRxStatus *, std::less<std::pair<Mac48Address,uint8_t> > > QosOriginators;
60  typedef std::map <Mac48Address, OriginatorRxStatus *, std::less<Mac48Address> >::iterator OriginatorsI;
61  typedef std::map <std::pair<Mac48Address, uint8_t>, OriginatorRxStatus *, std::less<std::pair<Mac48Address,uint8_t> > >::iterator QosOriginatorsI;
62  Originators m_originatorStatus;
63  QosOriginators m_qosOriginatorStatus;
64  ForwardUpCallback m_callback;
65 };
66 
67 } // namespace ns3
68 
69 
70 #endif /* MAC_RX_MIDDLE_H */
Callback template class.
Definition: callback.h:369
void Receive(Ptr< Packet > packet, const WifiMacHeader *hdr)