A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Documentation ▼
Installation
Manual
Models
Contributing
Wiki
Development ▼
API Docs
Issue Tracker
Merge Requests
API
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
30
namespace
ns3
31
{
32
33
class
SimpleNetDevice;
34
class
Packet;
35
48
class
SimpleChannel
:
public
Channel
49
{
50
public
:
55
static
TypeId
GetTypeId
();
56
SimpleChannel
();
57
70
virtual
void
Send
(
Ptr<Packet>
p,
71
uint16_t protocol,
72
Mac48Address
to,
73
Mac48Address
from,
74
Ptr<SimpleNetDevice>
sender);
75
81
virtual
void
Add
(
Ptr<SimpleNetDevice>
device);
82
90
virtual
void
BlackList
(
Ptr<SimpleNetDevice>
from,
Ptr<SimpleNetDevice>
to);
91
99
virtual
void
UnBlackList
(
Ptr<SimpleNetDevice>
from,
Ptr<SimpleNetDevice>
to);
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
:
106
Time
m_delay
;
107
std::vector<Ptr<SimpleNetDevice>>
m_devices
;
108
std::map<Ptr<SimpleNetDevice>, std::vector<Ptr<SimpleNetDevice>>>
109
m_blackListedDevices
;
110
};
111
112
}
// namespace ns3
113
114
#endif
/* SIMPLE_CHANNEL_H */
ns3::Channel
Abstract Channel Base Class.
Definition:
channel.h:45
ns3::Mac48Address
an EUI-48 address
Definition:
mac48-address.h:46
ns3::Ptr< Packet >
ns3::SimpleChannel
A simple channel, for simple things and testing.
Definition:
simple-channel.h:49
ns3::SimpleChannel::BlackList
virtual void BlackList(Ptr< SimpleNetDevice > from, Ptr< SimpleNetDevice > to)
Blocks the communications from a NetDevice to another NetDevice.
Definition:
simple-channel.cc:113
ns3::SimpleChannel::m_devices
std::vector< Ptr< SimpleNetDevice > > m_devices
devices connected by the channel
Definition:
simple-channel.h:107
ns3::SimpleChannel::GetDevice
Ptr< NetDevice > GetDevice(std::size_t i) const override
Definition:
simple-channel.cc:106
ns3::SimpleChannel::m_blackListedDevices
std::map< Ptr< SimpleNetDevice >, std::vector< Ptr< SimpleNetDevice > > > m_blackListedDevices
devices blocked on a device
Definition:
simple-channel.h:109
ns3::SimpleChannel::GetTypeId
static TypeId GetTypeId()
Get the type ID.
Definition:
simple-channel.cc:38
ns3::SimpleChannel::Add
virtual void Add(Ptr< SimpleNetDevice > device)
Attached a net device to the channel.
Definition:
simple-channel.cc:92
ns3::SimpleChannel::m_delay
Time m_delay
The assigned speed-of-light delay of the channel.
Definition:
simple-channel.h:106
ns3::SimpleChannel::GetNDevices
std::size_t GetNDevices() const override
Definition:
simple-channel.cc:99
ns3::SimpleChannel::SimpleChannel
SimpleChannel()
Definition:
simple-channel.cc:52
ns3::SimpleChannel::UnBlackList
virtual void UnBlackList(Ptr< SimpleNetDevice > from, Ptr< SimpleNetDevice > to)
Un-Blocks the communications from a NetDevice to another NetDevice.
Definition:
simple-channel.cc:130
ns3::SimpleChannel::Send
virtual void Send(Ptr< Packet > p, uint16_t protocol, Mac48Address to, Mac48Address from, Ptr< SimpleNetDevice > sender)
A packet is sent by a net device.
Definition:
simple-channel.cc:58
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition:
nstime.h:105
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:59
mac48-address.h
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
src
network
utils
simple-channel.h
Generated on Sun Mar 3 2024 17:11:06 for ns-3 by
1.9.1