/usr/include/ns3/uan-tx-mode.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 | /* -*- 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_TX_MODE_H
#define UAN_TX_MODE_H
#include "ns3/object.h"
#include <map>
namespace ns3 {
class UanTxModeFactory;
class UanTxMode;
/**
* \class UanTxMode
* \brief Abstraction of packet modulation information
*/
class UanTxMode
{
public:
UanTxMode ();
~UanTxMode ();
/**
* Modulation type
*/
typedef enum {
PSK, QAM, FSK, OTHER
} ModulationType;
/**
* \returns The modulation type of the mode
*/
ModulationType GetModType (void) const;
/**
* \returns Data rate of the TX mode in bits per second
*/
uint32_t GetDataRateBps (void) const;
/**
* \returns PHY rate in symbols per second
*/
uint32_t GetPhyRateSps (void) const;
/**
* \returns Center frequency of transmitted signal in Hz
*/
uint32_t GetCenterFreqHz (void) const;
/**
* \returns Bandwidth of transmitted signal in Hz
*/
uint32_t GetBandwidthHz (void) const;
/**
* \returns Number of constellation points in modulation
*/
uint32_t GetConstellationSize (void) const;
/**
* \returns Name
*/
std::string GetName (void) const;
/**
* \returns Unique ID
*/
uint32_t GetUid (void) const;
private:
friend class UanTxModeFactory;
friend std::ostream &operator<< (std::ostream & os, const UanTxMode &mode);
friend std::istream &operator>> (std::istream & is, UanTxMode &mode);
uint32_t m_uid;
};
/**
* \brief Writes tx mode entry to stream os
*/
std::ostream & operator << (std::ostream & os, const UanTxMode &mode);
/**
* \brief Reads tx mode entry from stream is
*/
std::istream & operator >> (std::istream & is, const UanTxMode &mode);
class UanTxModeFactory
{
public:
UanTxModeFactory ();
~UanTxModeFactory ();
/**
*
* \param type modulation type
* \param dataRateBps Data rate in BPS
* \param phyRateSps Symbol rate in symbols per second
* \param cfHz Center frequency in Hz
* \param bwHz Bandwidth in Hz
* \param constSize Modulation constellation size (2 for BPSK, 4 for QPSK)
* \param name Unique string name for this transmission mode
*/
static UanTxMode CreateMode (UanTxMode::ModulationType type,
uint32_t dataRateBps,
uint32_t phyRateSps,
uint32_t cfHz,
uint32_t bwHz,
uint32_t constSize,
std::string name);
/**
* \param name String name of mode
* \returns Mode with given name
*/
static UanTxMode GetMode (std::string name);
/**
* \param uid Unique ID of mode
* \returns The mode with given uid
*/
static UanTxMode GetMode (uint32_t uid);
private:
friend class UanTxMode;
uint32_t m_nextUid;
struct UanTxModeItem
{
UanTxMode::ModulationType m_type;
uint32_t m_cfHz;
uint32_t m_bwHz;
uint32_t m_dataRateBps;
uint32_t m_phyRateSps;
uint32_t m_constSize;
uint32_t m_uid;
std::string m_name;
};
std::map<uint32_t, UanTxModeItem> m_modes;
bool NameUsed (std::string name);
static UanTxModeFactory &GetFactory (void);
UanTxModeItem &GetModeItem (uint32_t uid);
UanTxModeItem &GetModeItem (std::string name);
UanTxMode MakeModeFromItem (const UanTxModeItem &item);
};
/**
* \class UanModesList
* \brief Container for UanTxModes
*/
class UanModesList
{
public:
UanModesList ();
virtual ~UanModesList ();
/**
* \param mode Add mode to list
*/
void AppendMode (UanTxMode mode);
/**
* \brief delete mode at given index
* \param num Index of mode to delete
*/
void DeleteMode (uint32_t num);
/**
* \param index Mode index
* \returns mode at given index
*/
UanTxMode operator[] (uint32_t index) const;
/**
* \returns Number of modes in list
*/
uint32_t GetNModes (void) const;
private:
std::vector<UanTxMode> m_modes;
friend std::ostream &operator << (std::ostream &os, const UanModesList &ml);
friend std::istream &operator >> (std::istream &is, UanModesList &ml);
};
/**
* \brief Write UanModesList to stream os
*/
std::ostream &operator << (std::ostream &os, const UanModesList &ml);
/**
* \brief Read UanModesList from stream is
*/
std::istream &operator >> (std::istream &is, UanModesList &ml);
/// UanModesList is attribute value
ATTRIBUTE_HELPER_HEADER (UanModesList);
} // namespace ns3
#endif /* UAN_TX_MODE_H */
|