** I need to do a simple senario between an attacker (ip spoofer) and a victim. Which application can i use?? Does GridPositionAllocator helpful to do that??
** I have to add some IP traceback function to router nodes. How can i get those nodes (intermidiates nodes, nexthop)??
** In the router node, i have to change IPv4Header fields: type of service+
fragment ID+ unused flag+ fragment offset.
I found this function which permits to have a specific field in the header:
MeshTest::GetPacketSource(Ptr<Packet> packet)
{
Ipv4Address src_ip;
//The following code is based from
// To get a header from Ptr<Packet> packet first, copy the packet
Ptr<Packet> q = packet->Copy();
// Use indicator to search the packet
PacketMetadata::ItemIterator metadataIterator = q->BeginItem();
PacketMetadata::Item item;
while (metadataIterator.HasNext())
{
item = metadataIterator.Next();
//NS_LOG_FUNCTION("item name: " << item.tid.GetName());
// If we want to have an ip header
if(item.tid.GetName() == "ns3::Ipv4Header")
{
Callback<ObjectBase *> constr = item.tid.GetConstructor();
NS_ASSERT(!constr.IsNull());
// Ptr<> and DynamicCast<> won't work here as all headers are from ObjectBase, not Object
ObjectBase *instance = constr();
NS_ASSERT(instance != 0);
Ipv4Header* ipv4Header = dynamic_cast<Ipv4Header*> (instance);
NS_ASSERT(ipv4Header != 0);
ipv4Header->Deserialize(item.current);
// The ipv4Header can now obtain the source of the packet
src_ip = ipv4Header->GetSource();
// Finished, clear the ip header and go back
delete ipv4Header;
break;
}
}
but how can i get specially the three fragments in IPv4Header???
Thanks in advance sir. You are very helpful and gentil.