There are two packet buffers for regular nodes in NetSim. These are


a. Socket buffer between the application and transport layers


b. Access buffer between the MAC and PHY layer in NetSim


Accessing the device buffers:


To access the access buffer of a device the following API can be used: 


DEVICE_ACCESSBUFFER(pstruEventDetails->nDeviceId,pstruEventDetails->nInterfaceId)


The parameters expected are the Device Id and the Interface Id of the Node whose buffer needs to be accessed.


To access the socket buffer of a device the following API can be used:


DEVICE_SOCKETINTERFACE(pstruEventDetails->nDeviceId)->pstruSocketBuffer[nSocketId]


The parameter expected are the Device Id and the Socket Id of the Node whose buffer needs to be accessed.


For example,


NetSim_BUFFER* Buffer = DEVICE_ACCESSBUFFER(pstruEventDetails->nDeviceId,pstruEventDetails->nInterfaceId);

NetSim_BUFFER* Buffer = DEVICE_SOCKETINTERFACE(pstruEventDetails->nDeviceId)->pstruSocketBuffer[nSocketId];