A Discrete-Event Network Simulator
API
uan-channel.h
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2009 University of Washington
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation;
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  *
18  * Author: Leonard Tracy <lentracy@gmail.com>
19  */
20 
21 #ifndef UAN_CHANNEL_H
22 #define UAN_CHANNEL_H
23 
24 #include "ns3/net-device.h"
25 #include "ns3/channel.h"
26 #include "ns3/packet.h"
27 #include "ns3/uan-prop-model.h"
28 #include "ns3/uan-noise-model.h"
29 
30 #include <list>
31 #include <vector>
32 
33 namespace ns3 {
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  virtual ~UanChannel ();
56 
61  static TypeId GetTypeId (void);
62 
63  // Inherited methods
64  virtual std::size_t GetNDevices (void) const;
65  virtual Ptr<NetDevice> GetDevice (std::size_t i) const;
66 
75  virtual void TxPacket (Ptr<UanTransducer> src, Ptr<Packet> packet, double txPowerDb,
76  UanTxMode txmode);
77 
85 
93 
100  void SetNoiseModel (Ptr<UanNoiseModel> noise);
101 
108  double GetNoiseDbHz (double fKhz);
109 
112  void Clear (void);
113 
114 protected:
119  bool m_cleared;
120 
130  void SendUp (uint32_t i, Ptr<Packet> packet, double rxPowerDb, UanTxMode txMode, UanPdp pdp);
131 
132  virtual void DoDispose (void);
133 
134 }; // class UanChannel
135 
136 } // namespace ns3
137 
138 #endif /* UAN_CHANNEL_H */
Abstract Channel Base Class.
Definition: channel.h:44
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
a unique identifier for an interface.
Definition: type-id.h:59
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:199
double GetNoiseDbHz(double fKhz)
Get the noise level on the channel.
Definition: uan-channel.cc:213
virtual std::size_t GetNDevices(void) const
Definition: uan-channel.cc:128
void AddDevice(Ptr< UanNetDevice > dev, Ptr< UanTransducer > trans)
Adds device to receiver list for this channel.
Definition: uan-channel.cc:140
UanChannel()
Constructor.
Definition: uan-channel.cc:67
Ptr< UanPropModel > m_prop
The propagation model.
Definition: uan-channel.h:116
virtual ~UanChannel()
Dummy destructor, see DoDispose.
Definition: uan-channel.cc:74
Ptr< UanNoiseModel > m_noise
The noise model.
Definition: uan-channel.h:117
void Clear(void)
Clear all pointer references.
Definition: uan-channel.cc:79
virtual void DoDispose(void)
Destructor implementation.
Definition: uan-channel.cc:115
static TypeId GetTypeId(void)
Register this type.
Definition: uan-channel.cc:46
virtual void TxPacket(Ptr< UanTransducer > src, Ptr< Packet > packet, double txPowerDb, UanTxMode txmode)
Send a packet out on the channel.
Definition: uan-channel.cc:147
bool m_cleared
Has Clear ever been called on the channel.
Definition: uan-channel.h:119
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:115
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:205
virtual Ptr< NetDevice > GetDevice(std::size_t i) const
Definition: uan-channel.cc:134
void SetPropagationModel(Ptr< UanPropModel > prop)
Set the propagation model this channel will use for path loss/propagation delay.
Definition: uan-channel.cc:121
The power delay profile returned by propagation models.
Abstraction of packet modulation information.
Definition: uan-tx-mode.h:42
Every class exported by the ns3 library is enclosed in the ns3 namespace.