/usr/include/ns3.27/ns3/mac-rx-middle.h is in libns3-dev 3.27+dfsg-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef MAC_RX_MIDDLE_H
#define MAC_RX_MIDDLE_H
#include <map>
#include "ns3/packet.h"
#include "ns3/simple-ref-count.h"
namespace ns3 {
class WifiMacHeader;
class OriginatorRxStatus;
/**
* \ingroup wifi
*
* This class handles duplicate detection and recomposition of fragments.
*/
class MacRxMiddle : public SimpleRefCount<MacRxMiddle>
{
public:
/**
* typedef for callback
*/
typedef Callback<void, Ptr<Packet>, const WifiMacHeader*> ForwardUpCallback;
MacRxMiddle ();
~MacRxMiddle ();
/**
* Set a callback to forward the packet up.
*
* \param callback
*/
void SetForwardCallback (ForwardUpCallback callback);
/**
* Receive a packet.
*
* \param packet the packet
* \param hdr MAC header
*/
void Receive (Ptr<Packet> packet, const WifiMacHeader *hdr);
private:
/// allow MacRxMiddleTest associated class access
friend class MacRxMiddleTest;
/**
* Look up for OriginatorRxStatus associated with the sender address
* (by looking at ADDR2 field in the header).
* The method creates a new OriginatorRxStatus if one is not already presented.
*
* \param hdr
*
* \return OriginatorRxStatus
*/
OriginatorRxStatus* Lookup (const WifiMacHeader* hdr);
/**
* Check if we have already received the packet from the sender before
* (by looking at the sequence control field).
*
* \param hdr
* \param originator
*
* \return true if we already received the packet previously,
* false otherwise
*/
bool IsDuplicate (const WifiMacHeader* hdr, OriginatorRxStatus *originator) const;
/**
* Check if the received packet is a fragment and handle it appropriately.
* If the packet is not a fragment, the method returns the packet.
* If the packet is a fragment (not the last fragment), the method initiates
* de-fragmentation process and return 0.
* If the packet is the last fragment, the method tries to re-construct the full packet
* and return the packet if success.
*
* \param packet
* \param hdr
* \param originator
*
* \return a packet if the packet is successfully reassembled (or not a fragment),
* 0 if we failed to reassemble the packet (e.g. missing fragments/out-of-order).
*/
Ptr<Packet> HandleFragments (Ptr<Packet> packet, const WifiMacHeader* hdr,
OriginatorRxStatus *originator);
/**
* typedef for a map between address and OriginatorRxStatus
*/
typedef std::map <Mac48Address, OriginatorRxStatus *, std::less<Mac48Address> > Originators;
/**
* typedef for a map between address, OriginatorRxStatus, and Traffic ID
*/
typedef std::map <std::pair<Mac48Address, uint8_t>, OriginatorRxStatus *, std::less<std::pair<Mac48Address,uint8_t> > > QosOriginators;
/**
* typedef for an interator for Originators
*/
typedef std::map <Mac48Address, OriginatorRxStatus *, std::less<Mac48Address> >::iterator OriginatorsI;
/**
* typedef for an interator for QosOriginators
*/
typedef std::map <std::pair<Mac48Address, uint8_t>, OriginatorRxStatus *, std::less<std::pair<Mac48Address,uint8_t> > >::iterator QosOriginatorsI;
Originators m_originatorStatus; ///< originator status
QosOriginators m_qosOriginatorStatus; ///< QOS originator status
ForwardUpCallback m_callback; ///< forward up callback
};
} //namespace ns3
#endif /* MAC_RX_MIDDLE_H */
|