#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() .SetGroupName("tsn") .AddConstructor() .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 p) { NS_LOG_FUNCTION(this); return false; } void StreamIdentificationFunction::GetActiveUpdate(Ptr p) { NS_LOG_FUNCTION(this); } Time StreamIdentificationFunction::GetHardwareLatency() { NS_LOG_FUNCTION(this); Ptr randVar = CreateObject(); return NanoSeconds(randVar->GetValue(m_minLatencyOverhead.GetNanoSeconds(), m_maxLatencyOverhead.GetNanoSeconds())); } }