A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
yans-wifi-channel.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2006,2007 INRIA
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Mathieu Lacage, <mathieu.lacage@sophia.inria.fr>
7 */
8
9#ifndef YANS_WIFI_CHANNEL_H
10#define YANS_WIFI_CHANNEL_H
11
12#include "wifi-units.h"
13
14#include "ns3/channel.h"
15#include "ns3/wifi-export.h"
16
17namespace ns3
18{
19
20class NetDevice;
23class YansWifiPhy;
24class Packet;
25class Time;
26class WifiPpdu;
27
28/**
29 * @brief a channel to interconnect ns3::YansWifiPhy objects.
30 * @ingroup wifi
31 *
32 * This class is expected to be used in tandem with the ns3::YansWifiPhy
33 * class and supports an ns3::PropagationLossModel and an
34 * ns3::PropagationDelayModel. By default, no propagation models are set;
35 * it is the caller's responsibility to set them before using the channel.
36 */
37class WIFI_EXPORT YansWifiChannel : public Channel
38{
39 public:
40 /**
41 * @brief Get the type ID.
42 * @return the object TypeId
43 */
44 static TypeId GetTypeId();
45
47 ~YansWifiChannel() override;
48
49 std::size_t GetNDevices() const override;
50 Ptr<NetDevice> GetDevice(std::size_t i) const override;
51
52 /**
53 * Adds the given YansWifiPhy to the PHY list
54 *
55 * @param phy the YansWifiPhy to be added to the PHY list
56 */
57 void Add(Ptr<YansWifiPhy> phy);
58
59 /**
60 * @param loss the new propagation loss model.
61 */
63 /**
64 * @param delay the new propagation delay model.
65 */
67
68 /**
69 * @param sender the PHY object from which the packet is originating.
70 * @param ppdu the PPDU to send
71 * @param txPower the TX power associated to the packet
72 *
73 * This method should not be invoked by normal users. It is
74 * currently invoked only from YansWifiPhy::StartTx. The channel
75 * attempts to deliver the PPDU to all other YansWifiPhy objects
76 * on the channel (except for the sender).
77 */
78 void Send(Ptr<YansWifiPhy> sender, Ptr<const WifiPpdu> ppdu, dBm_u txPower) const;
79
80 /**
81 * Assign a fixed random variable stream number to the random variables
82 * used by this model. Return the number of streams (possibly zero) that
83 * have been assigned.
84 *
85 * @param stream first stream index to use
86 *
87 * @return the number of stream indices assigned by this model
88 */
89 int64_t AssignStreams(int64_t stream);
90
91 private:
92 /**
93 * A vector of pointers to YansWifiPhy.
94 */
95 typedef std::vector<Ptr<YansWifiPhy>> PhyList;
96
97 /**
98 * This method is scheduled by Send for each associated YansWifiPhy.
99 * The method then calls the corresponding YansWifiPhy that the first
100 * bit of the PPDU has arrived.
101 *
102 * @param receiver the device to which the packet is destined
103 * @param ppdu the PPDU being sent
104 * @param txPower the TX power associated to the packet being sent
105 */
106 static void Receive(Ptr<YansWifiPhy> receiver, Ptr<const WifiPpdu> ppdu, dBm_u txPower);
107
108 PhyList m_phyList; //!< List of YansWifiPhys connected to this YansWifiChannel
109 Ptr<PropagationLossModel> m_loss; //!< Propagation loss model
110 Ptr<PropagationDelayModel> m_delay; //!< Propagation delay model
111};
112
113} // namespace ns3
114
115#endif /* YANS_WIFI_CHANNEL_H */
Network layer to device interface.
Definition net-device.h:87
network packets
Definition packet.h:228
calculate a propagation delay.
Models the propagation loss through a transmission medium.
Smart pointer class similar to boost::intrusive_ptr.
Definition ptr.h:70
Simulation virtual time values and global simulation resolution.
Definition nstime.h:95
a unique identifier for an interface.
Definition type-id.h:50
WifiPpdu stores a preamble, a modulation class, PHY headers and a PSDU.
Definition wifi-ppdu.h:48
void SetPropagationLossModel(const Ptr< PropagationLossModel > loss)
Ptr< PropagationDelayModel > m_delay
Propagation delay model.
static void Receive(Ptr< YansWifiPhy > receiver, Ptr< const WifiPpdu > ppdu, dBm_u txPower)
This method is scheduled by Send for each associated YansWifiPhy.
static TypeId GetTypeId()
Get the type ID.
std::vector< Ptr< YansWifiPhy > > PhyList
A vector of pointers to YansWifiPhy.
Ptr< NetDevice > GetDevice(std::size_t i) const override
PhyList m_phyList
List of YansWifiPhys connected to this YansWifiChannel.
Ptr< PropagationLossModel > m_loss
Propagation loss model.
std::size_t GetNDevices() const override
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
void SetPropagationDelayModel(const Ptr< PropagationDelayModel > delay)
void Add(Ptr< YansWifiPhy > phy)
Adds the given YansWifiPhy to the PHY list.
802.11 PHY layer model
static void Send(Ptr< NetDevice > dev, int level, std::string emuMode)
Every class exported by the ns3 library is enclosed in the ns3 namespace.
double dBm_u
dBm weak type
Definition wifi-units.h:27
Declaration of the SI units (as weak types aliases) used across wifi module.