NetSim Source Code Help
Loading...
Searching...
No Matches
TimeoutTimer.c
Go to the documentation of this file.
1/************************************************************************************
2* Copyright (C) 2020
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 */
26{
27 RIP_ROUTING_DATABASE *pstruTempTable;
28 unsigned int nRIP_UpdateVar=0;
29 NETWORK=pstruNETWORK;
31 DEVICE_ROUTER* rip = get_RIP_var(d);
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;
41 //Add the garbage collection timer value to trigger garbage collection timer event
47 }
48 pstruTempTable=pstruTempTable->pstru_Router_NextEntry;
49 }
50 return 1;
51}
52
unsigned int NETSIM_ID
Definition: Animation.h:45
@ RIP_GARBAGE_COLLECTION
Definition: RIP.h:52
#define EXPIRED_ROUTE
Definition: RIP.h:31
#define RIP_PACKET_SIZE_WITH_HEADER
Definition: RIP.h:28
DEVICE_ROUTER * get_RIP_var(NETSIM_ID d)
@ APP_PROTOCOL_RIP
Definition: Stack.h:154
EXPORTED struct stru_NetSim_Network * NETWORK
Definition: Stack.h:742
@ TIMER_EVENT
Definition: Stack.h:114
EXPORTED struct stru_NetSim_EventDetails * pstruEventDetails
Definition: Stack.h:837
int fn_NetSim_RIP_Timeout_Timer(struct stru_NetSim_Network *pstruNETWORK, NetSim_EVENTDETAILS *pstruEventDetails)
Definition: TimeoutTimer.c:25
#define fnpAddEvent(pstruEvent)
Definition: main.h:191
struct stru_NetSim_NetworkLayer * pstruNetworkLayer
Definition: Stack.h:721
NETSIM_ID nApplicationId
Definition: Stack.h:752
EVENT_TYPE nEventType
Definition: Stack.h:747
NETSIM_ID nProtocolId
Definition: Stack.h:748
NETSIM_ID nSubEventType
Definition: Stack.h:757
NETSIM_ID nDeviceId
Definition: Stack.h:750
struct stru_NetSim_Device ** ppstruDeviceList
Definition: Stack.h:737
union stru_NetSim_Router::uni_Interior_Routing uniInteriorRouting
int n_garbage_collection_timer
Definition: RIP.h:144
unsigned short int nStatus
Definition: RIP.h:148
Routing database structure Reference : RFC 2453, November 1998, Page 8.
Definition: RIP.h:73
unsigned int nMetric
Distance to the destination
Definition: RIP.h:78
struct stru_Router_RIP_Routing_database * pstru_Router_NextEntry
Definition: RIP.h:80