move receive-list-error-model to src/common/error-model
This commit is contained in:
1 parent
679d30c60d
commit
cdf032d7a9
7 files changed
+110
-187
No files matched your search
@@ -298,5 +298,73 @@ ListErrorModel::DoReset (void)
|
||||
m_packetList.clear();
|
||||
}
|
||||
|
||||
//
|
||||
// ReceiveListErrorModel
|
||||
//
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (ReceiveListErrorModel);
|
||||
|
||||
TypeId ReceiveListErrorModel::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::ReceiveListErrorModel")
|
||||
.SetParent<ErrorModel> ()
|
||||
.AddConstructor<ReceiveListErrorModel> ()
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
|
||||
|
||||
ReceiveListErrorModel::ReceiveListErrorModel () :
|
||||
m_timesInvoked (0)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
}
|
||||
|
||||
ReceiveListErrorModel::~ReceiveListErrorModel ()
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
}
|
||||
|
||||
std::list<uint32_t>
|
||||
ReceiveListErrorModel::GetList (void) const
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
return m_packetList;
|
||||
}
|
||||
|
||||
void
|
||||
ReceiveListErrorModel::SetList (const std::list<uint32_t> &packetlist)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
m_packetList = packetlist;
|
||||
}
|
||||
|
||||
bool
|
||||
ReceiveListErrorModel::DoCorrupt (Ptr<Packet> p)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
if (!IsEnabled ())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
m_timesInvoked += 1;
|
||||
for (PacketListCI i = m_packetList.begin ();
|
||||
i != m_packetList.end (); i++)
|
||||
{
|
||||
if (m_timesInvoked - 1 == *i)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
ReceiveListErrorModel::DoReset (void)
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
m_packetList.clear();
|
||||
}
|
||||
|
||||
|
||||
} //namespace ns3
|
||||
Reference in new issue
Block a user