14#include "Application.h"
59_declspec(dllexport)
int fn_NetSim_TrafficGenerator_Custom(APP_DATA_INFO* info,
63 unsigned long* uSeed1,
64 unsigned long* uSeed2,
65 unsigned long* uSeed3)
70 fnDistribution(info->packetSizeDistribution, fSize, uSeed,uSeed1,info->dPacketSize);
71 }
while(*fSize <= 1.0);
75 fnDistribution(info->IATDistribution,&time,uSeed,uSeed1,info->dIAT);
77 *ldArrival = *ldArrival + time;
82int fn_NetSim_Application_StartDataAPP(ptrAPPLICATION_INFO appInfo,
double time)
84 APP_DATA_INFO* info = (APP_DATA_INFO*)appInfo->appData;
86 if (appInfo->dEndTime <= time)
89 NETSIM_ID nSource = appInfo->sourceList[0];
91 NETSIM_ID* nDestination = appInfo->destList;
92 UINT destCount = appInfo->nDestCount;
94 double arrivalTime = 0;
95 double packetSize = 0;
97 fnCreatePort(appInfo);
100 fnCreateSocketBuffer(appInfo);
102 if (appInfo->nTransmissionType == MULTICAST)
104 add_multicast_route(appInfo);
105 join_multicast_group(appInfo, time);
109 fn_NetSim_TrafficGenerator_Custom((APP_DATA_INFO*)appInfo->appData, &packetSize, &arrivalTime,
110 &(NETWORK->ppstruDeviceList[nSource - 1]->ulSeed[0]),
111 &(NETWORK->ppstruDeviceList[nSource - 1]->ulSeed[1]),
112 &(NETWORK->ppstruDeviceList[nSource - 1]->ulSeed[0]),
113 &(NETWORK->ppstruDeviceList[nSource - 1]->ulSeed[1]));
115 if(!appInfo->nPacketId)
119 if (appInfo->dEndTime <= time + arrivalTime)
return 0;
121 pstruEventDetails->dEventTime = time + arrivalTime;
122 pstruEventDetails->dPacketSize = packetSize;
123 pstruEventDetails->nApplicationId = appInfo->id;
124 pstruEventDetails->nDeviceId = nSource;
125 pstruEventDetails->nDeviceType = DEVICE_TYPE(nSource);
126 pstruEventDetails->nEventType = TIMER_EVENT;
127 pstruEventDetails->nInterfaceId = 0;
128 pstruEventDetails->nProtocolId = PROTOCOL_APPLICATION;
129 pstruEventDetails->nSegmentId = 0;
130 pstruEventDetails->nSubEventType = event_APP_START;
131 pstruEventDetails->pPacket =
132 fn_NetSim_Application_GeneratePacket(appInfo,
133 pstruEventDetails->dEventTime,
137 ++appInfo->nPacketId,
142 pstruEventDetails->szOtherDetails = appInfo;
143 pstruEventDetails->nPacketId = appInfo->nPacketId;
144 fnpAddEvent(pstruEventDetails);