/usr/include/ns3/uan-phy.h is in libns3-dev 3.13+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 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 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | /* -*- 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_H
#define UAN_PHY_H
#include "ns3/object.h"
#include "ns3/uan-mac.h"
#include "ns3/uan-tx-mode.h"
#include "ns3/uan-prop-model.h"
#include "ns3/uan-transducer.h"
#include "ns3/device-energy-model.h"
namespace ns3 {
/**
* \class UanPhyCalcSinr
*
* Class used for calculating SINR of packet in UanPhy.
* Can be set to any derived class using attributes of UanPhy
* to implement different models.
*/
class UanPhyCalcSinr : public Object
{
public:
static TypeId GetTypeId (void);
/**
* \param pkt Packet to calculate SINR for
* \param arrTime Arrival time of pkt
* \param rxPowerDb The received signal strength of the packet in dB re 1 uPa
* \param ambNoiseDb Ambient channel noise in dB re 1 uPa
* \param mode TX Mode of pkt
* \param pdp Power delay profile of pkt
* \param arrivalList List of interfering arrivals given from Transducer.
*/
virtual double CalcSinrDb (Ptr<Packet> pkt,
Time arrTime,
double rxPowerDb,
double ambNoiseDb,
UanTxMode mode,
UanPdp pdp,
const UanTransducer::ArrivalList &arrivalList
) const = 0;
/**
* Clears all pointer references
*/
virtual void Clear (void);
virtual void DoDispose (void);
/**
* \param db dB value
* \returns kilopascals
* \brief Converts dB re 1 uPa to kilopascals
*/
inline double DbToKp (double db) const
{
return pow (10, db / 10.0);
}
/**
* \param kp value in kilopascals
* \returns dB re 1 uPa
* \brief Converts kilopascals to dB re 1 uPa
*/
inline double KpToDb (double kp) const
{
return 10 * log10 (kp);
}
};
/**
* \class UanPhyPer
* Used in UanPhy for determining probability of packet error based on received SINR and
* modulation (mode). Can be set in UanPhy via attributes
*/
class UanPhyPer : public Object
{
public:
static TypeId GetTypeId (void);
/**
* Calculates the prob. of packet error based on
* SINR at the receiver and a tx mode.
* \param pkt Packet which is under consideration
* \param sinrDb SINR at receiver
* \param mode TX mode used to transmit packet
* \returns Probability of packet error
*/
virtual double CalcPer (Ptr<Packet> pkt, double sinrDb, UanTxMode mode) = 0;
/**
* Clears all pointer references
*/
virtual void Clear (void);
virtual void DoDispose (void);
};
/**
* \class UanPhyListener
*
* \brief Interface for PHY event listener
* A class which implements this interface may register with Phy object
* to receive notification of TX/RX/CCA events
*/
class UanPhyListener
{
public:
virtual ~UanPhyListener ()
{
}
/**
* \brief Function called when Phy object begins receiving packet
*/
virtual void NotifyRxStart (void) = 0;
/**
* \brief Function called when Phy object finishes receiving packet without error
*/
virtual void NotifyRxEndOk (void) = 0;
/**
* \brief Function called when Phy object finishes receiving packet in error
*/
virtual void NotifyRxEndError (void) = 0;
/**
* \brief Function called when Phy object begins sensing channel is busy
*/
virtual void NotifyCcaStart (void) = 0;
/**
* \brief Function called when Phy object stops sensing channel is busy
*/
virtual void NotifyCcaEnd (void) = 0;
/**
* \param duration Duration of transmission
* \brief Function called when transmission starts from Phy object
*/
virtual void NotifyTxStart (Time duration) = 0;
};
/**
* \class UanPhy
*
* \brief Base class for UAN Phy models
*/
class UanPhy : public Object
{
public:
static TypeId GetTypeId (void);
/// Enum defining possible Phy states
enum State
{
IDLE, CCABUSY, RX, TX, SLEEP
};
/**
* arg1: packet received successfully
* arg2: snr of packet
* arg3: mode of packet
*/
typedef Callback<void, Ptr<Packet>, double, UanTxMode> RxOkCallback;
/**
* arg1: packet received successfully
* arg2: snr of packet
*/
typedef Callback<void, Ptr<Packet>, double > RxErrCallback;
/**
* \param callback DeviceEnergyModel change state callback.
*
* This function sets the DeviceEnergyModel callback for UanPhy device. Must
* be implemented by UanPhy child classes.
*/
virtual void SetEnergyModelCallback (DeviceEnergyModel::ChangeStateCallback callback) = 0;
/**
* This function handles the energy depletion event. Must
* be implemented by UanPhy child classes.
*/
virtual void EnergyDepletionHandler (void) = 0;
/**
* \param pkt Packet to transmit
* \param modeNum Index of mode in SupportedModes list to use for transmission
*/
virtual void SendPacket (Ptr<Packet> pkt, uint32_t modeNum) = 0;
/**
* \param listener New listener to register
*
* Register an object to be notified of common Phy events
*/
virtual void RegisterListener (UanPhyListener *listener) = 0;
/**
* \brief Packet arriving from channel: i.e. leading bit of packet has arrived.
* \param pkt Packet which is arriving
* \param rxPowerDb Signal power of incoming packet in dB
* \param txMode Transmission mode defining modulation of incoming packet
* \param pdp Power delay profile of incoming packet
*/
virtual void StartRxPacket (Ptr<Packet> pkt, double rxPowerDb, UanTxMode txMode, UanPdp pdp) = 0;
/**
* \param cb Callback to be enabled when packet is received without error
*/
virtual void SetReceiveOkCallback (RxOkCallback cb) = 0;
/**
* \param cb Callback to be enabled when a packet is received with errors
*/
virtual void SetReceiveErrorCallback (RxErrCallback cb) = 0;
/**
* \param gain Gain added at receiver
*/
virtual void SetRxGainDb (double gain) = 0;
/**
* \param txpwr Final output transmission power in dB
*/
virtual void SetTxPowerDb (double txpwr) = 0;
/**
* \param thresh Threshold SINR for propper reception in dB
*/
virtual void SetRxThresholdDb (double thresh) = 0;
/**
* \param thresh Signal power at receiver required for CCA busy state
*
*/
virtual void SetCcaThresholdDb (double thresh) = 0;
/**
* \returns Gain added to signal at receiver in dB
*/
virtual double GetRxGainDb (void) = 0;
/**
* \returns Current TX power output
*/
virtual double GetTxPowerDb (void) = 0;
/**
* \returns Required signal strength, in dB, to begin receiving packet
*/
virtual double GetRxThresholdDb (void) = 0;
/**
* \returns Threshold signal strength in dB to enter CCA busy mode
*/
virtual double GetCcaThresholdDb (void) = 0;
/**
*
* \returns True if Phy is SLEEP
*/
virtual bool IsStateSleep (void) = 0;
/**
*
* \returns True if Phy is IDLE
*/
virtual bool IsStateIdle (void) = 0;
/**
*
* \returns True if Phy is not IDLE
*/
virtual bool IsStateBusy (void) = 0;
/**
*
* \returns True if Phy is currently in receive mode
*/
virtual bool IsStateRx (void) = 0;
/**
*
* \returns True if Phy is busy transmitting
*/
virtual bool IsStateTx (void) = 0;
/**
*
* \returns True if Phy is not TX or RX but the channel is sensed busy
*/
virtual bool IsStateCcaBusy (void) = 0;
/**
* \returns Channel this phy is attached to
*/
virtual Ptr<UanChannel> GetChannel (void) const = 0;
/**
* \returns the Net Device that this Phy is a part of
*/
virtual Ptr<UanNetDevice> GetDevice (void) = 0;
/**
* \param channel The channel this Phy is attached to
*/
virtual void SetChannel (Ptr<UanChannel> channel) = 0;
/**
* \param device The Net Device this Phy is a part of
*/
virtual void SetDevice (Ptr<UanNetDevice> device) = 0;
/**
* \param mac The MAC forwarding messages to this Phy
*/
virtual void SetMac (Ptr<UanMac> mac) = 0;
/**
* \param packet Packet that is beginning transmission
* \param txPowerDb Transmit power of packet
* \param txMode Transmission mode of packet
*
* Notification that there is a transmission beginning
* on the transducer that this Phy is attached to.
*/
virtual void NotifyTransStartTx (Ptr<Packet> packet, double txPowerDb, UanTxMode txMode) = 0;
/**
*
* Function called when there has been a change in the
* ammount of interference this node is experiencing
* from other transmissions
*/
virtual void NotifyIntChange (void) = 0;
/**
*
* \param trans Transducer this Phy outputs to / receives from
*/
virtual void SetTransducer (Ptr<UanTransducer> trans) = 0;
/**
* \returns Transducer this Phy outputs to / receives from
*/
virtual Ptr<UanTransducer> GetTransducer (void) = 0;
/**
* \returns Number of TX modes supported by this PHY
*/
virtual uint32_t GetNModes (void) = 0;
/**
* \param n Mode number of mode to return (place in Modeslist)
* \returns Mode n
*/
virtual UanTxMode GetMode (uint32_t n) = 0;
/**
* \warning Returns non-valid pointer if IsStateRx == false
* \returns Packet currently being received in PHY
*/
virtual Ptr<Packet> GetPacketRx (void) const = 0;
/**
* Clears all pointer references
*/
virtual void Clear (void) = 0;
virtual void SetSleepMode (bool sleep) = 0;
};
}
#endif /* UAN_PHY_H */
|