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 "uan-noise-model.h"
24 #include "uan-prop-model.h"
25 
26 #include "ns3/channel.h"
27 #include "ns3/net-device.h"
28 #include "ns3/packet.h"
29 
30 #include <list>
31 #include <vector>
32 
33 namespace ns3
34 {
35 
36 class UanNetDevice;
37 class UanPhy;
38 class UanTransducer;
39 class UanTxMode;
40 
46 class UanChannel : public Channel
47 {
48  public:
53  typedef std::vector<std::pair<Ptr<UanNetDevice>, Ptr<UanTransducer>>> UanDeviceList;
54 
55  UanChannel();
56  ~UanChannel() override;
57 
62  static TypeId GetTypeId();
63 
64  // Inherited methods
65  std::size_t GetNDevices() const override;
66  Ptr<NetDevice> GetDevice(std::size_t i) const override;
67 
76  virtual void TxPacket(Ptr<UanTransducer> src,
77  Ptr<Packet> packet,
78  double txPowerDb,
79  UanTxMode txmode);
80 
88 
96 
103  void SetNoiseModel(Ptr<UanNoiseModel> noise);
104 
111  double GetNoiseDbHz(double fKhz);
112 
115  void Clear();
116 
117  protected:
122  bool m_cleared;
123 
133  void SendUp(uint32_t i, Ptr<Packet> packet, double rxPowerDb, UanTxMode txMode, UanPdp pdp);
134 
135  void DoDispose() override;
136 
137 }; // class UanChannel
138 
139 } // namespace ns3
140 
141 #endif /* UAN_CHANNEL_H */
Abstract Channel Base Class.
Definition: channel.h:45
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:77
a unique identifier for an interface.
Definition: type-id.h:59
Channel class used by UAN devices.
Definition: uan-channel.h:47
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:119
static TypeId GetTypeId()
Register this type.
Definition: uan-channel.cc:48
Ptr< UanNoiseModel > m_noise
The noise model.
Definition: uan-channel.h:120
~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:122
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:53
UanDeviceList m_devList
The list of devices on this channel.
Definition: uan-channel.h:118
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.