NetSim Source Code Help
Loading...
Searching...
No Matches
Application.c
Go to the documentation of this file.
1/************************************************************************************
2* Copyright (C) 2021 *
3* TETCOS, Bangalore. India *
4* *
5* Tetcos owns the intellectual property rights in the Product and its content. *
6* The copying, redistribution, reselling or publication of any or all of the *
7* Product or its content without express prior written consent of Tetcos is *
8* prohibited. Ownership and / or any other right relating to the software and all *
9* intellectual property rights therein shall remain at all times with Tetcos. *
10* *
11* This source code is licensed per the NetSim license agreement. *
12* *
13* No portion of this source code may be used as the basis for a derivative work, *
14* or used, for any purpose other than its intended use per the NetSim license *
15* agreement. *
16* *
17* This source code and the algorithms contained within it are confidential trade *
18* secrets of TETCOS and may not be used as the basis for any other software, *
19* hardware, product or service. *
20* *
21* Author: Shashi Kant Suman *
22* *
23* ----------------------------------------------------------------------------------*/
24#include "main.h"
25#include "Application.h"
26#include "CoAP.h"
27
28void encryptBlock(uint8_t* data, uint32_t* len, uint32_t* key);
29
30/**
31This function is used to initialize the parameter for all the application based on
32the traffic type
33*/
34_declspec(dllexport) int fn_NetSim_Application_Init(struct stru_NetSim_Network *NETWORK_Formal,
38 int nVersion_Type,
39 void **fnPointer)
40{
42}
43
44/** This function is used to configure the applications like application id, source count, source id, destination count etc. */
46{
48}
49
50/**
51This function is called by NetworkStack.dll, whenever the event gets triggered
52inside the NetworkStack.dll for applications. This is the main function for the application.
53It processes APPLICATION_OUT, APPLICATION_IN and TIMER events.
54 */
56{
58 {
61 break;
63 {
65 if(pstruPacket->nPacketType != PacketType_Control && pstruPacket->pstruAppData->nApplicationId &&
66 pstruPacket->nControlDataType/100 != PROTOCOL_APPLICATION)
67 {
68 ptrAPPLICATION_INFO pstruappinfo;
69 fnValidatePacket(pstruPacket);
70 pstruappinfo=applicationInfo[pstruPacket->pstruAppData->nApplicationId-1];
72 fn_NetSim_Application_Plot(pstruPacket);
73 appmetrics_dest_add(pstruappinfo, pstruPacket, pstruEventDetails->nDeviceId);
74 if(pstruappinfo->nAppType==TRAFFIC_PEER_TO_PEER && pstruPacket->pstruAppData->nAppEndFlag==1)
75 {
76 fn_NetSim_Application_P2P_MarkReceivedPacket(pstruappinfo,pstruPacket);
78 }
79 if(pstruappinfo->nAppType == TRAFFIC_EMULATION && pstruPacket->szPayload)
80 {
82 }
83 if (pstruappinfo->nAppType == TRAFFIC_BSM_APP)
84 {
85 process_saej2735_packet(pstruPacket);
86 }
87 //Delete the packet
88 fn_NetSim_Packet_FreePacket(pstruPacket);
89 }
90 // Here which type is placed is only getting processed next one is not getting processed
91 else if (pstruPacket->nControlDataType == packet_COAP_REQUEST)
92 {
93 ptrAPPLICATION_INFO pstruappinfo;
94 fnValidatePacket(pstruPacket);
95 pstruappinfo = applicationInfo[pstruPacket->pstruAppData->nApplicationId - 1];
97 //On receiving COAP Packet
98 appmetrics_dest_add(pstruappinfo, pstruPacket, pstruEventDetails->nDeviceId);
99 fn_NetSim_Application_Plot(pstruPacket);
100 fn_NetSim_Application_COAP_AppIn(pstruappinfo, pstruPacket);
101 //Delete the packet
102 fn_NetSim_Packet_FreePacket(pstruPacket);
103
104 }
105 else if(pstruPacket->nControlDataType == packet_HTTP_REQUEST)
106 {
107 ptrAPPLICATION_INFO pstruappinfo;
108 fnValidatePacket(pstruPacket);
109 pstruappinfo=applicationInfo[pstruPacket->pstruAppData->nApplicationId-1];
111 appmetrics_dest_add(pstruappinfo, pstruPacket, pstruEventDetails->nDeviceId);
112 fn_NetSim_Application_HTTP_ProcessRequest(pstruappinfo,pstruPacket);
113 }
114 }
115 break;
116 case TIMER_EVENT:
117 {
119 {
120 case event_APP_START:
121 //fn_NetSim_Call_LowerLayer(); //Not implemented now
123 {
124 case TRAFFIC_DATABASE:
125 case TRAFFIC_FTP:
126 case TRAFFIC_CUSTOM:
127 case TRAFFIC_DATA:
128 case TRAFFIC_VOICE:
129 case TRAFFIC_VIDEO:
130 case TRAFFIC_HTTP:
131 case TRAFFIC_EMAIL:
132 case TRAFFIC_CBR:
133 case TRAFFIC_SENSING:
134 case TRAFFIC_BSM_APP:
138 break;
139 case TRAFFIC_COAP:
140 {
141
143 APP_COAP_INFO* info = appInfo->appData;
144
147 /* modified code starts*/
148 if (info->pCOAPData->_RETRANSMIT < info->maxRetransmit && info->pCOAPData->Response_Received == 0) {
149
151 info->pCOAPData->Response_Received = 0;
152 info->pCOAPData->RequestACK_Received = 0;
153 double temp = pstruEventDetails->dEventTime - (int)info->pageIAT + info->ackTimeOut*MILLISECOND;
155 info->pCOAPData->_RETRANSMIT += 1;
156
157
158 }
159 else {
160 info->pCOAPData->_RETRANSMIT = 1;
161 info->pCOAPData->Response_Received = 0;
162
163
164 }
165
167 }
168 break;
170 {
177 }
178 break;
179
180 default:
181 fnNetSimError("Unknown application type %d in application_run.\n",pstruEventDetails->pPacket->pstruAppData->nAppType);
182 break;
183 }
184 break;
187 break;
188 case event_APP_END:
190 {
193 break;
194 }
195 break;
196 }
197 }
198 break;
199 default:
200 fnNetSimError("Unknown event type for Application");
201 break;
202 }
203 return 1;
204}
205/**
206This function is called by NetworkStack.dll, while writing the event trace
207to get the sub event as a string.
208*/
209_declspec (dllexport) char *fn_NetSim_Application_Trace(int nSubEvent)
210{
211 switch (nSubEvent)
212 {
213 case event_APP_START:
214 return "APP_START";
216 return "APP_RESTART";
217 case event_APP_END:
218 return "APP_END";
219 default:
220 return "APP_UNKNOWN_SUBEVENT";
221 }
222}
223/**
224This function is called by NetworkStack.dll, to free the application information from a packets.
225*/
227{
228 return 1;
229}
230/**
231This function is called by NetworkStack.dll, to copy the application
232related information to a new packet
233*/
234_declspec(dllexport) int fn_NetSim_Application_CopyPacket(NetSim_PACKET* pstruDestPacket,NetSim_PACKET* pstruSrcPacket)
235{
236 return 1;
237}
238/**
239This function writes the Application metrics in Metrics.txt
240*/
242{
243 return fn_NetSim_Application_Metrics_F(metricsWriter);
244}
245
246/**
247This function is used to configure the packet trace
248*/
250{
251 return "";
252}
253/**
254This function is used to write the packet trace
255*/
256_declspec(dllexport) int fn_NetSim_Application_WritePacketTrace(NetSim_PACKET* pstruPacket, char** ppszTrace)
257{
258 return 1;
259}
260/**
261 This function is called by NetworkStack.dll, once simulation ends, to free the
262 allocated memory.
263*/
265{
266 unsigned int loop;
267 for(loop=0;loop<nApplicationCount;loop++)
268 {
269 free(applicationInfo[loop]->sourceList);
270 free(applicationInfo[loop]->destList);
271 if (applicationInfo[loop]->nAppType == TRAFFIC_VIDEO)
272 {
274 free(info->dPacketSizeArgs);
275 }
276 free((char*)(applicationInfo[loop]->appData));
278
279 while(applicationInfo[loop]->socketInfo)
280 LIST_FREE((void**)&applicationInfo[loop]->socketInfo, applicationInfo[loop]->socketInfo);
281 free(applicationInfo[loop]);
282 }
283
285 return 1;
286}
287
289{
290 switch (qos)
291 {
292 case QOS_UGS:
293 //case QOS_GBR:
294 return Priority_High;
295 case QOS_rtPS:
296 return Priority_Medium;
297 case QOS_ertPS:
298 return Priority_Normal;
299 case QOS_nrtPS:
300 return Priority_Low;
301 case QOS_BE:
302 //case QOS_NONGBR:
303 return Priority_Low;
304 default:
305 return Priority_Low;
306 }
307}
308/**
309This function is used to generate the packets for application
310*/
312 double ldArrivalTime,
313 NETSIM_ID nSourceId,
314 UINT destCount,
315 NETSIM_ID* nDestination,
316 unsigned long long int nPacketId,
317 APPLICATION_TYPE nAppType,
319 unsigned int sourcePort,
320 unsigned int destPort)
321{
322 NetSim_PACKET* pstruPacket;
323 pstruPacket = fn_NetSim_Packet_CreatePacket(5);
324 pstruPacket->dEventTime = ldArrivalTime;
325
326 add_destlist_to_packet(pstruPacket, nDestination, destCount);
327
328 pstruPacket->nPacketId = nPacketId;
329 pstruPacket->nPacketStatus = PacketStatus_NoError;
331 pstruPacket->pstruAppData->nAppType = nAppType;
332 pstruPacket->nPacketPriority = get_priority_based_on_qos(nQOS);
333 pstruPacket->nQOS = nQOS;
334 pstruPacket->nSourceId = nSourceId;
335 pstruPacket->pstruTransportData->nSourcePort = sourcePort;
336 pstruPacket->pstruTransportData->nDestinationPort = destPort;
338
340 {
341 //Add the source ip address
343 //Add the destination IP address
344
345 if (info->nTransmissionType == MULTICAST)
346 {
347 //Multicast
348 pstruPacket->pstruNetworkData->szDestIP = IP_COPY(info->multicastDestIP);
349 }
350 else if (info->nTransmissionType == UNICAST)
351 {
352 //UNICAST
353 pstruPacket->pstruNetworkData->szDestIP = IP_COPY(DNS_QUERY(nSourceId, nDestination[0]));
354 }
355 else if (info->nTransmissionType == BROADCAST)
356 {
357 //BROADCAST
359 if (ip->type == 4)
360 pstruPacket->pstruNetworkData->szDestIP = STR_TO_IP("255.255.255.255", 4);
361 else
362 pstruPacket->pstruNetworkData->szDestIP = STR_TO_IP("FF00:0:0:0:0:0:0:0", 6);
363 }
364 else
365 {
366 fnNetSimError("Unknown transmission type %d\n", info->nTransmissionType);
367 }
368 }
369 //Set TTL value
370 pstruPacket->pstruNetworkData->nTTL = MAX_TTL;
371 return pstruPacket;
372}
373
374/**
375This function is used to generate the next packet
376*/
378 NETSIM_ID nSource,
379 UINT destCount,
380 NETSIM_ID* nDestination,
381 double time)
382{
383 if (appInfo->dEndTime <= time)
384 return 0;
385
386 if (appInfo->nAppState != appState_Started)
387 return 0;
388
389 switch (appInfo->nAppType)
390 {
391 case TRAFFIC_FTP:
392 case TRAFFIC_CUSTOM:
393 case TRAFFIC_DATA:
394 case TRAFFIC_CBR:
395 case TRAFFIC_SENSING:
396 {
397 double arrivalTime = 0;
398 double packetSize = 0;
400 &packetSize,
401 &arrivalTime,
402 &(NETWORK->ppstruDeviceList[nSource - 1]->ulSeed[0]),
403 &(NETWORK->ppstruDeviceList[nSource - 1]->ulSeed[1]),
404 &(NETWORK->ppstruDeviceList[nSource - 1]->ulSeed[0]),
405 &(NETWORK->ppstruDeviceList[nSource - 1]->ulSeed[1]));
406
407 if (appInfo->dEndTime <= time + arrivalTime)
408 return 0;
409
410 pstruEventDetails->dEventTime = time + arrivalTime;
411 pstruEventDetails->dPacketSize = (double)((int)packetSize);
413 pstruEventDetails->nDeviceId = nSource;
423 nSource,
424 destCount,
425 nDestination,
426 ++appInfo->nPacketId,
427 appInfo->nAppType,
428 appInfo->qos,
429 appInfo->sourcePort,
430 appInfo->destPort);
434 }
435 break;
436 case TRAFFIC_DATABASE:
437 break;
438 case TRAFFIC_HTTP:
439 break;
440 case TRAFFIC_VIDEO:
441 {
442 double arrivalTime = 0;
443 double packetSize = 0;
445 &packetSize,
446 &arrivalTime,
447 &(NETWORK->ppstruDeviceList[nSource - 1]->ulSeed[0]),
448 &(NETWORK->ppstruDeviceList[nSource - 1]->ulSeed[1]));
449 if (appInfo->dEndTime <= time + arrivalTime)
450 return 0;
451
452 pstruEventDetails->dEventTime = time + arrivalTime;
453 pstruEventDetails->dPacketSize = (double)((int)packetSize);
455 pstruEventDetails->nDeviceId = nSource;
465 nSource,
466 destCount,
467 nDestination,
468 ++appInfo->nPacketId,
469 appInfo->nAppType,
470 appInfo->qos,
471 appInfo->sourcePort,
472 appInfo->destPort);
476 }
477 break;
478 case TRAFFIC_VOICE:
479 {
480 double arrivalTime = 0;
481 double packetSize = 0;
483 &packetSize,
484 &arrivalTime,
485 &(NETWORK->ppstruDeviceList[nSource - 1]->ulSeed[0]),
486 &(NETWORK->ppstruDeviceList[nSource - 1]->ulSeed[1]));
487
488 if (appInfo->dEndTime <= time + arrivalTime)
489 return 0;
490
491 pstruEventDetails->dEventTime = time + arrivalTime;
492 pstruEventDetails->dPacketSize = (double)((int)packetSize);
494 pstruEventDetails->nDeviceId = nSource;
504 nSource,
505 destCount,
506 nDestination,
507 ++appInfo->nPacketId,
508 appInfo->nAppType,
509 appInfo->qos,
510 appInfo->sourcePort,
511 appInfo->destPort);
515 }
516 break;
518 {
519 APP_CALL_INFO* info = (APP_CALL_INFO*)appInfo->appData;
520 NetSim_PACKET* packet = info->nextPacket[nSource - 1][nDestination[0] - 1];
521 double arrivalTime = 0;
522 double packetSize = 0;
523 if (info->nCallStatus[nSource - 1][nDestination[0] - 1] == 0 || packet == NULL)
524 return 0; //Call is ended
525 pstruEventDetails->dEventTime = packet->dEventTime;
528 pstruEventDetails->nDeviceId = nSource;
535 pstruEventDetails->pPacket = packet;
536 pstruEventDetails->nPacketId = packet->nPacketId;
538 if (info->nAppoutevent == NULL)
539 {
540 NETSIM_ID i;
541 info->nAppoutevent = (unsigned long long**)calloc(NETWORK->nDeviceCount, sizeof* info->nAppoutevent);
542 for (i = 0; i < NETWORK->nDeviceCount; i++)
543 info->nAppoutevent[i] = (unsigned long long*)calloc(NETWORK->nDeviceCount, sizeof* info->nAppoutevent[i]);
544 }
545 info->nAppoutevent[nSource - 1][nDestination[0] - 1] = fnpAddEvent(pstruEventDetails);
546 //Generate next packet
547 fn_NetSim_TrafficGenerator_Voice(&(info->VoiceInfo), &packetSize, &arrivalTime,
548 &(NETWORK->ppstruDeviceList[nSource - 1]->ulSeed[0]),
549 &(NETWORK->ppstruDeviceList[nSource - 1]->ulSeed[1]));
550 if (info->dCallEndTime[nSource - 1][nDestination[0] - 1] <= time + arrivalTime)
551 {
552 info->nextPacket[nSource - 1][nDestination[0] - 1] = NULL;
553 packet->pstruAppData->nAppEndFlag = 1;//last packet
554 return 0;
555 }
556 info->nextPacket[nSource - 1][nDestination[0] - 1] =
558 pstruEventDetails->dEventTime + arrivalTime,
559 nSource,
560 destCount,
561 nDestination,
562 ++appInfo->nPacketId,
563 appInfo->nAppType,
564 appInfo->qos,
565 appInfo->sourcePort,
566 appInfo->destPort);
567 info->nextPacket[nSource - 1][nDestination[0] - 1]->pstruAppData->dPacketSize = packetSize;
568 info->nextPacket[nSource - 1][nDestination[0] - 1]->pstruAppData->dPayload = packetSize;
569 }
570 break;
571 case TRAFFIC_BSM_APP:
572 {
573 double arrivalTime = 0;
574 double packetSize = 0;
576 &packetSize,
577 &arrivalTime,
578 &(NETWORK->ppstruDeviceList[nSource - 1]->ulSeed[0]),
579 &(NETWORK->ppstruDeviceList[nSource - 1]->ulSeed[1]),
580 &(NETWORK->ppstruDeviceList[nSource - 1]->ulSeed[0]),
581 &(NETWORK->ppstruDeviceList[nSource - 1]->ulSeed[1]));
582
583 if (appInfo->dEndTime <= time + arrivalTime)
584 return 0;
585
586 pstruEventDetails->dEventTime = time + arrivalTime;
587 pstruEventDetails->dPacketSize = (double)((int)packetSize);
589 pstruEventDetails->nDeviceId = nSource;
599 nSource,
600 destCount,
601 nDestination,
602 ++appInfo->nPacketId,
603 appInfo->nAppType,
604 appInfo->qos,
605 appInfo->sourcePort,
606 appInfo->destPort);
610 }
611 break;
612 default:
613 fnNetSimError("Unknown application type %d in Generate_next_packet.\n", appInfo->nAppType);
614 break;
615 }
616 return 1;
617}
618
619void copy_payload(UINT8 real[],NetSim_PACKET* packet,unsigned int* payload, ptrAPPLICATION_INFO info)
620{
621 u_short i;
622 uint32_t key = 16;
623 if (payload)
624 {
625 for (i = 0; i < *payload; i++)
626 {
627 if (info->encryption == Encryption_XOR)
628 real[i] = xor_encrypt('a' + i % 26, 16);
629 else
630 real[i] = 'a' + i % 26;
631 }
632 if (info->encryption == Encryption_TEA)
633 encryptBlock(real, payload, &key);
634 else if (info->encryption == Encryption_AES)
635 aes256(real,payload);
636 else if(info->encryption==Encryption_DES)
637 des(real,payload);
638 }
639}
640
642{
643 if (add_sae_j2735_payload(packet,info))
644 return 0; // Payload added by SAE J2735 Module
645
646 while(packet)
647 {
648 if(!packet->szPayload &&
649 packet->pstruAppData &&
650 packet->pstruAppData->dPacketSize &&
651 packet->pstruAppData->nAppType != TRAFFIC_EMULATION /* Don't set payload in emulation */ &&
653 {
654 unsigned int size=(unsigned int)packet->pstruAppData->dPacketSize;
655 packet->szPayload = (PPACKET_INFO)calloc(1,sizeof* packet->szPayload);
656 copy_payload(packet->szPayload->packet,packet,&size,info);
657 packet->szPayload->packet_len = size;
658 packet->pstruAppData->dPacketSize = (double)size;
659 }
660 packet=packet->pstruNextPacket;
661 }
662 return 0;
663}
664
666{
668}
void handle_app_out()
Definition: APP_OUT.c:170
unsigned int NETSIM_ID
Definition: Animation.h:45
int fn_NetSim_Application_GenerateNextPacket(ptrAPPLICATION_INFO appInfo, NETSIM_ID nSource, UINT destCount, NETSIM_ID *nDestination, double time)
Definition: Application.c:377
static PACKET_PRIORITY get_priority_based_on_qos(QUALITY_OF_SERVICE qos)
Definition: Application.c:288
void copy_payload(UINT8 real[], NetSim_PACKET *packet, unsigned int *payload, ptrAPPLICATION_INFO info)
Definition: Application.c:619
int fn_NetSim_Application_Configure(void **var)
Definition: Application.c:45
NetSim_PACKET * fn_NetSim_Application_GeneratePacket(ptrAPPLICATION_INFO info, double ldArrivalTime, NETSIM_ID nSourceId, UINT destCount, NETSIM_ID *nDestination, unsigned long long int nPacketId, APPLICATION_TYPE nAppType, QUALITY_OF_SERVICE nQOS, unsigned int sourcePort, unsigned int destPort)
Definition: Application.c:311
char * fn_NetSim_Application_Trace(int nSubEvent)
Definition: Application.c:209
int fn_NetSim_Application_CopyPacket(NetSim_PACKET *pstruDestPacket, NetSim_PACKET *pstruSrcPacket)
Definition: Application.c:234
int fn_NetSim_Application_FreePacket(NetSim_PACKET *pstruPacket)
Definition: Application.c:226
int fn_NetSim_Application_Finish()
Definition: Application.c:264
int fn_NetSim_Add_DummyPayload(NetSim_PACKET *packet, ptrAPPLICATION_INFO info)
Definition: Application.c:641
char * fn_NetSim_Application_ConfigPacketTrace()
Definition: Application.c:249
int fn_NetSim_Application_Run()
Definition: Application.c:55
int fn_NetSim_Application_WritePacketTrace(NetSim_PACKET *pstruPacket, char **ppszTrace)
Definition: Application.c:256
double get_random_startupdelay()
Definition: Application.c:665
int fn_NetSim_Application_Metrics(PMETRICSWRITER metricsWriter)
Definition: Application.c:241
void encryptBlock(uint8_t *data, uint32_t *len, uint32_t *key)
Definition: Encryption.c:47
int fn_NetSim_Application_Init(struct stru_NetSim_Network *NETWORK_Formal, NetSim_EVENTDETAILS *pstruEventDetails_Formal, char *pszAppPath_Formal, char *pszWritePath_Formal, int nVersion_Type, void **fnPointer)
Definition: Application.c:34
char xor_encrypt(char ch, long key)
Definition: Encryption.c:19
#define RANDOM_STARTUP_DELAY
Definition: Application.h:38
@ packet_COAP_REQUEST
Definition: Application.h:72
@ packet_HTTP_REQUEST
Definition: Application.h:71
int fn_NetSim_Application_BSM(PAPP_BSM_INFO info, double *fSize, double *ldArrival, unsigned long *uSeed, unsigned long *uSeed1, unsigned long *uSeed2, unsigned long *uSeed3)
Definition: BSM.c:16
ptrAPPLICATION_INFO * applicationInfo
Definition: Application.h:136
int fn_NetSim_TrafficGenerator_Video(APP_VIDEO_INFO *info, double *fPacketSize, double *ldArrival, unsigned long *uSeed, unsigned long *uSeed1)
int fn_NetSim_Application_StartCOAPAPP(ptrAPPLICATION_INFO appInfo, double time)
Definition: CoAP.c:170
int fn_NetSim_Application_HTTP_ProcessRequest(ptrAPPLICATION_INFO pstruappinfo, NetSim_PACKET *pstruPacket)
int fn_NetSim_Application_ErlangCall_StartCall(NetSim_EVENTDETAILS *pstruEventDetails)
int fn_NetSim_Application_ErlangCall_EndCall(NetSim_EVENTDETAILS *pstruEventDetails)
int fn_NetSim_Application_P2P_SendNextPiece(ptrAPPLICATION_INFO appInfo, NETSIM_ID destination, double time)
int fn_NetSim_Application_P2P_MarkReceivedPacket(ptrAPPLICATION_INFO pstruappinfo, NetSim_PACKET *pstruPacket)
PACKET_TYPE fn_NetSim_Application_GetPacketTypeBasedOnApplicationType(APPLICATION_TYPE nAppType)
@ appState_Started
Definition: Application.h:78
#define MAX_TTL
Definition: Application.h:34
int fn_NetSim_Application_Configure_F(void **var)
unsigned int nApplicationCount
Definition: Application.h:40
int fn_NetSim_TrafficGenerator_Custom(APP_DATA_INFO *info, double *fSize, double *ldArrival, unsigned long *uSeed, unsigned long *uSeed1, unsigned long *uSeed2, unsigned long *uSeed3)
int fn_NetSim_TrafficGenerator_Voice(APP_VOICE_INFO *info, double *fSize, double *ldArrival, unsigned long *uSeed, unsigned long *uSeed1)
int fn_NetSim_App_RestartApplication()
struct stru_Application_Info * ptrAPPLICATION_INFO
void appmetrics_dest_add(ptrAPPLICATION_INFO appInfo, NetSim_PACKET *packet, NETSIM_ID dest)
@ Encryption_TEA
Definition: Application.h:63
@ Encryption_DES
Definition: Application.h:65
@ Encryption_AES
Definition: Application.h:64
@ Encryption_XOR
Definition: Application.h:62
int des(char *buf, int *len)
Definition: des_run.c:21
int fn_NetSim_Application_Metrics_F(PMETRICSWRITER metricsWriter)
int fn_NetSim_Application_Init_F()
bool add_sae_j2735_payload(NetSim_PACKET *packet, ptrAPPLICATION_INFO info)
Definition: BSM.c:104
@ event_APP_START
Definition: Application.h:54
@ event_APP_RESTART
Definition: Application.h:56
@ event_APP_END
Definition: Application.h:55
int fn_NetSim_Application_Plot(NetSim_PACKET *pstruPacket)
void free_app_metrics(ptrAPPLICATION_INFO appInfo)
void process_saej2735_packet(NetSim_PACKET *packet)
Definition: BSM.c:111
void fn_NetSim_Application_COAP_AppIn(ptrAPPLICATION_INFO pstruappinfo, NetSim_PACKET *pstruPacket)
Definition: CoAP.c:99
NETSIM_IPAddress IP_COPY(NETSIM_IPAddress ip)
NETSIM_IPAddress STR_TO_IP(char *ipStr, int type)
#define UINT
Definition: Linux.h:38
#define _declspec(dllexport)
This function is used to trigger the update.
Definition: Linux.h:41
#define fnNetSimError(x,...)
Definition: Linux.h:56
unsigned short u_short
Definition: Linux.h:110
#define UINT8
Definition: Linux.h:31
#define LIST_FREE(ls, mem)
Definition: List.h:32
#define free(p)
Definition: Memory.h:31
#define calloc(c, s)
Definition: Memory.h:29
void * PMETRICSWRITER
Definition: MetricsWriter.h:27
int fnValidatePacket(const NetSim_PACKET *pstruPacket)
double fnGetPacketSize(NetSim_PACKET *pstruData)
int fn_NetSim_Dispatch_to_emulator(NetSim_PACKET *packet)
@ QOS_UGS
Definition: Packet.h:88
@ QOS_BE
Definition: Packet.h:92
@ QOS_nrtPS
Definition: Packet.h:91
@ QOS_ertPS
Definition: Packet.h:90
@ QOS_rtPS
Definition: Packet.h:89
@ PacketType_Control
Definition: Packet.h:66
enum enum_ApplicationType APPLICATION_TYPE
NETSIM_ID get_first_dest_from_packet(NetSim_PACKET *packet)
@ TRAFFIC_CUSTOM
Definition: Packet.h:147
@ TRAFFIC_EMAIL
Definition: Packet.h:148
@ TRAFFIC_DATA
Definition: Packet.h:140
@ TRAFFIC_COAP
Definition: Packet.h:155
@ TRAFFIC_VIDEO
Definition: Packet.h:143
@ TRAFFIC_VOICE
Definition: Packet.h:142
@ TRAFFIC_SENSING
Definition: Packet.h:152
@ TRAFFIC_FTP
Definition: Packet.h:144
@ TRAFFIC_DATABASE
Definition: Packet.h:146
@ TRAFFIC_HTTP
Definition: Packet.h:145
@ TRAFFIC_CBR
Definition: Packet.h:141
@ TRAFFIC_BSM_APP
Definition: Packet.h:153
@ TRAFFIC_PEER_TO_PEER
Definition: Packet.h:149
@ TRAFFIC_EMULATION
Definition: Packet.h:151
@ TRAFFIC_ERLANG_CALL
Definition: Packet.h:150
void add_destlist_to_packet(NetSim_PACKET *packet, NETSIM_ID *destlist, UINT count)
@ Priority_Normal
Definition: Packet.h:80
@ Priority_High
Definition: Packet.h:82
@ Priority_Low
Definition: Packet.h:79
@ Priority_Medium
Definition: Packet.h:81
@ PacketStatus_NoError
Definition: Packet.h:101
NetSim_EVENTDETAILS * pstruEventDetails_Formal
Definition: RIP.h:178
NetSim_EVENTDETAILS char * pszAppPath_Formal
Definition: RIP.h:178
NetSim_EVENTDETAILS char char int nVersion_Type
Definition: RIP.h:178
NetSim_EVENTDETAILS char char * pszWritePath_Formal
Definition: RIP.h:178
NetSim_EVENTDETAILS char char int void ** fnPointer
Definition: RIP.h:178
#define PROTOCOL_APPLICATION
Definition: Stack.h:143
EXPORTED int wireshark_flag
Definition: Stack.h:847
#define DEVICE_TYPE(DeviceId)
Definition: Stack.h:773
NETSIM_IPAddress fn_NetSim_Stack_GetFirstIPAddressAsId(NETSIM_ID nDeviceId, unsigned int type)
#define MILLISECOND
Definition: Stack.h:59
EXPORTED struct stru_NetSim_Network * NETWORK
Definition: Stack.h:742
@ TIMER_EVENT
Definition: Stack.h:114
@ APPLICATION_IN_EVENT
Definition: Stack.h:113
@ APPLICATION_OUT_EVENT
Definition: Stack.h:112
EXPORTED struct stru_NetSim_EventDetails * pstruEventDetails
Definition: Stack.h:837
#define NETSIM_RAND_01()
Definition: Stack.h:860
@ UNICAST
Definition: Stack.h:363
@ MULTICAST
Definition: Stack.h:365
@ BROADCAST
Definition: Stack.h:364
NETSIM_IPAddress DNS_QUERY(NETSIM_ID nDeviceId, NETSIM_ID id)
int aes256(char *str, int *len)
Definition: aes_run.c:28
#define fn_NetSim_Packet_CreatePacket(layer)
Definition: main.h:186
enum enum_Packet_QOS QUALITY_OF_SERVICE
Definition: main.h:127
#define fn_NetSim_Packet_FreePacket(pstruPacket)
Definition: main.h:177
enum enum_PacketPriority PACKET_PRIORITY
Definition: main.h:126
#define fnpAddEvent(pstruEvent)
Definition: main.h:191
Structure for Data information such as packet size and inter arrival time,this is applicable for Vane...
Definition: Application.h:149
Structure to store the COAP application information.
Definition: Application.h:253
Structure for Erlang_call application.
Definition: Application.h:313
NetSim_PACKET *** nextPacket
Definition: Application.h:320
APP_VOICE_INFO VoiceInfo
Definition: Application.h:321
unsigned long long int ** nAppoutevent
Definition: Application.h:324
Structure for Data information such as packet size and inter arrival time,this is applicable for cust...
Definition: Application.h:140
Structure to store application information.
Definition: Application.h:97
NETSIM_IPAddress multicastDestIP
Definition: Application.h:134
APPLICATION_TYPE nAppType
Definition: Application.h:102
TRANSMISSION_TYPE nTransmissionType
Definition: Application.h:101
unsigned long long int nPacketId
Definition: Application.h:116
QUALITY_OF_SERVICE qos
Definition: Application.h:111
structure to store the video application information
Definition: Application.h:202
Structure for voice information such as packet size, inter arrival time and service type,...
Definition: Application.h:159
struct stru_NetSim_NetworkLayer * pstruNetworkLayer
Definition: Stack.h:721
unsigned long ulSeed[SEED_COUNT]
Definition: Stack.h:715
NETSIM_ID nApplicationId
Definition: Stack.h:752
EVENT_TYPE nEventType
Definition: Stack.h:747
NETSIM_ID nProtocolId
Definition: Stack.h:748
struct stru_NetSim_Packet * pPacket
Definition: Stack.h:754
NETSIM_ID nSubEventType
Definition: Stack.h:757
NETSIM_ID nDeviceId
Definition: Stack.h:750
long long int nPacketId
Definition: Stack.h:755
netsimDEVICE_TYPE nDeviceType
Definition: Stack.h:749
NETSIM_ID nInterfaceId
Definition: Stack.h:751
struct stru_NetSim_Device ** ppstruDeviceList
Definition: Stack.h:737
APPLICATION_TYPE nAppType
Definition: Packet.h:171
APPLICATION_LAYER_PROTOCOL nApplicationProtocol
Definition: Packet.h:172
NETSIM_IPAddress szDestIP
Definition: Packet.h:199
NETSIM_IPAddress szSourceIP
Definition: Packet.h:198
unsigned short int nSourcePort
Definition: Packet.h:184
unsigned short int nDestinationPort
Definition: Packet.h:185
long long int nPacketId
Definition: Packet.h:256
struct stru_NetSim_Packet_AppLayer * pstruAppData
Definition: Packet.h:273
PACKET_STATUS nPacketStatus
Definition: Packet.h:272
struct stru_NetSim_Packet_NetworkLayer * pstruNetworkData
Definition: Packet.h:275
double dEventTime
Definition: Packet.h:262
unsigned int nControlDataType
Definition: Packet.h:258
struct stru_NetSim_Packet * pstruNextPacket
Definition: Packet.h:278
QUALITY_OF_SERVICE nQOS
Definition: Packet.h:261
PACKET_TYPE nPacketType
Definition: Packet.h:257
struct stru_NetSim_Packet_TransportLayer * pstruTransportData
Definition: Packet.h:274
PPACKET_INFO szPayload
Definition: Packet.h:269
PACKET_PRIORITY nPacketPriority
Definition: Packet.h:260
NETSIM_ID nSourceId
Definition: Packet.h:263
unsigned char packet[MAXBUF]
Definition: Packet.h:244
unsigned int packet_len
Definition: Packet.h:245