A Discrete-Event Network Simulator
API
mac-rx-middle.h
Go to the documentation of this file.
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 "ns3/simple-ref-count.h"
26 #include "ns3/callback.h"
27 
28 namespace ns3 {
29 
30 class WifiMacHeader;
31 class OriginatorRxStatus;
32 class Packet;
33 class Mac48Address;
34 class WifiMacQueueItem;
35 
41 class MacRxMiddle : public SimpleRefCount<MacRxMiddle>
42 {
43 public:
48 
49  MacRxMiddle ();
50  ~MacRxMiddle ();
51 
57  void SetForwardCallback (ForwardUpCallback callback);
58 
64  void Receive (Ptr<WifiMacQueueItem> mpdu);
65 
66 
67 private:
69  friend class MacRxMiddleTest;
90  bool IsDuplicate (const WifiMacHeader* hdr, OriginatorRxStatus *originator) const;
107  OriginatorRxStatus *originator);
108 
112  typedef std::map <Mac48Address, OriginatorRxStatus *, std::less<Mac48Address> > Originators;
116  typedef std::map <std::pair<Mac48Address, uint8_t>, OriginatorRxStatus *, std::less<std::pair<Mac48Address,uint8_t> > > QosOriginators;
120  typedef std::map <Mac48Address, OriginatorRxStatus *, std::less<Mac48Address> >::iterator OriginatorsI;
124  typedef std::map <std::pair<Mac48Address, uint8_t>, OriginatorRxStatus *, std::less<std::pair<Mac48Address,uint8_t> > >::iterator QosOriginatorsI;
125 
129 };
130 
131 } //namespace ns3
132 
133 #endif /* MAC_RX_MIDDLE_H */
Ptr< const Packet > HandleFragments(Ptr< const Packet > packet, const WifiMacHeader *hdr, OriginatorRxStatus *originator)
Check if the received packet is a fragment and handle it appropriately.
Callback template class.
Definition: callback.h:1278
std::map< std::pair< Mac48Address, uint8_t >, OriginatorRxStatus *, std::less< std::pair< Mac48Address, uint8_t > > > QosOriginators
typedef for a map between address, OriginatorRxStatus, and Traffic ID
void SetForwardCallback(ForwardUpCallback callback)
Set a callback to forward the packet up.
Callback< void, Ptr< WifiMacQueueItem > > ForwardUpCallback
typedef for callback
Definition: mac-rx-middle.h:47
std::map< std::pair< Mac48Address, uint8_t >, OriginatorRxStatus *, std::less< std::pair< Mac48Address, uint8_t > > >::iterator QosOriginatorsI
typedef for an iterator for QosOriginators
This class handles duplicate detection and recomposition of fragments.
Definition: mac-rx-middle.h:41
std::map< Mac48Address, OriginatorRxStatus *, std::less< Mac48Address > >::iterator OriginatorsI
typedef for an iterator for Originators
OriginatorRxStatus * Lookup(const WifiMacHeader *hdr)
Look up for OriginatorRxStatus associated with the sender address (by looking at ADDR2 field in the h...
Originators m_originatorStatus
originator status
bool IsDuplicate(const WifiMacHeader *hdr, OriginatorRxStatus *originator) const
Check if we have already received the packet from the sender before (by looking at the sequence contr...
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::map< Mac48Address, OriginatorRxStatus *, std::less< Mac48Address > > Originators
typedef for a map between address and OriginatorRxStatus
friend class MacRxMiddleTest
allow MacRxMiddleTest associated class access
Definition: mac-rx-middle.h:69
ForwardUpCallback m_callback
forward up callback
void Receive(Ptr< WifiMacQueueItem > mpdu)
Receive a packet.
A class to keep track of the packet originator status.
A template-based reference counting class.
QosOriginators m_qosOriginatorStatus
QOS originator status.
Implements the IEEE 802.11 MAC header.