Update README and add contrib dir
This commit is contained in:
76
contrib/tsn/model/stream-identification-function-null.cc
Normal file
76
contrib/tsn/model/stream-identification-function-null.cc
Normal file
@@ -0,0 +1,76 @@
|
||||
#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<StreamIdentificationFunction>()
|
||||
.SetGroupName("tsn")
|
||||
.AddConstructor<NullStreamIdentificationFunction>()
|
||||
.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<uint16_t>());
|
||||
return tid;
|
||||
}
|
||||
|
||||
|
||||
NullStreamIdentificationFunction::NullStreamIdentificationFunction()
|
||||
{
|
||||
NS_LOG_FUNCTION(this);
|
||||
}
|
||||
|
||||
NullStreamIdentificationFunction::~NullStreamIdentificationFunction()
|
||||
{
|
||||
NS_LOG_FUNCTION(this);
|
||||
}
|
||||
|
||||
bool
|
||||
NullStreamIdentificationFunction::Match(Ptr<Packet> p)
|
||||
{
|
||||
NS_LOG_FUNCTION(this);
|
||||
|
||||
Ptr<Packet> 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<Packet> p)
|
||||
{
|
||||
NS_LOG_FUNCTION(this);
|
||||
//Do nothing because passive function
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user