OLD | NEW |
(Empty) | |
| 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| 2 /* |
| 3 * Copyright (c) 2008 INRIA |
| 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: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
| 19 */ |
| 20 #ifndef ERROR_CHANNEL_H |
| 21 #define ERROR_CHANNEL_H |
| 22 |
| 23 #include "ns3/channel.h" |
| 24 #include "ns3/error-model.h" |
| 25 #include "ns3/mac48-address.h" |
| 26 #include "ns3/nstime.h" |
| 27 #include <vector> |
| 28 |
| 29 namespace ns3 { |
| 30 |
| 31 class ErrorNetDevice; |
| 32 class Packet; |
| 33 |
| 34 /** |
| 35 * \ingroup channel |
| 36 * \brief A Error channel, for Error things and testing |
| 37 */ |
| 38 class ErrorChannel : public Channel |
| 39 { |
| 40 public: |
| 41 static TypeId GetTypeId (void); |
| 42 ErrorChannel (); |
| 43 |
| 44 void Send (Ptr<Packet> p, uint16_t protocol, Mac48Address to, Mac48Address fro
m, |
| 45 Ptr<ErrorNetDevice> sender); |
| 46 |
| 47 void Add (Ptr<ErrorNetDevice> device); |
| 48 |
| 49 // inherited from ns3::Channel |
| 50 virtual uint32_t GetNDevices (void) const; |
| 51 virtual Ptr<NetDevice> GetDevice (uint32_t i) const; |
| 52 |
| 53 void SetJumpingTime(Time delay); |
| 54 void SetJumpingMode(bool mode); |
| 55 |
| 56 private: |
| 57 std::vector<Ptr<ErrorNetDevice> > m_devices; |
| 58 Time jumpingTime; |
| 59 uint8_t jumpingState; |
| 60 bool jumping; |
| 61 |
| 62 }; |
| 63 |
| 64 class BinaryErrorModel : public ErrorModel |
| 65 { |
| 66 public: |
| 67 static TypeId GetTypeId (void); |
| 68 |
| 69 BinaryErrorModel (); |
| 70 virtual ~BinaryErrorModel (); |
| 71 void Reset (void); |
| 72 |
| 73 private: |
| 74 virtual bool DoCorrupt (Ptr<Packet> p); |
| 75 virtual void DoReset (void); |
| 76 |
| 77 uint8_t counter; |
| 78 |
| 79 }; |
| 80 |
| 81 } // namespace ns3 |
| 82 |
| 83 #endif /* ERROR_CHANNEL_H */ |
OLD | NEW |