NetSim Source Code Help v14.4
All 13 Components
 
Loading...
Searching...
No Matches
ReceivingRIP.c
1/************************************************************************************
2* Copyright (C) 2023
3*
4* TETCOS, Bangalore. India *
5
6* Tetcos owns the intellectual property rights in the Product and its content. *
7* The copying, redistribution, reselling or publication of any or all of the *
8* Product or its content without express prior written consent of Tetcos is *
9* prohibited. Ownership and / or any other right relating to the software and all *
10* intellectual property rights therein shall remain at all times with Tetcos. *
11
12* Author: Thangarasu.K *
13* ---------------------------------------------------------------------------------*/
14#define _CRT_SECURE_NO_DEPRECATE
15#include "main.h"
16#include "Routing.h"
17/**
18~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
19 The RIP message from the neighbor routers are received in this function, After receiving
20 the RIP message trigger the timeout timer event
21~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22 */
23_declspec(dllexport) int fn_NetSim_RIP_ReceivingOf_RIP_Message(struct stru_NetSim_Network *pstruNETWORK,NetSim_EVENTDETAILS *pstruEventDetails)
24{
25 NETSIM_ID nDeviceId;
26 double dEventTime;
27 RIP_ENTRY *pstruEntry;
28 // NetSim packet To store the RIP packet
29 NetSim_PACKET *pstruControlPacket = NULL;
30 // RIP PACKET to store RIP packet data
31 RIP_PACKET *pstruPacketRip = NULL;
32 pstruControlPacket=pstruEventDetails->pPacket;
33 pstruPacketRip=pstruControlPacket->pstruAppData->Packet_AppProtocol;
34 pstruEntry=pstruPacketRip->pstruRIPEntry;
35 NETWORK=pstruNETWORK;
36 nDeviceId=pstruEventDetails->nDeviceId;
37 dEventTime=pstruEventDetails->dEventTime;
38 get_RIP_var(nDeviceId)->uniInteriorRouting.struRIP.nStatus++;
39 pstruEventDetails->nEventType=APPLICATION_IN_EVENT;
40 pstruEventDetails->nProtocolId=APP_PROTOCOL_RIP;
41 pstruEventDetails->nSubEventType=ROUTING_TABLE_UPDATION;
42 fnpAddEvent(pstruEventDetails);
43 pstruEventDetails->pPacket = NULL;
44 while(pstruEntry!=NULL)
45 {
46 pstruEventDetails->nApplicationId=0;
47 //Assign the packet size as 512
48 pstruEventDetails->dPacketSize=RIP_PACKET_SIZE_WITH_HEADER;
49 pstruEventDetails->nEventType=TIMER_EVENT;
50 pstruEventDetails->nProtocolId=APP_PROTOCOL_RIP;
51 pstruEventDetails->nSubEventType=RIP_TIMEOUT;
52 // Add the timeout timer with the event time to trigger the timeout event
53 pstruEventDetails->dEventTime=dEventTime+get_RIP_var(nDeviceId)->uniInteriorRouting.struRIP.n_timeout_timer;
54 fnpAddEvent(pstruEventDetails);
55 pstruEntry=pstruEntry->pstru_RIP_NextEntry;
56 }
57 return 0;
58}
59
60