NetSim Source Code Help
Loading...
Searching...
No Matches
GeneralPacketProcessing.c
Go to the documentation of this file.
1/************************************************************************************
2* Copyright (C) 2020 *
3* TETCOS, Bangalore. India *
4* *
5* Tetcos owns the intellectual property rights in the Product and its content. *
6* The copying, redistribution, reselling or publication of any or all of the *
7* Product or its content without express prior written consent of Tetcos is *
8* prohibited. Ownership and / or any other right relating to the software and all *
9* intellectual property rights therein shall remain at all times with Tetcos. *
10* *
11* Author: Shashi Kant Suman *
12* *
13* ---------------------------------------------------------------------------------*/
14
15#include "main.h"
16#include "AODV.h"
17#include "List.h"
19/**
20This function is called in the Network Out Event for routing of the packet.
21
22If the Device route table has a route to the target, then the packet is added to sent to the
23next hop ip
24
25Whenever a packet is to be routed to a destination and the device route cache doesnt have
26a route to the target, the Packet is added to the FIFO and a Route Discovery is
27iitiated if not already.
28
29*/
31{
34 if(AODV_CHECK_ROUTE_FOUND(destIP))
35 {
36 NETSIM_ID port;
37 //Route found
44
45 ///Update the life time
48 ///Update the metrics
51 AODV_METRICS_VAR(pstruEventDetails->nDeviceId).packetTransmitted++;
52 }
54 {
55 ///No route found but RREQ is already sent
57 }
58 else
59 {
60 ///No route found. generate RREQ
62 }
63 return 1;
64}
#define AODV_ACTIVE_ROUTE_TIMEOUT
Definition: AODV.h:26
#define AODV_FIND_NEXT_HOP(devVar, dest)
Definition: AODV.h:404
#define AODV_NET_DIAMETER
Definition: AODV.h:36
#define AODV_UPDATE_ROUTE_TABLE(ip, lifetime)
Definition: AODV.h:407
#define AODV_ADD_TO_FIFO(packet, fifoBuffer, time)
Definition: AODV.h:393
NETSIM_IPAddress aodv_get_curr_ip()
#define AODV_GEN_RREQ()
Definition: AODV.h:394
#define AODV_METRICS_VAR(devId)
Definition: AODV.h:414
#define AODV_CHECK_ROUTE_FOUND(destIP)
Definition: AODV.h:392
#define AODV_DEV_VAR(devId)
Definition: AODV.h:413
unsigned int NETSIM_ID
Definition: Animation.h:45
int fn_NetSim_AODV_PacketDropNotification(NetSim_PACKET *packet)
Definition: RouteMaint.c:20
int fn_NetSim_AODV_GeneralPacketProcessing(NetSim_EVENTDETAILS *pstruEventDetails)
NETSIM_IPAddress IP_COPY(NETSIM_IPAddress ip)
#define _declspec(dllexport)
This function is used to trigger the update.
Definition: Linux.h:41
EXPORTED struct stru_NetSim_EventDetails * pstruEventDetails
Definition: Stack.h:837
NETSIM_ID fn_NetSim_Stack_GetDeviceId_asIP(NETSIM_IPAddress ip, NETSIM_ID *nInterfaceId)
struct stru_NetSim_Packet * pPacket
Definition: Stack.h:754
NETSIM_ID nDeviceId
Definition: Stack.h:750
NETSIM_IPAddress szGatewayIP
Definition: Packet.h:200
NETSIM_IPAddress szDestIP
Definition: Packet.h:199
NETSIM_IPAddress szNextHopIp
Definition: Packet.h:201
struct stru_NetSim_Packet_NetworkLayer * pstruNetworkData
Definition: Packet.h:275
NETSIM_ID nReceiverId
Definition: Packet.h:266
NETSIM_ID nTransmitterId
Definition: Packet.h:265
int(* DropNotification)(struct stru_NetSim_Packet *packet)
Definition: Packet.h:281
NETSIM_ID nSourceId
Definition: Packet.h:263