NetSim Source Code Help v14.4
All 13 Components
 
Loading...
Searching...
No Matches
TimeoutTimer.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#include "main.h"
15#include "Routing.h"
16/**
17~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18
19 The timeout is initialized when a route is established, and any time
20 an update message is received for the route. If 180 seconds elapse from
21 the last time the timeout was initialized, the route is considered to
22 have expired
23~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
24 */
25int fn_NetSim_RIP_Timeout_Timer(struct stru_NetSim_Network *pstruNETWORK,NetSim_EVENTDETAILS *pstruEventDetails)
26{
27 RIP_ROUTING_DATABASE *pstruTempTable;
28 unsigned int nRIP_UpdateVar=0;
29 NETWORK=pstruNETWORK;
30 NETSIM_ID d = pstruEventDetails->nDeviceId;
31 DEVICE_ROUTER* rip = get_RIP_var(d);
32 pstruTempTable=NETWORK->ppstruDeviceList[pstruEventDetails->nDeviceId-1]->pstruNetworkLayer->RoutingVar;
33 while(pstruTempTable!=NULL)
34 {
35 //if there is no update for one entry, then assign the metric as Expired(16 i,e Infinity)
36 if(nRIP_UpdateVar==rip->uniInteriorRouting.struRIP.nStatus)
37 {
38 pstruTempTable->nMetric=EXPIRED_ROUTE;
39 pstruEventDetails->dPacketSize=RIP_PACKET_SIZE_WITH_HEADER;
40 pstruEventDetails->nApplicationId=0;
41 //Add the garbage collection timer value to trigger garbage collection timer event
42 pstruEventDetails->dEventTime=pstruEventDetails->dEventTime+rip->uniInteriorRouting.struRIP.n_garbage_collection_timer;
43 pstruEventDetails->nEventType=TIMER_EVENT;
44 pstruEventDetails->nProtocolId=APP_PROTOCOL_RIP;
45 pstruEventDetails->nSubEventType=RIP_GARBAGE_COLLECTION;
46 fnpAddEvent(pstruEventDetails);
47 }
48 pstruTempTable=pstruTempTable->pstru_Router_NextEntry;
49 }
50 return 1;
51}
52
unsigned int nMetric
Distance to the destination.
Definition RIP.h:78