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
*/
25
int
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
NETSIM_ID
unsigned int NETSIM_ID
Definition:
Animation.h:45
RIP_GARBAGE_COLLECTION
@ RIP_GARBAGE_COLLECTION
Definition:
RIP.h:52
EXPIRED_ROUTE
#define EXPIRED_ROUTE
Definition:
RIP.h:31
RIP_PACKET_SIZE_WITH_HEADER
#define RIP_PACKET_SIZE_WITH_HEADER
Definition:
RIP.h:28
get_RIP_var
DEVICE_ROUTER * get_RIP_var(NETSIM_ID d)
Routing.h
APP_PROTOCOL_RIP
@ APP_PROTOCOL_RIP
Definition:
Stack.h:154
NETWORK
EXPORTED struct stru_NetSim_Network * NETWORK
Definition:
Stack.h:742
TIMER_EVENT
@ TIMER_EVENT
Definition:
Stack.h:114
pstruEventDetails
EXPORTED struct stru_NetSim_EventDetails * pstruEventDetails
Definition:
Stack.h:837
fn_NetSim_RIP_Timeout_Timer
int fn_NetSim_RIP_Timeout_Timer(struct stru_NetSim_Network *pstruNETWORK, NetSim_EVENTDETAILS *pstruEventDetails)
Definition:
TimeoutTimer.c:25
main.h
fnpAddEvent
#define fnpAddEvent(pstruEvent)
Definition:
main.h:191
stru_NetSim_Device::pstruNetworkLayer
struct stru_NetSim_NetworkLayer * pstruNetworkLayer
Definition:
Stack.h:721
stru_NetSim_EventDetails
Definition:
Stack.h:744
stru_NetSim_EventDetails::nApplicationId
NETSIM_ID nApplicationId
Definition:
Stack.h:752
stru_NetSim_EventDetails::nEventType
EVENT_TYPE nEventType
Definition:
Stack.h:747
stru_NetSim_EventDetails::nProtocolId
NETSIM_ID nProtocolId
Definition:
Stack.h:748
stru_NetSim_EventDetails::nSubEventType
NETSIM_ID nSubEventType
Definition:
Stack.h:757
stru_NetSim_EventDetails::nDeviceId
NETSIM_ID nDeviceId
Definition:
Stack.h:750
stru_NetSim_EventDetails::dEventTime
double dEventTime
Definition:
Stack.h:746
stru_NetSim_EventDetails::dPacketSize
double dPacketSize
Definition:
Stack.h:753
stru_NetSim_Network
Definition:
Stack.h:733
stru_NetSim_Network::ppstruDeviceList
struct stru_NetSim_Device ** ppstruDeviceList
Definition:
Stack.h:737
stru_NetSim_NetworkLayer::RoutingVar
void * RoutingVar
Definition:
Stack.h:524
stru_NetSim_Router
Definition:
Routing.h:24
stru_NetSim_Router::uniInteriorRouting
union stru_NetSim_Router::uni_Interior_Routing uniInteriorRouting
stru_RIP::n_garbage_collection_timer
int n_garbage_collection_timer
Definition:
RIP.h:144
stru_RIP::nStatus
unsigned short int nStatus
Definition:
RIP.h:148
stru_Router_RIP_Routing_database
Routing database structure Reference : RFC 2453, November 1998, Page 8.
Definition:
RIP.h:73
stru_Router_RIP_Routing_database::nMetric
unsigned int nMetric
Distance to the destination
Definition:
RIP.h:78
stru_Router_RIP_Routing_database::pstru_Router_NextEntry
struct stru_Router_RIP_Routing_database * pstru_Router_NextEntry
Definition:
RIP.h:80
stru_NetSim_Router::uni_Interior_Routing::struRIP
struct stru_RIP struRIP
Definition:
Routing.h:27
ALL
Component 1
Part 1
Routing
TimeoutTimer.c
Generated on Fri Dec 9 2022 10:22:45 for NetSim Source Code Help by
1.9.5