Update README and add contrib dir
This commit is contained in:
67
contrib/tsn/model/stream-identification-function.cc
Normal file
67
contrib/tsn/model/stream-identification-function.cc
Normal file
@@ -0,0 +1,67 @@
|
||||
#include "stream-identification-function.h"
|
||||
|
||||
#include "ns3/log.h"
|
||||
#include "ns3/uinteger.h"
|
||||
#include "ns3/random-variable-stream.h"
|
||||
|
||||
namespace ns3
|
||||
{
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE("StreamIdentificationFunction");
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED(StreamIdentificationFunction);
|
||||
|
||||
TypeId
|
||||
StreamIdentificationFunction::GetTypeId()
|
||||
{
|
||||
static TypeId tid =
|
||||
TypeId("ns3::StreamIdentificationFunction")
|
||||
.SetParent<Object>()
|
||||
.SetGroupName("tsn")
|
||||
.AddConstructor<StreamIdentificationFunction>()
|
||||
.AddAttribute("MinLatencyOverhead",
|
||||
"The minimum latency overhead cause by the identification function hardware implementation",
|
||||
TimeValue(Seconds(0)),
|
||||
MakeTimeAccessor(&StreamIdentificationFunction::m_minLatencyOverhead),
|
||||
MakeTimeChecker())
|
||||
.AddAttribute("MaxLatencyOverhead",
|
||||
"The maximun latency overhead cause by the identification function hardware implementation",
|
||||
TimeValue(Seconds(0)),
|
||||
MakeTimeAccessor(&StreamIdentificationFunction::m_maxLatencyOverhead),
|
||||
MakeTimeChecker());
|
||||
return tid;
|
||||
}
|
||||
|
||||
|
||||
StreamIdentificationFunction::StreamIdentificationFunction()
|
||||
{
|
||||
NS_LOG_FUNCTION(this);
|
||||
}
|
||||
|
||||
StreamIdentificationFunction::~StreamIdentificationFunction()
|
||||
{
|
||||
NS_LOG_FUNCTION(this);
|
||||
}
|
||||
|
||||
bool
|
||||
StreamIdentificationFunction::Match(Ptr<Packet> p)
|
||||
{
|
||||
NS_LOG_FUNCTION(this);
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
StreamIdentificationFunction::GetActiveUpdate(Ptr<Packet> p)
|
||||
{
|
||||
NS_LOG_FUNCTION(this);
|
||||
}
|
||||
|
||||
Time
|
||||
StreamIdentificationFunction::GetHardwareLatency()
|
||||
{
|
||||
NS_LOG_FUNCTION(this);
|
||||
Ptr<UniformRandomVariable> randVar = CreateObject<UniformRandomVariable>();
|
||||
return NanoSeconds(randVar->GetValue(m_minLatencyOverhead.GetNanoSeconds(), m_maxLatencyOverhead.GetNanoSeconds()));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user