Applicable Versions
NetSim Standard
NetSim Pro

 

Applicable Releases
v11
v12
v13

A copy of an exisiting packet can be created using the following API:

fn_NetSim_Packet_CopyPacket(NetSim_PACKET);

For Eg:

NetSim_PACKET* newPacket = fn_NetSim_Packet_CopyPacket(pstruEventDetails->pPacket);


The destination information in the packet can be removed, using the following API:

remove_dest_from_packet(NetSim_PACKET* packet, NETSIM_ID dest);

For Eg:

remove_dest_from_packet(newPacket , 1); //destination device id is 1 in this case.


The new destination information can be added to the packet to using the following API:

add_dest_to_packet(NetSim_PACKET* packet, NETSIM_ID dest);

For Eg: 

add_dest_to_packet(newPacket , nDestinationId);


Further, if the packet has to be sent from the network layer, the Destination IP address and parameters associated with the event details have to be updated and send to the packet by creating a NETWORK_OUT_EVENT.

For example, a new event can be created,

NetSim_EVENTDETAILS newevent;

and the Event details can be updated from the current event details(pstruEventDetails).


Related Articles:

How do I change the payload of a packet in NetSim?

Where exactly in the code is packet encryption done?

How do I provide my own label to a packet that can be seen in the packet trace?