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 */
Callback template class.
Definition: callback.h:1279
This class handles duplicate detection and recomposition of fragments.
Definition: mac-rx-middle.h:42
friend class MacRxMiddleTest
allow MacRxMiddleTest associated class access
Definition: mac-rx-middle.h:69
void SetForwardCallback(ForwardUpCallback callback)
Set a callback to forward the packet up.
Originators m_originatorStatus
originator status
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.
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...
std::map< Mac48Address, OriginatorRxStatus *, std::less< Mac48Address > >::iterator OriginatorsI
typedef for an iterator for Originators
std::map< Mac48Address, OriginatorRxStatus *, std::less< Mac48Address > > Originators
typedef for a map between address and OriginatorRxStatus
std::map< std::pair< Mac48Address, uint8_t >, OriginatorRxStatus *, std::less< std::pair< Mac48Address, uint8_t > > >::iterator QosOriginatorsI
typedef for an iterator for QosOriginators
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
QosOriginators m_qosOriginatorStatus
QOS originator status.
void Receive(Ptr< WifiMacQueueItem > mpdu)
Receive a packet.
Callback< void, Ptr< WifiMacQueueItem > > ForwardUpCallback
typedef for callback
Definition: mac-rx-middle.h:47
ForwardUpCallback m_callback
forward up callback
OriginatorRxStatus * Lookup(const WifiMacHeader *hdr)
Look up for OriginatorRxStatus associated with the sender address (by looking at ADDR2 field in the h...
A class to keep track of the packet originator status.
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
A template-based reference counting class.
Implements the IEEE 802.11 MAC header.
Every class exported by the ns3 library is enclosed in the ns3 namespace.