NetSim Source Code Help
Loading...
Searching...
No Matches
ReceivingRIP.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
#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
NETSIM_ID
unsigned int NETSIM_ID
Definition:
Animation.h:45
_declspec
#define _declspec(dllexport)
This function is used to trigger the update.
Definition:
Linux.h:41
RIP_TIMEOUT
@ RIP_TIMEOUT
Definition:
RIP.h:51
ROUTING_TABLE_UPDATION
@ ROUTING_TABLE_UPDATION
Definition:
RIP.h:53
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)
fn_NetSim_RIP_ReceivingOf_RIP_Message
int fn_NetSim_RIP_ReceivingOf_RIP_Message(struct stru_NetSim_Network *pstruNETWORK, NetSim_EVENTDETAILS *pstruEventDetails)
Definition:
ReceivingRIP.c:23
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
APPLICATION_IN_EVENT
@ APPLICATION_IN_EVENT
Definition:
Stack.h:113
pstruEventDetails
EXPORTED struct stru_NetSim_EventDetails * pstruEventDetails
Definition:
Stack.h:837
main.h
fnpAddEvent
#define fnpAddEvent(pstruEvent)
Definition:
main.h:191
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::pPacket
struct stru_NetSim_Packet * pPacket
Definition:
Stack.h:754
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_Packet_AppLayer::Packet_AppProtocol
void * Packet_AppProtocol
Definition:
Packet.h:173
stru_NetSim_Packet
Definition:
Packet.h:255
stru_NetSim_Packet::pstruAppData
struct stru_NetSim_Packet_AppLayer * pstruAppData
Definition:
Packet.h:273
stru_NetSim_RIP_Packet
Definition:
RIP.h:101
stru_NetSim_RIP_Packet::pstruRIPEntry
struct stru_RIPEntry * pstruRIPEntry
Definition:
RIP.h:105
stru_NetSim_Router::uniInteriorRouting
union stru_NetSim_Router::uni_Interior_Routing uniInteriorRouting
stru_RIPEntry
Definition:
RIP.h:129
stru_RIPEntry::pstru_RIP_NextEntry
struct stru_RIPEntry * pstru_RIP_NextEntry
Definition:
RIP.h:137
stru_RIP::nStatus
unsigned short int nStatus
Definition:
RIP.h:148
stru_RIP::n_timeout_timer
int n_timeout_timer
Definition:
RIP.h:143
stru_NetSim_Router::uni_Interior_Routing::struRIP
struct stru_RIP struRIP
Definition:
Routing.h:27
ALL
Component 1
Part 1
Routing
ReceivingRIP.c
Generated on Fri Dec 9 2022 10:22:45 for NetSim Source Code Help by
1.9.5