A Discrete-Event Network Simulator
API
error-channel.h
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2013 Universita' di Firenze, Italy
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 * Author: Tommaso Pecorella <tommaso.pecorella@unifi.it>
19 */
20#ifndef ERROR_CHANNEL_H
21#define ERROR_CHANNEL_H
22
23#include "ns3/channel.h"
24#include "ns3/simple-channel.h"
25#include "ns3/error-model.h"
26#include "ns3/mac48-address.h"
27#include "ns3/nstime.h"
28#include <vector>
29
30namespace ns3 {
31
32class SimpleNetDevice;
33class Packet;
34
40{
41public:
46 static TypeId GetTypeId (void);
47 ErrorChannel ();
48
49 // inherited from ns3::SimpleChannel
50 virtual void Send (Ptr<Packet> p, uint16_t protocol, Mac48Address to, Mac48Address from,
52
53 virtual void Add (Ptr<SimpleNetDevice> device);
54
55 // inherited from ns3::Channel
56 virtual std::size_t GetNDevices (void) const;
57 virtual Ptr<NetDevice> GetDevice (std::size_t i) const;
58
63 void SetJumpingTime (Time delay);
64
69 void SetJumpingMode (bool mode);
70
75 void SetDuplicateTime (Time delay);
76
81 void SetDuplicateMode (bool mode);
82
83private:
84 std::vector<Ptr<SimpleNetDevice> > m_devices;
87 bool m_jumping;
91};
92
93} // namespace ns3
94
95#endif /* ERROR_CHANNEL_H */
A Error channel, introducing deterministic delays on even/odd packets.
Definition: error-channel.h:40
Time m_duplicateTime
Duplicate time in Duplicate mode.
Definition: error-channel.h:88
virtual Ptr< NetDevice > GetDevice(std::size_t i) const
uint8_t m_duplicateState
Counter for even/odd packets in Duplicate mode.
Definition: error-channel.h:90
bool m_jumping
Flag for Jumping mode.
Definition: error-channel.h:87
std::vector< Ptr< SimpleNetDevice > > m_devices
devices connected by the channel
Definition: error-channel.h:84
void SetJumpingTime(Time delay)
Set the delay for the odd packets (even ones are not delayed)
virtual void Send(Ptr< Packet > p, uint16_t protocol, Mac48Address to, Mac48Address from, Ptr< SimpleNetDevice > sender)
A packet is sent by a net device.
void SetJumpingMode(bool mode)
Set if the odd packets are delayed (even ones are not delayed ever)
virtual void Add(Ptr< SimpleNetDevice > device)
Attached a net device to the channel.
void SetDuplicateMode(bool mode)
Set if the odd packets are duplicated (even ones are not duplicated ever)
Time m_jumpingTime
Delay time in Jumping mode.
Definition: error-channel.h:85
void SetDuplicateTime(Time delay)
Set the delay for the odd duplicate packets (even ones are not duplicated)
uint8_t m_jumpingState
Counter for even/odd packets in Jumping mode.
Definition: error-channel.h:86
bool m_duplicate
Flag for Duplicate mode.
Definition: error-channel.h:89
virtual std::size_t GetNDevices(void) const
static TypeId GetTypeId(void)
Get the type ID.
an EUI-48 address
Definition: mac48-address.h:44
A simple channel, for simple things and testing.
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
a unique identifier for an interface.
Definition: type-id.h:59
Every class exported by the ns3 library is enclosed in the ns3 namespace.