/usr/include/ns3.17/ns3/uan-phy-dual.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 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | /* -*- 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>
* Andrea Sacco <andrea.sacco85@gmail.com>
*/
#ifndef UAN_PHY_DUAL_H
#define UAN_PHY_DUAL_H
#include "ns3/uan-phy.h"
namespace ns3 {
class UanTxMode;
class UanModesList;
/**
* \class UanPhyCalcSinrDual
* \brief Default SINR model for UanPhyDual
*
* Considers interfering packet power as additional ambient noise only
* if there is overlap in frequency band as found from supplied UanTxMode.
* If there is no overlap, then the packets are considered not to interfere.
*/
class UanPhyCalcSinrDual : public UanPhyCalcSinr
{
public:
UanPhyCalcSinrDual ();
virtual ~UanPhyCalcSinrDual ();
static TypeId GetTypeId (void);
virtual double CalcSinrDb (Ptr<Packet> pkt,
Time arrTime,
double rxPowerDb,
double ambNoiseDb,
UanTxMode mode,
UanPdp pdp,
const UanTransducer::ArrivalList &arrivalList
) const;
};
/**
* \class UanPhyDual
*
* A class that wraps two generic UAN Phy layers (UanPhyGen) into a single PHY.
* This is used to simulate two receivers (and transmitters) that use
* the same front end hardware. When attached to a UanTransducerHd,
* this results in a net device able to transmit on one or two channels
* simultaneously or receive on one or two channels simultaneously but
* that cannot transmit and receive simultaneously.
*
* Many of the standard PHY functions here become ambiguous. In most cases
* information for "Phy1" are returned.
*/
class UanPhyDual : public UanPhy
{
public:
UanPhyDual ();
virtual ~UanPhyDual ();
static TypeId GetTypeId ();
virtual void SetEnergyModelCallback (DeviceEnergyModel::ChangeStateCallback callback);
virtual void EnergyDepletionHandler (void);
virtual void SendPacket (Ptr<Packet> pkt, uint32_t modeNum);
/**
* \brief Register a class to receive phy state change notifications
* \param listener Class derived from UanPhyListener to receive notifications
*
* Note that, from UanPhyDual, you may receive duplicate
* messages as underneath there are two generic phys here.
* Each will notify of state changes independently.
*/
virtual void RegisterListener (UanPhyListener *listener);
virtual void StartRxPacket (Ptr<Packet> pkt, double rxPowerDb, UanTxMode txMode, UanPdp pdp);
virtual void SetReceiveOkCallback (RxOkCallback cb);
virtual void SetReceiveErrorCallback (RxErrCallback cb);
virtual void SetRxGainDb (double gain);
virtual void SetTxPowerDb (double txpwr);
virtual void SetRxThresholdDb (double thresh);
virtual void SetCcaThresholdDb (double thresh);
virtual double GetRxGainDb (void);
virtual double GetTxPowerDb (void);
virtual double GetRxThresholdDb (void);
virtual double GetCcaThresholdDb (void);
virtual bool IsStateSleep (void);
virtual bool IsStateIdle (void);
virtual bool IsStateBusy (void);
virtual bool IsStateRx (void);
virtual bool IsStateTx (void);
virtual bool IsStateCcaBusy (void);
virtual Ptr<UanChannel> GetChannel (void) const;
virtual Ptr<UanNetDevice> GetDevice (void);
virtual void SetChannel (Ptr<UanChannel> channel);
virtual void SetDevice (Ptr<UanNetDevice> device);
virtual void SetMac (Ptr<UanMac> mac);
virtual void NotifyTransStartTx (Ptr<Packet> packet, double txPowerDb, UanTxMode txMode);
virtual void NotifyIntChange (void);
virtual void SetTransducer (Ptr<UanTransducer> trans);
virtual Ptr<UanTransducer> GetTransducer (void);
virtual uint32_t GetNModes (void);
virtual UanTxMode GetMode (uint32_t n);
virtual void Clear (void);
/**
* /returns True if Phy1 is Idle
*/
bool IsPhy1Idle (void);
/**
* /returns True if Phy2 is Idle
*/
bool IsPhy2Idle (void);
/**
* /returns True if Phy1 is currently in RX mode
*/
bool IsPhy1Rx (void);
/**
* /returns True if Phy2 is currently in RX mode
*/
bool IsPhy2Rx (void);
/**
* /returns True if Phy1 is in TX mode
*/
bool IsPhy1Tx (void);
/**
* /returns True if Phy2 is in TX mode
*/
bool IsPhy2Tx (void);
// Attribute getters and setters
/**
* \returns Clear channel assessment threshold of Phy1
*/
double GetCcaThresholdPhy1 (void) const;
/**
* \returns Clear channel assessment threshold of Phy2
*/
double GetCcaThresholdPhy2 (void) const;
/**
* \param thresh Signal power threshold in dB to set Phy1 to
*/
void SetCcaThresholdPhy1 (double thresh);
/**
* \param thresh Signal power threshold in dB to set Phy2 to
*/
void SetCcaThresholdPhy2 (double thresh);
/**
* \returns Current TX power setting of Phy 1 in dB
*/
double GetTxPowerDbPhy1 (void) const;
/**
* \returns Current TX power setting of Phy 2 in dB
*/
double GetTxPowerDbPhy2 (void) const;
/**
* \returns TX power setting of Phy1 in dB
*/
void SetTxPowerDbPhy1 (double);
/**
* \returns TX power setting of Phy2 in dB
*/
void SetTxPowerDbPhy2 (double);
/**
* \returns RX gain of Phy1 in dB
*/
double GetRxGainDbPhy1 (void) const;
/**
* \returns RX gain of Phy2 in dB
*/
double GetRxGainDbPhy2 (void) const;
/**
* \param gain value in dB to apply to RX gain of Phy1
*/
void SetRxGainDbPhy1 (double gain);
/**
* \param gain value in dB to apply to RX gain of Phy2
*/
void SetRxGainDbPhy2 (double gain);
/**
* \returns List of available modes on Phy1
*/
UanModesList GetModesPhy1 (void) const;
/**
* \returns List of available modes on Phy2
*/
UanModesList GetModesPhy2 (void) const;
/**
* \param modes List of modes to use on Phy1 (index corresponds to mode #)
*/
void SetModesPhy1 (UanModesList modes);
/**
* \param modes List of modes to use on Phy2 (index corresponds to mode #)
*/
void SetModesPhy2 (UanModesList modes);
/**
* \returns Ptr to PER model for Phy1
*/
Ptr<UanPhyPer> GetPerModelPhy1 (void) const;
/**
* \returns Ptr to PER model for Phy2
*/
Ptr<UanPhyPer> GetPerModelPhy2 (void) const;
/**
* \param per Ptr to PER model to use on Phy1
*/
void SetPerModelPhy1 (Ptr<UanPhyPer> per);
/**
* \param per Ptr to PER model to use on Phy2
*/
void SetPerModelPhy2 (Ptr<UanPhyPer> per);
/**
* \returns Ptr to SINR model for Phy1
*/
Ptr<UanPhyCalcSinr> GetSinrModelPhy1 (void) const;
/**
* \returns Ptr to SINR model for Phy2
*/
Ptr<UanPhyCalcSinr> GetSinrModelPhy2 (void) const;
/**
* \param calcSinr Ptr to SINR model to use on Phy1
*/
void SetSinrModelPhy1 (Ptr<UanPhyCalcSinr> calcSinr);
/**
* \param calcSinr Ptr to SINR model to use on Phy2
*/
void SetSinrModelPhy2 (Ptr<UanPhyCalcSinr> calcSinr);
virtual void SetSleepMode (bool sleep)
{
//TODO This method has to be implemented
}
/**
* \returns Packet currently being received on Phy1 (Null Ptr if none)
*/
Ptr<Packet> GetPhy1PacketRx (void) const;
/**
* \returns Packet currently being received on Phy2 (Null Ptr if none)
*/
Ptr<Packet> GetPhy2PacketRx (void) const;
/**
* \returns Packet currenty being received on Phy1 (Null Ptr if none)
*/
Ptr<Packet> GetPacketRx (void) const;
/**
* 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:
Ptr<UanPhy> m_phy1;
Ptr<UanPhy> m_phy2;
TracedCallback<Ptr<const Packet>, double, UanTxMode > m_rxOkLogger;
TracedCallback<Ptr<const Packet>, double, UanTxMode > m_rxErrLogger;
TracedCallback<Ptr<const Packet>, double, UanTxMode > m_txLogger;
RxOkCallback m_recOkCb;
RxErrCallback m_recErrCb;
void RxOkFromSubPhy (Ptr<Packet> pkt, double sinr, UanTxMode mode);
void RxErrFromSubPhy (Ptr<Packet> pkt, double sinr);
protected:
virtual void DoDispose ();
};
}
#endif /* UAN_PHY_DUAL_H */
|