A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
simple-channel.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008 INRIA
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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
18 */
19#ifndef SIMPLE_CHANNEL_H
20#define SIMPLE_CHANNEL_H
21
22#include "mac48-address.h"
23
24#include "ns3/channel.h"
25#include "ns3/nstime.h"
26
27#include <map>
28#include <vector>
29
30namespace ns3
31{
32
33class SimpleNetDevice;
34class Packet;
35
48class SimpleChannel : public Channel
49{
50 public:
55 static TypeId GetTypeId();
57
70 virtual void Send(Ptr<Packet> p,
71 uint16_t protocol,
72 Mac48Address to,
73 Mac48Address from,
75
81 virtual void Add(Ptr<SimpleNetDevice> device);
82
91
100
101 // inherited from ns3::Channel
102 std::size_t GetNDevices() const override;
103 Ptr<NetDevice> GetDevice(std::size_t i) const override;
104
105 private:
107 std::vector<Ptr<SimpleNetDevice>> m_devices;
108 std::map<Ptr<SimpleNetDevice>, std::vector<Ptr<SimpleNetDevice>>>
110};
111
112} // namespace ns3
113
114#endif /* SIMPLE_CHANNEL_H */
Abstract Channel Base Class.
Definition: channel.h:45
an EUI-48 address
Definition: mac48-address.h:46
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:78
A simple channel, for simple things and testing.
virtual void BlackList(Ptr< SimpleNetDevice > from, Ptr< SimpleNetDevice > to)
Blocks the communications from a NetDevice to another NetDevice.
std::vector< Ptr< SimpleNetDevice > > m_devices
devices connected by the channel
Ptr< NetDevice > GetDevice(std::size_t i) const override
std::map< Ptr< SimpleNetDevice >, std::vector< Ptr< SimpleNetDevice > > > m_blackListedDevices
devices blocked on a device
static TypeId GetTypeId()
Get the type ID.
virtual void Add(Ptr< SimpleNetDevice > device)
Attached a net device to the channel.
Time m_delay
The assigned speed-of-light delay of the channel.
std::size_t GetNDevices() const override
virtual void UnBlackList(Ptr< SimpleNetDevice > from, Ptr< SimpleNetDevice > to)
Un-Blocks the communications from a NetDevice to another NetDevice.
virtual void Send(Ptr< Packet > p, uint16_t protocol, Mac48Address to, Mac48Address from, Ptr< SimpleNetDevice > sender)
A packet is sent by a net device.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.