#include "stream-identification-function-null.h" #include "ns3/log.h" #include "ns3/uinteger.h" #include "ns3/mac48-address.h" #include "ns3/packet.h" #include "stream-identification-function.h" #include "ns3/ethernet-header2.h" namespace ns3 { NS_LOG_COMPONENT_DEFINE("NullStreamIdentificationFunction"); NS_OBJECT_ENSURE_REGISTERED(NullStreamIdentificationFunction); TypeId NullStreamIdentificationFunction::GetTypeId() { static TypeId tid = TypeId("ns3::NullStreamIdentificationFunction") .SetParent() .SetGroupName("tsn") .AddConstructor() .AddAttribute("Address", "Destination Mac Address", AddressValue(Mac48Address("ff:ff:ff:ff:ff:ff")), MakeAddressAccessor(&NullStreamIdentificationFunction::m_destAddress), MakeAddressChecker()) .AddAttribute("VlanID", "Vlan ID", UintegerValue(0), MakeUintegerAccessor(&NullStreamIdentificationFunction::m_vid), MakeUintegerChecker()); return tid; } NullStreamIdentificationFunction::NullStreamIdentificationFunction() { NS_LOG_FUNCTION(this); } NullStreamIdentificationFunction::~NullStreamIdentificationFunction() { NS_LOG_FUNCTION(this); } bool NullStreamIdentificationFunction::Match(Ptr p) { NS_LOG_FUNCTION(this); Ptr pcopy = p->Copy(); EthernetHeader2 header; pcopy->RemoveHeader(header); if(m_destAddress==header.GetDest() && m_vid==header.GetVid()) { return true; } return false; } void NullStreamIdentificationFunction::GetActiveUpdate(Ptr p) { NS_LOG_FUNCTION(this); //Do nothing because passive function } }