/usr/include/ns3.17/ns3/uan-mac-cw.h is in libns3-dev 3.17+dfsg-1build1.
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 132 133 134 135 136 137 138 139 140 141 142 143 | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2009 University of Washington
*
* 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: Leonard Tracy <lentracy@gmail.com>
*/
#ifndef UAN_MAC_CW_H
#define UAN_MAC_CW_H
#include "ns3/uan-mac.h"
#include "ns3/nstime.h"
#include "ns3/simulator.h"
#include "ns3/uan-phy.h"
#include "ns3/uan-tx-mode.h"
#include "ns3/uan-address.h"
#include "ns3/random-variable-stream.h"
namespace ns3 {
/**
* \class UanMacCw
* \brief CW-MAC A MAC protocol similar in idea to the 802.11 DCF with constant backoff window
*
* For more information on this MAC protocol, see:
* Parrish, N.; Tracy, L.; Roy, S.; Arabshahi, P.; Fox, W.,
* "System Design Considerations for Undersea Networks: Link and Multiple Access Protocols,"
* Selected Areas in Communications, IEEE Journal on , vol.26, no.9, pp.1720-1730, December 2008
*/
class UanMacCw : public UanMac,
public UanPhyListener
{
public:
UanMacCw ();
virtual ~UanMacCw ();
static TypeId GetTypeId (void);
/**
* \param cw Contention window size
*/
virtual void SetCw (uint32_t cw);
/**
* \param duration Slot time duration
*/
virtual void SetSlotTime (Time duration);
/**
* \returns Contention window size
*/
virtual uint32_t GetCw (void);
/**
* \returns slot time duration
*/
virtual Time GetSlotTime (void);
// Inherited methods
virtual Address GetAddress ();
virtual void SetAddress (UanAddress addr);
virtual bool Enqueue (Ptr<Packet> pkt, const Address &dest, uint16_t protocolNumber);
virtual void SetForwardUpCb (Callback<void, Ptr<Packet>, const UanAddress&> cb);
virtual void AttachPhy (Ptr<UanPhy> phy);
virtual Address GetBroadcast (void) const;
virtual void Clear (void);
// PHY listeners
/// Function called by UanPhy object to notify of packet reception
virtual void NotifyRxStart (void);
/// Function called by UanPhy object to notify of packet received successfully
virtual void NotifyRxEndOk (void);
/// Function called by UanPhy object to notify of packet received in error
virtual void NotifyRxEndError (void);
/// Function called by UanPhy object to notify of channel sensed busy
virtual void NotifyCcaStart (void);
/// Function called by UanPhy object to notify of channel no longer sensed busy
virtual void NotifyCcaEnd (void);
/// Function called by UanPhy object to notify of outgoing transmission start
virtual void NotifyTxStart (Time duration);
/**
* Assign a fixed random variable stream number to the random variables
* used by this model. Return the number of streams (possibly zero) that
* have been assigned.
*
* \param stream first stream index to use
* \return the number of stream indices assigned by this model
*/
int64_t AssignStreams (int64_t stream);
private:
typedef enum {
IDLE, CCABUSY, RUNNING, TX
} State;
Callback <void, Ptr<Packet>, const UanAddress& > m_forwardUpCb;
UanAddress m_address;
Ptr<UanPhy> m_phy;
TracedCallback<Ptr<const Packet>, UanTxMode > m_rxLogger;
TracedCallback<Ptr<const Packet>, uint16_t > m_enqueueLogger;
TracedCallback<Ptr<const Packet>, uint16_t > m_dequeueLogger;
// Mac parameters
uint32_t m_cw;
Time m_slotTime;
// State variables
Time m_sendTime;
Time m_savedDelayS;
Ptr<Packet> m_pktTx;
uint16_t m_pktTxProt;
EventId m_sendEvent;
EventId m_txEndEvent;
State m_state;
bool m_cleared;
/// Provides uniform random variables.
Ptr<UniformRandomVariable> m_rv;
void PhyRxPacketGood (Ptr<Packet> packet, double sinr, UanTxMode mode);
void PhyRxPacketError (Ptr<Packet> packet, double sinr);
void SaveTimer (void);
void StartTimer (void);
void SendPacket (void);
void EndTx (void);
protected:
virtual void DoDispose ();
};
}
#endif /* UAN_MAC_CW_H */
|