The Application project contains an Application.c file where,

  • fn_NetSim_Application_Run() - In case APPLICATION_OUT_EVENT a call to the function handle_app_out() is made in which a further call to function fn_NetSim_Add_DummyPayload() is made. 
  • fn_NetSim_Add_DummyPayload() - from this function a call to a function copy_payload() is made. 
  • copy_payload() - This is the function where data is added to the variable packet->szPayload->packet 
  • In the same function, the data is encrypted if encryption is enabled in the application configuration.

Additional Reference:


Refer to Section 9.3 of the NetSim User Manual for help on how to debug NetSim source codes.


Refer to our knowledge base article on "How do I change the payload of a packet in NetSim?" at How do I change the payload of a packet in NetSim?


Refer to our file exchange example on "Adding your own encryption" at https://tetcos.com/pdf/v12.1/MISTY_ENCRYPTION_v12.1.pdf 


As you would notice in the above MYSTY project calls are made to perform encryption from the copy_payload() function that is part of the Application.c file.


In a similar way, users could add a new c file to the application project which contains code for your encryption algorithm. Then make calls to your algorithm from the copy_payload() function. 


For your algorithm


1. Identify the input format of your algorithm. That is, the data type of plain text that it takes as input.

2. Modify the packet payload in NetSim as per the input format of your algorithm.

3. After your algorithm encrypts the payload, update the NetSim payload string accordingly after taking care of any type of conversions if required.


In Mysty algorithm implementation, you will see a misty_run.c file which takes care of these steps.