NetSim Source Code Help
Loading...
Searching...
No Matches
HelloMessage.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"
18/**
19This function generate the Hello Message Packets and transmit them.
20*/
22{
24 //Add an event to transmit next hello packet
25 memcpy(&pevent,pstruEventDetails,sizeof pevent);
27 fnpAddEvent(&pevent);
29 return 0; //Already broadcast packet sent
31 {
33 0,
34 0,
37 AODV_RREP* hello = calloc(1,sizeof* hello);
39 packet->pstruNetworkData->nTTL = 2;
42 hello->HopCount = 0;
44 hello->Lifetime = (unsigned int)(pstruEventDetails->dEventTime +
47 //Broadcast hello message
48 //Add network out event
50 pevent.dPacketSize = fnGetPacketSize(packet);
51 pevent.nApplicationId = 0;
52 pevent.nApplicationId = 0;
55 pevent.nSubEventType = 0;
56 pevent.pPacket = packet;
57 pevent.szOtherDetails = NULL;
58 fnpAddEvent(&pevent);
59 packet->pstruNetworkData->szNextHopIp=NULL;
60 }
61 return 1;
62}
NetSim_PACKET * fn_NetSim_AODV_GenerateCtrlPacket(NETSIM_ID src, NETSIM_ID dest, NETSIM_ID recv, double dTime, AODV_CONTROL_PACKET type)
#define AODV_HELLO_INTERVAL
Definition: AODV.h:31
@ AODVctrlPacket_RREP
Definition: AODV.h:79
NETSIM_IPAddress aodv_get_curr_ip()
#define AODV_ALLOWED_HELLO_LOSS
Definition: AODV.h:27
#define AODV_DEV_VAR(devId)
Definition: AODV.h:413
int fn_NetSim_AODV_TransmitHelloMessage(NetSim_EVENTDETAILS *pstruEventDetails)
Definition: HelloMessage.c:21
#define calloc(c, s)
Definition: Memory.h:29
double fnGetPacketSize(NetSim_PACKET *pstruData)
NETWORK_LAYER_PROTOCOL fn_NetSim_Stack_GetNWProtocol(NETSIM_ID nDeviceId)
@ NETWORK_OUT_EVENT
Definition: Stack.h:108
EXPORTED struct stru_NetSim_EventDetails * pstruEventDetails
Definition: Stack.h:837
#define fnpAddEvent(pstruEvent)
Definition: main.h:191
unsigned int HopCount
Definition: AODV.h:195
NETSIM_IPAddress OriginatorIPaddress
The IP address of the node which originated the RREQ for which the route is supplied.
Definition: AODV.h:203
unsigned int DestinationSequenceNumber
The destination sequence number associated to the route.
Definition: AODV.h:202
unsigned int Lifetime
The time in milliseconds for which nodes receiving the RREP consider the route to be valid.
Definition: AODV.h:204
NETSIM_IPAddress LastAddress
Definition: AODV.h:205
NETSIM_IPAddress DestinationIPaddress
Definition: AODV.h:201
NETSIM_ID nApplicationId
Definition: Stack.h:752
EVENT_TYPE nEventType
Definition: Stack.h:747
NETSIM_ID nProtocolId
Definition: Stack.h:748
struct stru_NetSim_Packet * pPacket
Definition: Stack.h:754
NETSIM_ID nSubEventType
Definition: Stack.h:757
NETSIM_ID nDeviceId
Definition: Stack.h:750
NETSIM_IPAddress szNextHopIp
Definition: Packet.h:201
struct stru_NetSim_Packet_NetworkLayer * pstruNetworkData
Definition: Packet.h:275