60 lines
1.4 KiB
C
60 lines
1.4 KiB
C
|
|
#ifndef SWITCH_CHANNEL_H
|
||
|
|
#define SWITCH_CHANNEL_H
|
||
|
|
|
||
|
|
#include "ns3/channel.h"
|
||
|
|
#include "ns3/net-device.h"
|
||
|
|
|
||
|
|
#include <vector>
|
||
|
|
|
||
|
|
/**
|
||
|
|
* \file
|
||
|
|
* \ingroup ethernet
|
||
|
|
* ns3::SwitchChannel declaration.
|
||
|
|
*/
|
||
|
|
|
||
|
|
namespace ns3
|
||
|
|
{
|
||
|
|
|
||
|
|
/**
|
||
|
|
* \ingroup bridge
|
||
|
|
*
|
||
|
|
* \brief Virtual channel implementation for bridges (BridgeNetDevice).
|
||
|
|
*
|
||
|
|
* Just like SwitchNetDevice aggregates multiple NetDevices,
|
||
|
|
* SwitchChannel aggregates multiple channels and make them appear as
|
||
|
|
* a single channel to upper layers.
|
||
|
|
* This class is greatly inspire form BridgeChannel
|
||
|
|
*/
|
||
|
|
class SwitchChannel : public Channel
|
||
|
|
{
|
||
|
|
public:
|
||
|
|
/**
|
||
|
|
* \brief Get the type ID.
|
||
|
|
* \return the object TypeId
|
||
|
|
*/
|
||
|
|
static TypeId GetTypeId();
|
||
|
|
SwitchChannel();
|
||
|
|
~SwitchChannel() override;
|
||
|
|
|
||
|
|
// Delete copy constructor and assignment operator to avoid misuse
|
||
|
|
SwitchChannel(const SwitchChannel&) = delete;
|
||
|
|
SwitchChannel& operator=(const SwitchChannel&) = delete;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Adds a channel to the bridged pool
|
||
|
|
* \param bridgedChannel the channel to add to the pool
|
||
|
|
*/
|
||
|
|
void AddChannel(Ptr<Channel> bridgedChannel);
|
||
|
|
|
||
|
|
// virtual methods implementation, from Channel
|
||
|
|
std::size_t GetNDevices() const override;
|
||
|
|
Ptr<NetDevice> GetDevice(std::size_t i) const override;
|
||
|
|
|
||
|
|
private:
|
||
|
|
std::vector<Ptr<Channel>> m_switchedChannels; //!< pool of switched channels
|
||
|
|
};
|
||
|
|
|
||
|
|
} // namespace ns3
|
||
|
|
|
||
|
|
#endif /* SWITCH_CHANNEL_H */
|