A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
error-channel-sixlow.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_SIXLOW_H
21 #define ERROR_CHANNEL_SIXLOW_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 
30 namespace ns3 {
31 
32 class SimpleNetDevice;
33 class Packet;
34 
40 {
41 public:
42  static TypeId GetTypeId (void);
44 
45  virtual void Send (Ptr<Packet> p, uint16_t protocol, Mac48Address to, Mac48Address from,
46  Ptr<SimpleNetDevice> sender);
47 
48  virtual void Add (Ptr<SimpleNetDevice> device);
49 
50  // inherited from ns3::Channel
51  virtual uint32_t GetNDevices (void) const;
52  virtual Ptr<NetDevice> GetDevice (uint32_t i) const;
53 
58  void SetJumpingTime (Time delay);
59 
64  void SetJumpingMode (bool mode);
65 
70  void SetDuplicateTime (Time delay);
71 
76  void SetDuplicateMode (bool mode);
77 
78 private:
79  std::vector<Ptr<SimpleNetDevice> > m_devices;
81  uint8_t m_jumpingState;
82  bool m_jumping;
86 };
87 
89 {
90 public:
91  static TypeId GetTypeId (void);
92 
94  virtual ~BinaryErrorSixlowModel ();
95  void Reset (void);
96 
97 private:
98  virtual bool DoCorrupt (Ptr<Packet> p);
99  virtual void DoReset (void);
100 
101  uint8_t m_counter;
102 
103 };
104 
105 } // namespace ns3
106 
107 #endif /* ERROR_CHANNEL_SIXLOW_H */
virtual uint32_t GetNDevices(void) const
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:79
void SetDuplicateTime(Time delay)
Set the delay for the odd duplicate packets (even ones are not duplicated)
A Error channel, introducing deterministic delays on even/odd packets.
General error model that can be used to corrupt packets.
Definition: error-model.h:115
void SetJumpingMode(bool mode)
Set if the odd packets are delayed (even ones are not delayed ever)
void SetJumpingTime(Time delay)
Set the delay for the odd packets (even ones are not delayed)
virtual void DoReset(void)
Re-initialize any state.
an EUI-48 address
Definition: mac48-address.h:41
virtual void Send(Ptr< Packet > p, uint16_t protocol, Mac48Address to, Mac48Address from, Ptr< SimpleNetDevice > sender)
A packet is sent by a net device.
virtual bool DoCorrupt(Ptr< Packet > p)
Corrupt a packet according to the specified model.
A simple channel, for simple things and testing.
virtual Ptr< NetDevice > GetDevice(uint32_t i) const
static TypeId GetTypeId(void)
void SetDuplicateMode(bool mode)
Set if the odd packets are duplicated (even ones are not duplicated ever)
a unique identifier for an interface.
Definition: type-id.h:49
std::vector< Ptr< SimpleNetDevice > > m_devices
virtual void Add(Ptr< SimpleNetDevice > device)
Attached a net device to the channel.