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/packet.h"
26 #include "ns3/simple-ref-count.h"
27 
28 namespace ns3 {
29 
30 class WifiMacHeader;
31 class OriginatorRxStatus;
32 
38 class MacRxMiddle : public SimpleRefCount<MacRxMiddle>
39 {
40 public:
45 
46  MacRxMiddle ();
47  ~MacRxMiddle ();
48 
54  void SetForwardCallback (ForwardUpCallback callback);
55 
62  void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
63 
64 
65 private:
67  friend class MacRxMiddleTest;
88  bool IsDuplicate (const WifiMacHeader* hdr, OriginatorRxStatus *originator) const;
105  OriginatorRxStatus *originator);
106 
110  typedef std::map <Mac48Address, OriginatorRxStatus *, std::less<Mac48Address> > Originators;
114  typedef std::map <std::pair<Mac48Address, uint8_t>, OriginatorRxStatus *, std::less<std::pair<Mac48Address,uint8_t> > > QosOriginators;
118  typedef std::map <Mac48Address, OriginatorRxStatus *, std::less<Mac48Address> >::iterator OriginatorsI;
122  typedef std::map <std::pair<Mac48Address, uint8_t>, OriginatorRxStatus *, std::less<std::pair<Mac48Address,uint8_t> > >::iterator QosOriginatorsI;
123 
124  Originators m_originatorStatus;
125  QosOriginators m_qosOriginatorStatus;
126  ForwardUpCallback m_callback;
127 };
128 
129 } //namespace ns3
130 
131 #endif /* MAC_RX_MIDDLE_H */
Callback template class.
Definition: callback.h:1176
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.
std::map< std::pair< Mac48Address, uint8_t >, OriginatorRxStatus *, std::less< std::pair< Mac48Address, uint8_t > > >::iterator QosOriginatorsI
typedef for an interator for QosOriginators
This class handles duplicate detection and recomposition of fragments.
Definition: mac-rx-middle.h:38
void Receive(Ptr< Packet > packet, const WifiMacHeader *hdr)
Receive a packet.
Ptr< Packet > HandleFragments(Ptr< Packet > packet, const WifiMacHeader *hdr, OriginatorRxStatus *originator)
Check if the received packet is a fragment and handle it appropriately.
std::map< Mac48Address, OriginatorRxStatus *, std::less< Mac48Address > >::iterator OriginatorsI
typedef for an interator 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
Callback< void, Ptr< Packet >, const WifiMacHeader * > ForwardUpCallback
typedef for callback
Definition: mac-rx-middle.h:44
friend class MacRxMiddleTest
allow MacRxMiddleTest associated class access
Definition: mac-rx-middle.h:67
ForwardUpCallback m_callback
forward up callback
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.