NetSim Source Code Help v14.4
All 13 Components
 
Loading...
Searching...
No Matches
GarbageCollectionTimer.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#ifndef _CRT_SECURE_NO_DEPRECATE
15#define _CRT_SECURE_NO_DEPRECATE
16#endif
17#include "main.h"
18#include "Routing.h"
19/**
20~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
21
22 Until the garbage-collection timer expires, the route is included in all
23 updates sent by the router. When the garbage collection timer expires, the route is deleted
24 from the routing table
25~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26 */
27int fn_NetSim_RIP_Garbage_Collection_Timer(struct stru_NetSim_Network *pstruNETWORK,NetSim_EVENTDETAILS *pstruEventDetails)
28{
29 RIP_ROUTING_DATABASE *pstruTmpHeadEntry;
30 RIP_ROUTING_DATABASE *pstruTempTableList;
31 RIP_ROUTING_DATABASE *pstruNewTable;
32
33 NETWORK=pstruNETWORK;
34 pstruTmpHeadEntry=NETWORK->ppstruDeviceList[pstruEventDetails->nDeviceId-1]->pstruNetworkLayer->RoutingVar;
35 pstruTempTableList=pstruTmpHeadEntry;
36
37 while(pstruTempTableList)
38 {
39 //check whether the entry is invalid or not if the entry is invalid remove that entry
40 if(pstruTempTableList->nMetric==EXPIRED_ROUTE)
41 {
42 pstruNewTable = pstruTempTableList;
43 pstruTempTableList=pstruTempTableList->pstru_Router_NextEntry;
44 pstruNewTable->pstru_Router_NextEntry = NULL;
45
46 if(NETWORK->ppstruDeviceList[pstruEventDetails->nDeviceId-1]->pstruNetworkLayer->RoutingVar == pstruNewTable)
47 NETWORK->ppstruDeviceList[pstruEventDetails->nDeviceId-1]->pstruNetworkLayer->RoutingVar = pstruTempTableList;
48
49 if(pstruNewTable->szAddress)
50 IP_FREE(pstruNewTable->szAddress);
51
52 if(pstruNewTable->szRouter)
53 IP_FREE(pstruNewTable->szRouter);
54
55 fnpFreeMemory(pstruNewTable);
56 }
57 else
58 pstruTempTableList=pstruTempTableList->pstru_Router_NextEntry;
59 }
60 return 1;
61}
62
63
unsigned int nMetric
Distance to the destination.
Definition RIP.h:78
NETSIM_IPAddress szRouter
The first router along the route to the destination.
Definition RIP.h:76
NETSIM_IPAddress szAddress
IP address of the destination host or destination network.
Definition RIP.h:74