Determine which packets are errored corresponding to an underlying distribution, rate, and unit. More...
#include <error-model.h>
Public Member Functions | |
RateErrorModel () | |
virtual | ~RateErrorModel () |
enum ErrorUnit | GetUnit (void) const |
void | SetUnit (enum ErrorUnit error_unit) |
double | GetRate (void) const |
void | SetRate (double rate) |
void | SetRandomVariable (const RandomVariable &ranvar) |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
This method returns the TypeId associated to ns3::RateErrorModel. | |
Private Member Functions | |
virtual bool | DoCorrupt (Ptr< Packet > p) |
virtual bool | DoCorruptPkt (Ptr< Packet > p) |
virtual bool | DoCorruptByte (Ptr< Packet > p) |
virtual bool | DoCorruptBit (Ptr< Packet > p) |
virtual void | DoReset (void) |
Private Attributes | |
enum ErrorUnit | m_unit |
double | m_rate |
RandomVariable | m_ranvar |
Determine which packets are errored corresponding to an underlying distribution, rate, and unit.
This object is used to flag packets as being lost/errored or not. The two parameters that govern the behavior are the rate (or equivalently, the mean duration/spacing between errors), and the unit (which may be per-bit, per-byte, and per-packet). Users can optionally provide a RandomVariable object; the default is to use a Uniform(0,1) distribution.
Reset() on this model will do nothing
IsCorrupt() will not modify the packet data buffer
Definition at line 133 of file error-model.h.
ns3::RateErrorModel::RateErrorModel | ( | ) |
Definition at line 132 of file error-model.cc.
References NS_LOG_FUNCTION_NOARGS.
ns3::RateErrorModel::~RateErrorModel | ( | ) | [virtual] |
Definition at line 137 of file error-model.cc.
References NS_LOG_FUNCTION_NOARGS.
Implements ns3::ErrorModel.
Definition at line 178 of file error-model.cc.
References DoCorruptBit(), DoCorruptByte(), DoCorruptPkt(), ns3::EU_BIT, ns3::EU_BYTE, ns3::EU_PKT, ns3::ErrorModel::IsEnabled(), m_unit, NS_ASSERT_MSG, and NS_LOG_FUNCTION_NOARGS.
Definition at line 217 of file error-model.cc.
References ns3::RandomVariable::GetValue(), m_ranvar, m_rate, and NS_LOG_FUNCTION_NOARGS.
Referenced by DoCorrupt().
Definition at line 208 of file error-model.cc.
References ns3::RandomVariable::GetValue(), m_ranvar, m_rate, and NS_LOG_FUNCTION_NOARGS.
Referenced by DoCorrupt().
Definition at line 201 of file error-model.cc.
References ns3::RandomVariable::GetValue(), m_ranvar, m_rate, and NS_LOG_FUNCTION_NOARGS.
Referenced by DoCorrupt().
void ns3::RateErrorModel::DoReset | ( | void | ) | [private, virtual] |
Implements ns3::ErrorModel.
Definition at line 226 of file error-model.cc.
References NS_LOG_FUNCTION_NOARGS.
double ns3::RateErrorModel::GetRate | ( | void | ) | const |
Definition at line 157 of file error-model.cc.
References m_rate, and NS_LOG_FUNCTION_NOARGS.
TypeId ns3::RateErrorModel::GetTypeId | ( | void | ) | [static] |
This method returns the TypeId associated to ns3::RateErrorModel.
This object is accessible through the following paths with Config::Set and Config::Connect:
Attributes defined for this type:
Attributes defined in parent class ns3::ErrorModel:
No TraceSources defined for this type.
Reimplemented from ns3::ErrorModel.
Definition at line 108 of file error-model.cc.
References ns3::TypeId::AddAttribute(), ns3::EU_BIT, ns3::EU_BYTE, ns3::EU_PKT, m_ranvar, m_rate, m_unit, ns3::MakeEnumAccessor(), ns3::MakeEnumChecker(), and ns3::TypeId::SetParent().
enum ErrorUnit ns3::RateErrorModel::GetUnit | ( | void | ) | const |
Definition at line 143 of file error-model.cc.
References m_unit, and NS_LOG_FUNCTION_NOARGS.
void ns3::RateErrorModel::SetRandomVariable | ( | const RandomVariable & | ranvar | ) |
ranvar | A random variable distribution to generate random variates |
Definition at line 171 of file error-model.cc.
References m_ranvar, and NS_LOG_FUNCTION_NOARGS.
void ns3::RateErrorModel::SetRate | ( | double | rate | ) |
rate | the error rate to be used by the model |
Definition at line 164 of file error-model.cc.
References m_rate, and NS_LOG_FUNCTION_NOARGS.
void ns3::RateErrorModel::SetUnit | ( | enum ErrorUnit | error_unit | ) |
error_unit | the ErrorUnit to be used by the underlying model |
Definition at line 150 of file error-model.cc.
References m_unit, and NS_LOG_FUNCTION_NOARGS.
RandomVariable ns3::RateErrorModel::m_ranvar [private] |
Definition at line 174 of file error-model.h.
Referenced by DoCorruptBit(), DoCorruptByte(), DoCorruptPkt(), GetTypeId(), and SetRandomVariable().
double ns3::RateErrorModel::m_rate [private] |
Definition at line 172 of file error-model.h.
Referenced by DoCorruptBit(), DoCorruptByte(), DoCorruptPkt(), GetRate(), GetTypeId(), and SetRate().
enum ErrorUnit ns3::RateErrorModel::m_unit [private] |
Definition at line 171 of file error-model.h.
Referenced by DoCorrupt(), GetTypeId(), GetUnit(), and SetUnit().