network: Fix ListErrorModel since UIDs are uint64_t values
This commit is contained in:
committed by
Stefano Avallone
parent
3261e3b6b7
commit
a14525f632
@@ -158,7 +158,7 @@ main(int argc, char* argv[])
|
||||
|
||||
// Now, let's use the ListErrorModel and explicitly force a loss
|
||||
// of the packets with pkt-uids = 11 and 17 on node 2, device 0
|
||||
std::list<uint32_t> sampleList;
|
||||
std::list<uint64_t> sampleList;
|
||||
sampleList.push_back(11);
|
||||
sampleList.push_back(17);
|
||||
// This time, we'll explicitly create the error model we want
|
||||
|
||||
@@ -445,7 +445,7 @@ ListErrorModel::~ListErrorModel()
|
||||
NS_LOG_FUNCTION(this);
|
||||
}
|
||||
|
||||
std::list<uint32_t>
|
||||
std::list<uint64_t>
|
||||
ListErrorModel::GetList() const
|
||||
{
|
||||
NS_LOG_FUNCTION(this);
|
||||
@@ -453,7 +453,7 @@ ListErrorModel::GetList() const
|
||||
}
|
||||
|
||||
void
|
||||
ListErrorModel::SetList(const std::list<uint32_t>& packetlist)
|
||||
ListErrorModel::SetList(const std::list<uint64_t>& packetlist)
|
||||
{
|
||||
NS_LOG_FUNCTION(this << &packetlist);
|
||||
m_packetList = packetlist;
|
||||
@@ -470,7 +470,7 @@ ListErrorModel::DoCorrupt(Ptr<Packet> p)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
uint32_t uid = p->GetUid();
|
||||
auto uid = p->GetUid();
|
||||
for (PacketListCI i = m_packetList.begin(); i != m_packetList.end(); i++)
|
||||
{
|
||||
if (uid == *i)
|
||||
|
||||
@@ -388,22 +388,22 @@ class ListErrorModel : public ErrorModel
|
||||
/**
|
||||
* \return a copy of the underlying list
|
||||
*/
|
||||
std::list<uint32_t> GetList() const;
|
||||
std::list<uint64_t> GetList() const;
|
||||
/**
|
||||
* \param packetlist The list of packet uids to error.
|
||||
*
|
||||
* This method overwrites any previously provided list.
|
||||
*/
|
||||
void SetList(const std::list<uint32_t>& packetlist);
|
||||
void SetList(const std::list<uint64_t>& packetlist);
|
||||
|
||||
private:
|
||||
bool DoCorrupt(Ptr<Packet> p) override;
|
||||
void DoReset() override;
|
||||
|
||||
/// Typedef: packet Uid list
|
||||
typedef std::list<uint32_t> PacketList;
|
||||
typedef std::list<uint64_t> PacketList;
|
||||
/// Typedef: packet Uid list const iterator
|
||||
typedef std::list<uint32_t>::const_iterator PacketListCI;
|
||||
typedef std::list<uint64_t>::const_iterator PacketListCI;
|
||||
|
||||
PacketList m_packetList; //!< container of Uid of packets to corrupt
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user