A Discrete-Event Network Simulator
API
uan-channel.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2009 University of Washington
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  *
17  * Author: Leonard Tracy <lentracy@gmail.com>
18  */
19 
20 #ifndef UAN_CHANNEL_H
21 #define UAN_CHANNEL_H
22 
23 #include "ns3/channel.h"
24 #include "ns3/net-device.h"
25 #include "ns3/packet.h"
26 #include "ns3/uan-noise-model.h"
27 #include "ns3/uan-prop-model.h"
28 
29 #include <list>
30 #include <vector>
31 
32 namespace ns3
33 {
34 
35 class UanNetDevice;
36 class UanPhy;
37 class UanTransducer;
38 class UanTxMode;
39 
45 class UanChannel : public Channel
46 {
47  public:
52  typedef std::vector<std::pair<Ptr<UanNetDevice>, Ptr<UanTransducer>>> UanDeviceList;
53 
54  UanChannel();
55  ~UanChannel() override;
56 
61  static TypeId GetTypeId();
62 
63  // Inherited methods
64  std::size_t GetNDevices() const override;
65  Ptr<NetDevice> GetDevice(std::size_t i) const override;
66 
75  virtual void TxPacket(Ptr<UanTransducer> src,
76  Ptr<Packet> packet,
77  double txPowerDb,
78  UanTxMode txmode);
79 
87 
95 
102  void SetNoiseModel(Ptr<UanNoiseModel> noise);
103 
110  double GetNoiseDbHz(double fKhz);
111 
114  void Clear();
115 
116  protected:
121  bool m_cleared;
122 
132  void SendUp(uint32_t i, Ptr<Packet> packet, double rxPowerDb, UanTxMode txMode, UanPdp pdp);
133 
134  void DoDispose() override;
135 
136 }; // class UanChannel
137 
138 } // namespace ns3
139 
140 #endif /* UAN_CHANNEL_H */
Abstract Channel Base Class.
Definition: channel.h:45
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
a unique identifier for an interface.
Definition: type-id.h:60
Channel class used by UAN devices.
Definition: uan-channel.h:46
void SetNoiseModel(Ptr< UanNoiseModel > noise)
Set the noise model this channel will use to determine ambient channel noise.
Definition: uan-channel.cc:196
double GetNoiseDbHz(double fKhz)
Get the noise level on the channel.
Definition: uan-channel.cc:210
void AddDevice(Ptr< UanNetDevice > dev, Ptr< UanTransducer > trans)
Adds device to receiver list for this channel.
Definition: uan-channel.cc:141
UanChannel()
Constructor.
Definition: uan-channel.cc:68
Ptr< UanPropModel > m_prop
The propagation model.
Definition: uan-channel.h:118
static TypeId GetTypeId()
Register this type.
Definition: uan-channel.cc:48
Ptr< UanNoiseModel > m_noise
The noise model.
Definition: uan-channel.h:119
~UanChannel() override
Dummy destructor, see DoDispose.
Definition: uan-channel.cc:75
void DoDispose() override
Destructor implementation.
Definition: uan-channel.cc:115
virtual void TxPacket(Ptr< UanTransducer > src, Ptr< Packet > packet, double txPowerDb, UanTxMode txmode)
Send a packet out on the channel.
Definition: uan-channel.cc:148
std::size_t GetNDevices() const override
Definition: uan-channel.cc:129
bool m_cleared
Has Clear ever been called on the channel.
Definition: uan-channel.h:121
Ptr< NetDevice > GetDevice(std::size_t i) const override
Definition: uan-channel.cc:135
std::vector< std::pair< Ptr< UanNetDevice >, Ptr< UanTransducer > > > UanDeviceList
UanDeviceList is a standard template vector of pairs (UanNetDevice, UanTransducer)
Definition: uan-channel.h:52
UanDeviceList m_devList
The list of devices on this channel.
Definition: uan-channel.h:117
void SendUp(uint32_t i, Ptr< Packet > packet, double rxPowerDb, UanTxMode txMode, UanPdp pdp)
Send a packet up to the receiving UanTransducer.
Definition: uan-channel.cc:203
void Clear()
Clear all pointer references.
Definition: uan-channel.cc:80
void SetPropagationModel(Ptr< UanPropModel > prop)
Set the propagation model this channel will use for path loss/propagation delay.
Definition: uan-channel.cc:122
The power delay profile returned by propagation models.
Abstraction of packet modulation information.
Definition: uan-tx-mode.h:43
Every class exported by the ns3 library is enclosed in the ns3 namespace.