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
16namespace ns3
17{
18
19class NetDevice;
20class PropagationLossModel;
21class PropagationDelayModel;
22class YansWifiPhy;
23class Packet;
24class Time;
25class WifiPpdu;
26
27/**
28 * \brief a channel to interconnect ns3::YansWifiPhy objects.
29 * \ingroup wifi
30 *
31 * This class is expected to be used in tandem with the ns3::YansWifiPhy
32 * class and supports an ns3::PropagationLossModel and an
33 * ns3::PropagationDelayModel. By default, no propagation models are set;
34 * it is the caller's responsibility to set them before using the channel.
35 */
37{
38 public:
39 /**
40 * \brief Get the type ID.
41 * \return the object TypeId
42 */
43 static TypeId GetTypeId();
44
46 ~YansWifiChannel() override;
47
48 std::size_t GetNDevices() const override;
49 Ptr<NetDevice> GetDevice(std::size_t i) const override;
50
51 /**
52 * Adds the given YansWifiPhy to the PHY list
53 *
54 * \param phy the YansWifiPhy to be added to the PHY list
55 */
56 void Add(Ptr<YansWifiPhy> phy);
57
58 /**
59 * \param loss the new propagation loss model.
60 */
62 /**
63 * \param delay the new propagation delay model.
64 */
66
67 /**
68 * \param sender the PHY object from which the packet is originating.
69 * \param ppdu the PPDU to send
70 * \param txPower the TX power associated to the packet
71 *
72 * This method should not be invoked by normal users. It is
73 * currently invoked only from YansWifiPhy::StartTx. The channel
74 * attempts to deliver the PPDU to all other YansWifiPhy objects
75 * on the channel (except for the sender).
76 */
77 void Send(Ptr<YansWifiPhy> sender, Ptr<const WifiPpdu> ppdu, dBm_u txPower) const;
78
79 /**
80 * Assign a fixed random variable stream number to the random variables
81 * used by this model. Return the number of streams (possibly zero) that
82 * have been assigned.
83 *
84 * \param stream first stream index to use
85 *
86 * \return the number of stream indices assigned by this model
87 */
88 int64_t AssignStreams(int64_t stream);
89
90 private:
91 /**
92 * A vector of pointers to YansWifiPhy.
93 */
94 typedef std::vector<Ptr<YansWifiPhy>> PhyList;
95
96 /**
97 * This method is scheduled by Send for each associated YansWifiPhy.
98 * The method then calls the corresponding YansWifiPhy that the first
99 * bit of the PPDU has arrived.
100 *
101 * \param receiver the device to which the packet is destined
102 * \param ppdu the PPDU being sent
103 * \param txPower the TX power associated to the packet being sent
104 */
105 static void Receive(Ptr<YansWifiPhy> receiver, Ptr<const WifiPpdu> ppdu, dBm_u txPower);
106
107 PhyList m_phyList; //!< List of YansWifiPhys connected to this YansWifiChannel
108 Ptr<PropagationLossModel> m_loss; //!< Propagation loss model
109 Ptr<PropagationDelayModel> m_delay; //!< Propagation delay model
110};
111
112} // namespace ns3
113
114#endif /* YANS_WIFI_CHANNEL_H */
Abstract Channel Base Class.
Definition channel.h:34
Smart pointer class similar to boost::intrusive_ptr.
a unique identifier for an interface.
Definition type-id.h:48
a channel to interconnect ns3::YansWifiPhy objects.
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
void Send(Ptr< YansWifiPhy > sender, Ptr< const WifiPpdu > ppdu, dBm_u txPower) const
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.
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
Definition nstime.h:828
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Declaration of the SI units (as weak types aliases) used across wifi module.