NetSim Source Code Help
Loading...
Searching...
No Matches
DSR.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  stru_NetSim_DSR_SourceRouteOption
 
struct  stru_NetSim_DSR_RREQ_Option
 
struct  stru_NetSim_DSR_RREP_Option
 
struct  stru_NetSim_DSR_RERR_Option
 
struct  stru_DSR_Ack_Request_Option
 
struct  stru_DSR_Ack_Option
 
struct  stru_DSR_OptionHeader
 
struct  stru_DSR_RouteCache
 
struct  stru_DSR_SendBuffer
 
struct  stru_DSR_RouteRequestTable
 
struct  stru_DSR_MaintBuffer
 
struct  stru_DSR_Metrics
 
struct  stru_DSR_DeviceVar
 

Macros

#define DSR_OPTION_HEADER_SIZE   4
 
#define DSR_RREQ_SIZE_FIXED   8
 
#define DSR_RREQ_SIZE_IPV6_FIXED   20
 
#define DSR_RREP_SIZE_FIXED   7
 
#define DSR_SOURCEROUTE_SIZE_FIXED   4
 
#define DSR_RERR_SIZE_FIXED   12+4/* type specific */
 
#define DSR_ACK_OPTION_LEN   10
 
#define DSR_ACK_REQUEST_LEN   4
 
#define DSR_RREQ_OPT_LEN   6
 
#define DSR_DISCOVERY_HOP_LIMIT   255
 
#define DSR_MAX_REQUEST_REXMT   16
 
#define DSR_MaxMaintRexmt   2
 
#define NO_NEXT_HEADER   59
 
#define NonpropRequestTimeout   (30* MILLISECOND)
 
#define DSR_REQUEST_PERIOD   (500* MILLISECOND)
 
#define DSR_MAX_REQUEST_PERIOD   (10* SECOND)
 
#define ROUTE_CACHE_TIMEOUT   (300* SECOND)
 
#define BROADCAST_JITTER   (10* MILLISECOND)
 
#define MAINT_HOLD_OFF_TIME   (250* MILLISECOND)
 
#define isDSRPACKET(packet)   (packet->nControlDataType/100 == NW_PROTOCOL_DSR)
 
#define DSR_PACKET_PROCESSING()   fn_NetSim_DSR_GeneralPacketProcessing(pstruEventDetails)
 
#define DSR_CHECK_ROUTE_FOUND(destAddress, devVar, nextHop, dTime, ppcache)   fn_NetSim_DSR_CheckRouteFound(destAddress,devVar,nextHop,dTime,ppcache)
 
#define DSR_ADD_TO_MAINT_BUFFER(nDeviceId, pstruPacket, dTime)   fn_NetSim_DSR_AddToMaintBuffer(nDeviceId,pstruPacket,dTime);
 
#define DSR_MAINT_TIMEOUT()   fn_NetSim_DSR_MaintTimeout(pstruEventDetails)
 
#define DSR_RETRANSMIT_BUFFER(maintBuffer)   fn_NetSim_DSR_RetransmitBuffer(maintBuffer,pstruEventDetails)
 
#define DSR_EMPTY_MAINT_BUFFER(nDeviceId, nextHop)   fn_NetSim_DSR_EmptyMaintBuffer(nDeviceId,nextHop)
 
#define DSR_UPDATE_ROUTE_CACHE(length, address, dTime)   fn_NetSim_DSR_UpdateRouteCache(length,address,dTime)
 
#define DSR_FIND_CACHE(devVar, address, dTime)   fn_NetSim_DSR_FindCache(devVar,address,dTime)
 
#define DSR_VALIDATE_CACHE(cache, addList, count)   fn_NetSim_DSR_ValidateRouteCache(cache,addList,count)
 
#define DSR_DELETE_ENTRY_CACHE(ppcache, ip1, ip2)   fn_NetSim_DSR_DeleteEntryFromRouteCache(ppcache,ip1,ip2)
 
#define DSR_GENERATE_RERR(maintBuffer)   fn_NetSim_DSR_GenerateRERR(maintBuffer,pstruEventDetails)
 
#define DSR_PROCESS_RERR()   fn_NetSim_DSR_ProcessRerr(pstruEventDetails)
 
#define DSR_GENERATE_RREP(rreqPacket)   fn_NetSim_DSR_GenerateRREP(rreqPacket,pstruEventDetails)
 
#define DSR_PROCESS_RREP()   fn_NetSim_DSR_ProcessRREP(pstruEventDetails)
 
#define DSR_GENERATE_RREP_USING_CACHE(devVar, rreqPacket, dTime)   fn_NetSim_DSR_GenerateRREPUsingRouteCache(devVar,rreqPacket,dTime,pstruEventDetails)
 
#define DSR_INIT_RREQ(target, pprreqTable, nDeviceId, dTime)   fn_NetSim_DSR_InitRouteRequest(target,pprreqTable,nDeviceId,dTime,pstruEventDetails)
 
#define DSR_RREQ_TIMEOUT()   fn_NetSim_DSR_RREQTimeout(pstruEventDetails)
 
#define DSR_RETRY_RREQ(targetAddress, nDeviceId, dTime)   fn_NetSim_DSR_RetryRREQ(targetAddress,nDeviceId,dTime,pstruEventDetails)
 
#define DSR_PROCESS_RREQ()   fn_NetSim_DSR_ProcessRREQ(pstruEventDetails)
 
#define DSR_ADD_TO_SEND_BUFFER(ppsendBuffer, packet, dTime)   fn_NetSim_DSR_AddToSendBuffer(ppsendBuffer,packet,dTime)
 
#define DSR_EMPTY_SEND_BUFFER(targetAddress, nDeviceId)   fn_NetSim_DSR_EmptySendBuffer(targetAddress,nDeviceId)
 
#define DSR_CHECK_SEND_BUFFER(nDeviceId, dTime)   fn_NetSim_DSR_CheckSendBuffer(nDeviceId,dTime)
 
#define DSR_TRANSMIT_SEND_BUFFER(sendBuffer, nDeviceId, dTime)   fn_NetSim_DSR_TransmitPacketFromSendBuffer(sendBuffer,nDeviceId,dTime)
 
#define DSR_ADD_SRC_ROUTE(packet, cache)   fn_NetSim_DSR_AddSourceRouteOption(packet,cache)
 
#define DSR_PROCESS_SRC_ROUTE()   fn_NetSim_DSR_ProcessSourceRouteOption(pstruEventDetails)
 
#define DSR_ADD_ACK_REQUEST(packet)   fn_NetSim_DSR_Add_Ack_request_Option(packet,pstruEventDetails)
 
#define DSR_PROCESS_ACK_REQUEST(packet)   fn_NetSim_DSR_Process_AckRequestOption(packet,pstruEventDetails)
 
#define DSR_PROCESS_ACK()   fn_NetSim_DSR_ProcessAckOption(pstruEventDetails);
 
#define DSR_DEV_VAR(dev)   ((DSR_DEVICE_VAR*)NETWORK->ppstruDeviceList[dev-1]->pstruNetworkLayer->RoutingVar)
 
#define DSR_RREQ_LEN(rreq)   (int)(rreq->nOptDataLen-6)/4
 
#define DSR_RREP_LEN(rrep)   (int)(rrep->nOptDataLen-3)/4+1
 
#define SENDBUFFER_ALLOC()   list_alloc(sizeof(struct stru_DSR_SendBuffer),offsetof(struct stru_DSR_SendBuffer,ele))
 
#define RREQTABLE_ALLOC()   (DSR_RREQ_TABLE*)list_alloc(sizeof(struct stru_DSR_RouteRequestTable),offsetof(struct stru_DSR_RouteRequestTable,ele))
 
#define ROUTECACHE_ALLOC()   (DSR_ROUTE_CACHE*)list_alloc(sizeof(struct stru_DSR_RouteCache),offsetof(struct stru_DSR_RouteCache,ele))
 
#define MAINTBUFFER_ALLOC()   (DSR_MAINT_BUFFER*)list_alloc(sizeof(DSR_MAINT_BUFFER),offsetof(DSR_MAINT_BUFFER,ele))
 

Typedefs

typedef enum enum_DSR_Subevent DSR_SUBEVENT
 
typedef enum enum_DSR_ControlPacket DSR_CONTROL_PACKET
 
typedef enum enum_DSR_OptionType DSR_OPTION_TYPE
 
typedef struct stru_DSR_SendBuffer DSR_SEND_BUFFER
 
typedef struct stru_DSR_RouteCache DSR_ROUTE_CACHE
 
typedef struct stru_DSR_MaintBuffer DSR_MAINT_BUFFER
 
typedef struct stru_DSR_DeviceVar DSR_DEVICE_VAR
 
typedef struct stru_DSR_OptionHeader DSR_OPTION_HEADER
 
typedef struct stru_NetSim_DSR_RREQ_Option DSR_RREQ_OPTION
 
typedef struct stru_NetSim_DSR_RREP_Option DSR_RREP_OPTION
 
typedef struct stru_NetSim_DSR_RERR_Option DSR_RERR_OPTION
 
typedef struct stru_NetSim_DSR_SourceRouteOption DSR_SOURCE_ROUTE_OPTION
 
typedef struct stru_DSR_Ack_Request_Option DSR_ACK_REQ_OPTION
 
typedef struct stru_DSR_Ack_Option DSR_ACK_OPTION
 
typedef struct stru_DSR_RouteRequestTable DSR_RREQ_TABLE
 
typedef struct stru_DSR_Primitives DSR_PRIMITIVES
 

Enumerations

enum  enum_DSR_Subevent { subevent_RREQ_TIMEOUT =NW_PROTOCOL_DSR*100+1 , subevent_MAINT_TIMEOUT , subevent_PROCESS_RERR }
 Enumeration for DSR Subevents. More...
 
enum  enum_DSR_ControlPacket { ctrlPacket_ROUTE_REQUEST =NW_PROTOCOL_DSR*100+1 , ctrlPacket_ROUTE_REPLY , ctrlPacket_ROUTE_ERROR , ctrlPacket_ACK }
 Enumeration for DSR Control Packets. More...
 
enum  enum_DSR_OptionType {
  optType_RouteRequest =1 , optType_RouteReply =2 , optType_RouteError =3 , optType_Ack =32 ,
  optType_SourceRoute =96 , optType_AckRequest =160
}
 Enumeration for DSR option types. More...
 

Functions

DSR_ROUTE_CACHEfn_NetSim_DSR_FindCache (DSR_DEVICE_VAR *devVar, NETSIM_IPAddress address, double dTime)
 
int fn_NetSim_DSR_GeneralPacketProcessing (NetSim_EVENTDETAILS *pstruEventDetails)
 
bool fn_NetSim_DSR_CheckRouteFound (NETSIM_IPAddress destAddress, DSR_DEVICE_VAR *devVar, NETSIM_IPAddress *nextHop, double dTime, DSR_ROUTE_CACHE **cache)
 
int fn_NetSim_DSR_AddSourceRouteOption (NetSim_PACKET *packet, DSR_ROUTE_CACHE *cache)
 
int fn_NetSim_DSR_ProcessSourceRouteOption (NetSim_EVENTDETAILS *pstruEventDetails)
 
int fn_NetSim_DSR_AddToMaintBuffer (NETSIM_ID nDeviceId, NetSim_PACKET *pstruPacket, double dTime)
 
int fn_NetSim_DSR_MaintTimeout (NetSim_EVENTDETAILS *pstruEventDetails)
 
int fn_NetSim_DSR_RetransmitBuffer (DSR_MAINT_BUFFER *maintBuffer, NetSim_EVENTDETAILS *pstruEventDetails)
 
int fn_NetSim_DSR_EmptyMaintBuffer (NETSIM_ID nDeviceId, NETSIM_ID nextHop)
 
bool fn_NetSim_DSR_AddToSendBuffer (DSR_SEND_BUFFER **sendBuffer, NetSim_PACKET *packet, double dTime)
 
void fn_NetSim_DSR_EmptySendBuffer (NETSIM_IPAddress targetAddress, NETSIM_ID nDeviceId)
 
void fn_NetSim_DSR_CheckSendBuffer (NETSIM_ID nDeviceId, double dTime)
 
int fn_NetSim_DSR_TransmitPacketFromSendBuffer (DSR_SEND_BUFFER *sendBuffer, NETSIM_ID nDeviceId, double dTime)
 
int fn_NetSim_DSR_UpdateRouteCache (unsigned int length, NETSIM_IPAddress *address, double dTime)
 
bool fn_NetSim_DSR_ValidateRouteCache (DSR_ROUTE_CACHE *cache, NETSIM_IPAddress *addList, int count)
 
int fn_NetSim_DSR_DeleteEntryFromRouteCache (DSR_ROUTE_CACHE **ppcache, NETSIM_IPAddress ip1, NETSIM_IPAddress ip2)
 
int fn_NetSim_DSR_GenerateRREP (NetSim_PACKET *rreqPacket, NetSim_EVENTDETAILS *pstruEventDetails)
 
int fn_NetSim_DSR_ProcessRREP (NetSim_EVENTDETAILS *pstruEventDetails)
 
bool fn_NetSim_DSR_GenerateRREPUsingRouteCache (DSR_DEVICE_VAR *devVar, NetSim_PACKET *rreqPacket, double dTime, NetSim_EVENTDETAILS *pstruEventDetails)
 
int fn_NetSim_DSR_ForwardRREP ()
 
int fn_NetSim_DSR_GenerateRERR (DSR_MAINT_BUFFER *maintBuffer, NetSim_EVENTDETAILS *pstruEventDetails)
 
int fn_NetSim_DSR_ProcessRerr (NetSim_EVENTDETAILS *pstruEventDetails)
 
NetSim_PACKETfn_NetSim_DSR_InitRouteRequest (NETSIM_IPAddress target, DSR_RREQ_TABLE **rreqTable, NETSIM_ID nDeviceId, double dTime, NetSim_EVENTDETAILS *pstruEventDetails)
 
int fn_NetSim_DSR_RREQTimeout (NetSim_EVENTDETAILS *pstruEventDetails)
 
NetSim_PACKETfn_NetSim_DSR_RetryRREQ (NETSIM_IPAddress targetAddress, NETSIM_ID nDeviceId, double dTime, NetSim_EVENTDETAILS *pstruEventDetails)
 
int fn_NetSim_DSR_ProcessRREQ (NetSim_EVENTDETAILS *pstruEventDetails)
 
int fn_NetSim_DSR_Add_Ack_request_Option (NetSim_PACKET *packet, NetSim_EVENTDETAILS *pstruEventDetails)
 
int fn_NetSim_DSR_ProcessAckOption (NetSim_EVENTDETAILS *pstruEventDetails)
 
int fn_NetSim_DSR_Process_AckRequestOption (NetSim_PACKET *packet, NetSim_EVENTDETAILS *pstruEventDetails)
 
NetSim_PACKETfn_NetSim_DSR_GenerateCtrlPacket (NETSIM_ID src, NETSIM_ID dest, NETSIM_ID recv, double dTime, DSR_CONTROL_PACKET type)
 
double fn_NetSim_DSR_GetBroadCastJitter ()
 
int fn_NetSim_DSR_LinkLayerAck (NetSim_PACKET *)
 
unsigned int fn_NetSim_DSR_FillAddress (DSR_SOURCE_ROUTE_OPTION *srcOption, DSR_ROUTE_CACHE *cache, NETSIM_IPAddress src, NETSIM_IPAddress dest)
 
int fn_NetSim_DSR_Finish_F ()
 
DSR_RREQ_TABLEgetRREQTable (NETSIM_IPAddress target, DSR_RREQ_TABLE *table)
 
void set_dsr_curr ()
 
NETSIM_IPAddress dsr_get_curr_ip ()
 
NETSIM_ID dsr_get_curr_if ()
 
NETSIM_IPAddress dsr_get_dev_ip (NETSIM_ID d)
 
bool isDsrConfigured (NETSIM_ID d, NETSIM_ID in)
 
int fn_NetSim_DSR_FreePacket (NetSim_PACKET *packet)
 

Macro Definition Documentation

◆ BROADCAST_JITTER

#define BROADCAST_JITTER   (10* MILLISECOND)

Definition at line 50 of file DSR.h.

◆ DSR_ACK_OPTION_LEN

#define DSR_ACK_OPTION_LEN   10

Definition at line 36 of file DSR.h.

◆ DSR_ACK_REQUEST_LEN

#define DSR_ACK_REQUEST_LEN   4

Definition at line 37 of file DSR.h.

◆ DSR_ADD_ACK_REQUEST

#define DSR_ADD_ACK_REQUEST (   packet)    fn_NetSim_DSR_Add_Ack_request_Option(packet,pstruEventDetails)

Definition at line 750 of file DSR.h.

◆ DSR_ADD_SRC_ROUTE

#define DSR_ADD_SRC_ROUTE (   packet,
  cache 
)    fn_NetSim_DSR_AddSourceRouteOption(packet,cache)

Definition at line 747 of file DSR.h.

◆ DSR_ADD_TO_MAINT_BUFFER

#define DSR_ADD_TO_MAINT_BUFFER (   nDeviceId,
  pstruPacket,
  dTime 
)    fn_NetSim_DSR_AddToMaintBuffer(nDeviceId,pstruPacket,dTime);

Definition at line 720 of file DSR.h.

◆ DSR_ADD_TO_SEND_BUFFER

#define DSR_ADD_TO_SEND_BUFFER (   ppsendBuffer,
  packet,
  dTime 
)    fn_NetSim_DSR_AddToSendBuffer(ppsendBuffer,packet,dTime)

Definition at line 742 of file DSR.h.

◆ DSR_CHECK_ROUTE_FOUND

#define DSR_CHECK_ROUTE_FOUND (   destAddress,
  devVar,
  nextHop,
  dTime,
  ppcache 
)    fn_NetSim_DSR_CheckRouteFound(destAddress,devVar,nextHop,dTime,ppcache)

Definition at line 718 of file DSR.h.

◆ DSR_CHECK_SEND_BUFFER

#define DSR_CHECK_SEND_BUFFER (   nDeviceId,
  dTime 
)    fn_NetSim_DSR_CheckSendBuffer(nDeviceId,dTime)

Definition at line 744 of file DSR.h.

◆ DSR_DELETE_ENTRY_CACHE

#define DSR_DELETE_ENTRY_CACHE (   ppcache,
  ip1,
  ip2 
)    fn_NetSim_DSR_DeleteEntryFromRouteCache(ppcache,ip1,ip2)

Definition at line 728 of file DSR.h.

◆ DSR_DEV_VAR

#define DSR_DEV_VAR (   dev)    ((DSR_DEVICE_VAR*)NETWORK->ppstruDeviceList[dev-1]->pstruNetworkLayer->RoutingVar)

Definition at line 772 of file DSR.h.

◆ DSR_DISCOVERY_HOP_LIMIT

#define DSR_DISCOVERY_HOP_LIMIT   255

Definition at line 40 of file DSR.h.

◆ DSR_EMPTY_MAINT_BUFFER

#define DSR_EMPTY_MAINT_BUFFER (   nDeviceId,
  nextHop 
)    fn_NetSim_DSR_EmptyMaintBuffer(nDeviceId,nextHop)

Definition at line 723 of file DSR.h.

◆ DSR_EMPTY_SEND_BUFFER

#define DSR_EMPTY_SEND_BUFFER (   targetAddress,
  nDeviceId 
)    fn_NetSim_DSR_EmptySendBuffer(targetAddress,nDeviceId)

Definition at line 743 of file DSR.h.

◆ DSR_FIND_CACHE

#define DSR_FIND_CACHE (   devVar,
  address,
  dTime 
)    fn_NetSim_DSR_FindCache(devVar,address,dTime)

Definition at line 726 of file DSR.h.

◆ DSR_GENERATE_RERR

#define DSR_GENERATE_RERR (   maintBuffer)    fn_NetSim_DSR_GenerateRERR(maintBuffer,pstruEventDetails)

Definition at line 730 of file DSR.h.

◆ DSR_GENERATE_RREP

#define DSR_GENERATE_RREP (   rreqPacket)    fn_NetSim_DSR_GenerateRREP(rreqPacket,pstruEventDetails)

Definition at line 733 of file DSR.h.

◆ DSR_GENERATE_RREP_USING_CACHE

#define DSR_GENERATE_RREP_USING_CACHE (   devVar,
  rreqPacket,
  dTime 
)    fn_NetSim_DSR_GenerateRREPUsingRouteCache(devVar,rreqPacket,dTime,pstruEventDetails)

Definition at line 735 of file DSR.h.

◆ DSR_INIT_RREQ

#define DSR_INIT_RREQ (   target,
  pprreqTable,
  nDeviceId,
  dTime 
)    fn_NetSim_DSR_InitRouteRequest(target,pprreqTable,nDeviceId,dTime,pstruEventDetails)

Definition at line 737 of file DSR.h.

◆ DSR_MAINT_TIMEOUT

#define DSR_MAINT_TIMEOUT ( )    fn_NetSim_DSR_MaintTimeout(pstruEventDetails)

Definition at line 721 of file DSR.h.

◆ DSR_MAX_REQUEST_PERIOD

#define DSR_MAX_REQUEST_PERIOD   (10* SECOND)

Definition at line 48 of file DSR.h.

◆ DSR_MAX_REQUEST_REXMT

#define DSR_MAX_REQUEST_REXMT   16

Definition at line 41 of file DSR.h.

◆ DSR_MaxMaintRexmt

#define DSR_MaxMaintRexmt   2

Definition at line 42 of file DSR.h.

◆ DSR_OPTION_HEADER_SIZE

#define DSR_OPTION_HEADER_SIZE   4

Definition at line 30 of file DSR.h.

◆ DSR_PACKET_PROCESSING

#define DSR_PACKET_PROCESSING ( )    fn_NetSim_DSR_GeneralPacketProcessing(pstruEventDetails)

Definition at line 717 of file DSR.h.

◆ DSR_PROCESS_ACK

#define DSR_PROCESS_ACK ( )    fn_NetSim_DSR_ProcessAckOption(pstruEventDetails);

Definition at line 752 of file DSR.h.

◆ DSR_PROCESS_ACK_REQUEST

#define DSR_PROCESS_ACK_REQUEST (   packet)    fn_NetSim_DSR_Process_AckRequestOption(packet,pstruEventDetails)

Definition at line 751 of file DSR.h.

◆ DSR_PROCESS_RERR

#define DSR_PROCESS_RERR ( )    fn_NetSim_DSR_ProcessRerr(pstruEventDetails)

Definition at line 731 of file DSR.h.

◆ DSR_PROCESS_RREP

#define DSR_PROCESS_RREP ( )    fn_NetSim_DSR_ProcessRREP(pstruEventDetails)

Definition at line 734 of file DSR.h.

◆ DSR_PROCESS_RREQ

#define DSR_PROCESS_RREQ ( )    fn_NetSim_DSR_ProcessRREQ(pstruEventDetails)

Definition at line 740 of file DSR.h.

◆ DSR_PROCESS_SRC_ROUTE

#define DSR_PROCESS_SRC_ROUTE ( )    fn_NetSim_DSR_ProcessSourceRouteOption(pstruEventDetails)

Definition at line 748 of file DSR.h.

◆ DSR_REQUEST_PERIOD

#define DSR_REQUEST_PERIOD   (500* MILLISECOND)

Definition at line 47 of file DSR.h.

◆ DSR_RERR_SIZE_FIXED

#define DSR_RERR_SIZE_FIXED   12+4/* type specific */

Definition at line 35 of file DSR.h.

◆ DSR_RETRANSMIT_BUFFER

#define DSR_RETRANSMIT_BUFFER (   maintBuffer)    fn_NetSim_DSR_RetransmitBuffer(maintBuffer,pstruEventDetails)

Definition at line 722 of file DSR.h.

◆ DSR_RETRY_RREQ

#define DSR_RETRY_RREQ (   targetAddress,
  nDeviceId,
  dTime 
)    fn_NetSim_DSR_RetryRREQ(targetAddress,nDeviceId,dTime,pstruEventDetails)

Definition at line 739 of file DSR.h.

◆ DSR_RREP_LEN

#define DSR_RREP_LEN (   rrep)    (int)(rrep->nOptDataLen-3)/4+1

Definition at line 774 of file DSR.h.

◆ DSR_RREP_SIZE_FIXED

#define DSR_RREP_SIZE_FIXED   7

Definition at line 33 of file DSR.h.

◆ DSR_RREQ_LEN

#define DSR_RREQ_LEN (   rreq)    (int)(rreq->nOptDataLen-6)/4

Definition at line 773 of file DSR.h.

◆ DSR_RREQ_OPT_LEN

#define DSR_RREQ_OPT_LEN   6

Definition at line 39 of file DSR.h.

◆ DSR_RREQ_SIZE_FIXED

#define DSR_RREQ_SIZE_FIXED   8

Definition at line 31 of file DSR.h.

◆ DSR_RREQ_SIZE_IPV6_FIXED

#define DSR_RREQ_SIZE_IPV6_FIXED   20

Definition at line 32 of file DSR.h.

◆ DSR_RREQ_TIMEOUT

#define DSR_RREQ_TIMEOUT ( )    fn_NetSim_DSR_RREQTimeout(pstruEventDetails)

Definition at line 738 of file DSR.h.

◆ DSR_SOURCEROUTE_SIZE_FIXED

#define DSR_SOURCEROUTE_SIZE_FIXED   4

Definition at line 34 of file DSR.h.

◆ DSR_TRANSMIT_SEND_BUFFER

#define DSR_TRANSMIT_SEND_BUFFER (   sendBuffer,
  nDeviceId,
  dTime 
)    fn_NetSim_DSR_TransmitPacketFromSendBuffer(sendBuffer,nDeviceId,dTime)

Definition at line 745 of file DSR.h.

◆ DSR_UPDATE_ROUTE_CACHE

#define DSR_UPDATE_ROUTE_CACHE (   length,
  address,
  dTime 
)    fn_NetSim_DSR_UpdateRouteCache(length,address,dTime)

Definition at line 725 of file DSR.h.

◆ DSR_VALIDATE_CACHE

#define DSR_VALIDATE_CACHE (   cache,
  addList,
  count 
)    fn_NetSim_DSR_ValidateRouteCache(cache,addList,count)

Definition at line 727 of file DSR.h.

◆ isDSRPACKET

#define isDSRPACKET (   packet)    (packet->nControlDataType/100 == NW_PROTOCOL_DSR)

Definition at line 53 of file DSR.h.

◆ MAINT_HOLD_OFF_TIME

#define MAINT_HOLD_OFF_TIME   (250* MILLISECOND)

Definition at line 51 of file DSR.h.

◆ MAINTBUFFER_ALLOC

#define MAINTBUFFER_ALLOC ( )    (DSR_MAINT_BUFFER*)list_alloc(sizeof(DSR_MAINT_BUFFER),offsetof(DSR_MAINT_BUFFER,ele))

Definition at line 780 of file DSR.h.

◆ NO_NEXT_HEADER

#define NO_NEXT_HEADER   59

Definition at line 45 of file DSR.h.

◆ NonpropRequestTimeout

#define NonpropRequestTimeout   (30* MILLISECOND)

Definition at line 46 of file DSR.h.

◆ ROUTE_CACHE_TIMEOUT

#define ROUTE_CACHE_TIMEOUT   (300* SECOND)

Definition at line 49 of file DSR.h.

◆ ROUTECACHE_ALLOC

#define ROUTECACHE_ALLOC ( )    (DSR_ROUTE_CACHE*)list_alloc(sizeof(struct stru_DSR_RouteCache),offsetof(struct stru_DSR_RouteCache,ele))

Definition at line 779 of file DSR.h.

◆ RREQTABLE_ALLOC

#define RREQTABLE_ALLOC ( )    (DSR_RREQ_TABLE*)list_alloc(sizeof(struct stru_DSR_RouteRequestTable),offsetof(struct stru_DSR_RouteRequestTable,ele))

Definition at line 778 of file DSR.h.

◆ SENDBUFFER_ALLOC

#define SENDBUFFER_ALLOC ( )    list_alloc(sizeof(struct stru_DSR_SendBuffer),offsetof(struct stru_DSR_SendBuffer,ele))

Definition at line 777 of file DSR.h.

Typedef Documentation

◆ DSR_ACK_OPTION

Definition at line 71 of file DSR.h.

◆ DSR_ACK_REQ_OPTION

Definition at line 70 of file DSR.h.

◆ DSR_CONTROL_PACKET

Definition at line 57 of file DSR.h.

◆ DSR_DEVICE_VAR

Definition at line 63 of file DSR.h.

◆ DSR_MAINT_BUFFER

Definition at line 62 of file DSR.h.

◆ DSR_OPTION_HEADER

Definition at line 65 of file DSR.h.

◆ DSR_OPTION_TYPE

Definition at line 58 of file DSR.h.

◆ DSR_PRIMITIVES

typedef struct stru_DSR_Primitives DSR_PRIMITIVES

Definition at line 74 of file DSR.h.

◆ DSR_RERR_OPTION

Definition at line 68 of file DSR.h.

◆ DSR_ROUTE_CACHE

Definition at line 61 of file DSR.h.

◆ DSR_RREP_OPTION

Definition at line 67 of file DSR.h.

◆ DSR_RREQ_OPTION

Definition at line 66 of file DSR.h.

◆ DSR_RREQ_TABLE

Definition at line 72 of file DSR.h.

◆ DSR_SEND_BUFFER

Definition at line 60 of file DSR.h.

◆ DSR_SOURCE_ROUTE_OPTION

Definition at line 69 of file DSR.h.

◆ DSR_SUBEVENT

Definition at line 56 of file DSR.h.

Enumeration Type Documentation

◆ enum_DSR_ControlPacket

Enumeration for DSR Control Packets.

Enumerator
ctrlPacket_ROUTE_REQUEST 
ctrlPacket_ROUTE_REPLY 
ctrlPacket_ROUTE_ERROR 
ctrlPacket_ACK 

Definition at line 85 of file DSR.h.

◆ enum_DSR_OptionType

Enumeration for DSR option types.

Enumerator
optType_RouteRequest 
optType_RouteReply 
optType_RouteError 
optType_Ack 
optType_SourceRoute 
optType_AckRequest 

Definition at line 94 of file DSR.h.

◆ enum_DSR_Subevent

Enumeration for DSR Subevents.

Enumerator
subevent_RREQ_TIMEOUT 
subevent_MAINT_TIMEOUT 
subevent_PROCESS_RERR 

Definition at line 77 of file DSR.h.

Function Documentation

◆ dsr_get_curr_if()

NETSIM_ID dsr_get_curr_if ( )
Here is the caller graph for this function:

◆ dsr_get_curr_ip()

NETSIM_IPAddress dsr_get_curr_ip ( )
Here is the caller graph for this function:

◆ dsr_get_dev_ip()

NETSIM_IPAddress dsr_get_dev_ip ( NETSIM_ID  d)
Here is the caller graph for this function:

◆ fn_NetSim_DSR_Add_Ack_request_Option()

int fn_NetSim_DSR_Add_Ack_request_Option ( NetSim_PACKET packet,
NetSim_EVENTDETAILS pstruEventDetails 
)

This function adds the Acknowledge request option to the packet.

Definition at line 20 of file Network_Layer_Ack.c.

◆ fn_NetSim_DSR_AddSourceRouteOption()

int fn_NetSim_DSR_AddSourceRouteOption ( NetSim_PACKET packet,
DSR_ROUTE_CACHE cache 
)

This function adds the source route option

Definition at line 20 of file SourceRoute.c.

Here is the call graph for this function:

◆ fn_NetSim_DSR_AddToMaintBuffer()

int fn_NetSim_DSR_AddToMaintBuffer ( NETSIM_ID  nDeviceId,
NetSim_PACKET pstruPacket,
double  dTime 
)

Whenever a packet is to be sent to the target and the device has the next Hop IP, the packet is added to the MaintBuffer and retained there until and acknowledge is received or a timeout happens in which case the packets are retransmitted.

Definition at line 22 of file MaintBuffer.c.

Here is the call graph for this function:

◆ fn_NetSim_DSR_AddToSendBuffer()

bool fn_NetSim_DSR_AddToSendBuffer ( DSR_SEND_BUFFER **  sendBuffer,
NetSim_PACKET packet,
double  dTime 
)

This function adds the packet to send buffer.

Definition at line 20 of file SendBuffer.c.

◆ fn_NetSim_DSR_CheckRouteFound()

bool fn_NetSim_DSR_CheckRouteFound ( NETSIM_IPAddress  destAddress,
DSR_DEVICE_VAR devVar,
NETSIM_IPAddress nextHop,
double  dTime,
DSR_ROUTE_CACHE **  cache 
)

This function checks if the route cache of the device has the route to the Destination

Definition at line 20 of file CheckRouteFound.c.

Here is the caller graph for this function:

◆ fn_NetSim_DSR_CheckSendBuffer()

void fn_NetSim_DSR_CheckSendBuffer ( NETSIM_ID  nDeviceId,
double  dTime 
)

This function checks if the route cache has the route to the target and transmits the packet if it has.

Definition at line 83 of file SendBuffer.c.

◆ fn_NetSim_DSR_DeleteEntryFromRouteCache()

int fn_NetSim_DSR_DeleteEntryFromRouteCache ( DSR_ROUTE_CACHE **  ppcache,
NETSIM_IPAddress  ip1,
NETSIM_IPAddress  ip2 
)

This function deletes an entry from the route cache.

Definition at line 95 of file RouteCache.c.

Here is the call graph for this function:

◆ fn_NetSim_DSR_EmptyMaintBuffer()

int fn_NetSim_DSR_EmptyMaintBuffer ( NETSIM_ID  nDeviceId,
NETSIM_ID  nextHop 
)

This function Empties the DSR Maintenance Buffer.

Definition at line 209 of file MaintBuffer.c.

◆ fn_NetSim_DSR_EmptySendBuffer()

void fn_NetSim_DSR_EmptySendBuffer ( NETSIM_IPAddress  targetAddress,
NETSIM_ID  nDeviceId 
)

This function Empties the send buffer.

Definition at line 56 of file SendBuffer.c.

Here is the call graph for this function:

◆ fn_NetSim_DSR_FillAddress()

unsigned int fn_NetSim_DSR_FillAddress ( DSR_SOURCE_ROUTE_OPTION srcOption,
DSR_ROUTE_CACHE cache,
NETSIM_IPAddress  src,
NETSIM_IPAddress  dest 
)
Here is the caller graph for this function:

◆ fn_NetSim_DSR_FindCache()

DSR_ROUTE_CACHE * fn_NetSim_DSR_FindCache ( DSR_DEVICE_VAR devVar,
NETSIM_IPAddress  address,
double  dTime 
)

This function searches the route cache for a route to the target from the device. If route is found, it returns the route.

Definition at line 50 of file RouteCache.c.

◆ fn_NetSim_DSR_Finish_F()

int fn_NetSim_DSR_Finish_F ( )
Here is the caller graph for this function:

◆ fn_NetSim_DSR_ForwardRREP()

int fn_NetSim_DSR_ForwardRREP ( )

This function checks if the current device is the last HOP. If it is, it drops the packet and no further forwarding is done.

Else, the RREP is forwarded to the Previous HOP

Definition at line 194 of file RouteReply.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fn_NetSim_DSR_FreePacket()

int fn_NetSim_DSR_FreePacket ( NetSim_PACKET packet)

This function is called by NetworkStack.dll, to free the TCP protocol.

Definition at line 202 of file DSR.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fn_NetSim_DSR_GeneralPacketProcessing()

int fn_NetSim_DSR_GeneralPacketProcessing ( NetSim_EVENTDETAILS pstruEventDetails)

This function is called in the Network Out Event for routing of the packet.

Whenever a packet is to be routed to a destination and the device route cache doesnt have a route to the target, the Packet is added to the Send buffer and a Route Discovery is iitiated.

If the Device route cache has a route to the target, then the packet is added to the Maintanence Buffer and the count of packets originated is incremented.

Definition at line 28 of file PacketProcessing.c.

Here is the call graph for this function:

◆ fn_NetSim_DSR_GenerateCtrlPacket()

NetSim_PACKET * fn_NetSim_DSR_GenerateCtrlPacket ( NETSIM_ID  src,
NETSIM_ID  dest,
NETSIM_ID  recv,
double  dTime,
DSR_CONTROL_PACKET  type 
)
Here is the caller graph for this function:

◆ fn_NetSim_DSR_GenerateRERR()

int fn_NetSim_DSR_GenerateRERR ( DSR_MAINT_BUFFER maintBuffer,
NetSim_EVENTDETAILS pstruEventDetails 
)

This function generates a route error packet.

Definition at line 33 of file RouteError.c.

Here is the call graph for this function:

◆ fn_NetSim_DSR_GenerateRREP()

int fn_NetSim_DSR_GenerateRREP ( NetSim_PACKET rreqPacket,
NetSim_EVENTDETAILS pstruEventDetails 
)

This function Generates a route reply to be sent to the source.

Definition at line 20 of file RouteReply.c.

Here is the call graph for this function:

◆ fn_NetSim_DSR_GenerateRREPUsingRouteCache()

bool fn_NetSim_DSR_GenerateRREPUsingRouteCache ( DSR_DEVICE_VAR devVar,
NetSim_PACKET rreqPacket,
double  dTime,
NetSim_EVENTDETAILS pstruEventDetails 
)

This functions generates a route reply if the route to destination is there in the route cache.

Definition at line 113 of file RouteReply.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fn_NetSim_DSR_GetBroadCastJitter()

double fn_NetSim_DSR_GetBroadCastJitter ( )
Here is the caller graph for this function:

◆ fn_NetSim_DSR_InitRouteRequest()

NetSim_PACKET * fn_NetSim_DSR_InitRouteRequest ( NETSIM_IPAddress  target,
DSR_RREQ_TABLE **  rreqTable,
NETSIM_ID  nDeviceId,
double  dTime,
NetSim_EVENTDETAILS pstruEventDetails 
)

This function initiates a route request to the target.

Definition at line 24 of file RouteRequest.c.

Here is the call graph for this function:

◆ fn_NetSim_DSR_LinkLayerAck()

int fn_NetSim_DSR_LinkLayerAck ( NetSim_PACKET )
Here is the caller graph for this function:

◆ fn_NetSim_DSR_MaintTimeout()

int fn_NetSim_DSR_MaintTimeout ( NetSim_EVENTDETAILS pstruEventDetails)

This is called when DSR Maintenance Timeout happens. It retransmits the packets if acknowledgemnet is not received and the transmit count is less the DSR MaxMaintenance Retransmit limit. Else it empties the buffer.

Definition at line 123 of file MaintBuffer.c.

◆ fn_NetSim_DSR_Process_AckRequestOption()

int fn_NetSim_DSR_Process_AckRequestOption ( NetSim_PACKET packet,
NetSim_EVENTDETAILS pstruEventDetails 
)

If a packet has an acknowledge request option, this function generates the acknowledge and transmits it.

Definition at line 49 of file Network_Layer_Ack.c.

Here is the call graph for this function:

◆ fn_NetSim_DSR_ProcessAckOption()

int fn_NetSim_DSR_ProcessAckOption ( NetSim_EVENTDETAILS pstruEventDetails)

Whenever an acknowlegement is received, the DSR Maintenance Buffer is Emptied.

Definition at line 94 of file Network_Layer_Ack.c.

◆ fn_NetSim_DSR_ProcessRerr()

int fn_NetSim_DSR_ProcessRerr ( NetSim_EVENTDETAILS pstruEventDetails)

This function process the route error that is received. It deletes the entry of the route to the target from the route cache and then forwards the Route error to the previous HOP.

Definition at line 97 of file RouteError.c.

Here is the call graph for this function:

◆ fn_NetSim_DSR_ProcessRREP()

int fn_NetSim_DSR_ProcessRREP ( NetSim_EVENTDETAILS pstruEventDetails)

This function processes the route reply. It Updates the route cache of the device and adds the new route to the destination in the route cache. It checks the Send Buffer if any packets are in the list to be sent. Then it forwards the RREP packet to the prev HOP.

Definition at line 81 of file RouteReply.c.

Here is the call graph for this function:

◆ fn_NetSim_DSR_ProcessRREQ()

int fn_NetSim_DSR_ProcessRREQ ( NetSim_EVENTDETAILS pstruEventDetails)

This function process the RREQ that a device gets. If the target address is the device, it generates a RREP. If the RREQ packet contains the device IP in its address list, it drops the packet. If the Device cache contains the route to the target, then the device replies via the route cache. If no route is present, then the device forwards the RREQ.

Definition at line 237 of file RouteRequest.c.

Here is the call graph for this function:

◆ fn_NetSim_DSR_ProcessSourceRouteOption()

int fn_NetSim_DSR_ProcessSourceRouteOption ( NetSim_EVENTDETAILS pstruEventDetails)

This function process the data packet. it the device is the intended target, it adds a Transport_In_Event. Else it adds Network_Out_Event

Definition at line 58 of file SourceRoute.c.

Here is the call graph for this function:

◆ fn_NetSim_DSR_RetransmitBuffer()

int fn_NetSim_DSR_RetransmitBuffer ( DSR_MAINT_BUFFER maintBuffer,
NetSim_EVENTDETAILS pstruEventDetails 
)

This function retransmits the packets in the DSR Maintanence Buffer.

Definition at line 174 of file MaintBuffer.c.

Here is the call graph for this function:

◆ fn_NetSim_DSR_RetryRREQ()

NetSim_PACKET * fn_NetSim_DSR_RetryRREQ ( NETSIM_IPAddress  targetAddress,
NETSIM_ID  nDeviceId,
double  dTime,
NetSim_EVENTDETAILS pstruEventDetails 
)

This function retransmits the RREQ packet.

Definition at line 126 of file RouteRequest.c.

Here is the call graph for this function:

◆ fn_NetSim_DSR_RREQTimeout()

int fn_NetSim_DSR_RREQTimeout ( NetSim_EVENTDETAILS pstruEventDetails)

This function checks if a route is present in the route cache. If not, then it retransmits the route request packet if the route request count is less than the DSR Max Retransmit limit. If the RREQ count is > Max Retransmit Limit, it Empties the Send Buffer and deletes the RREQ entry from the RREQ table.

Definition at line 87 of file RouteRequest.c.

Here is the call graph for this function:

◆ fn_NetSim_DSR_TransmitPacketFromSendBuffer()

int fn_NetSim_DSR_TransmitPacketFromSendBuffer ( DSR_SEND_BUFFER sendBuffer,
NETSIM_ID  nDeviceId,
double  dTime 
)

This function transmits the packets from sent buffer

Definition at line 120 of file SendBuffer.c.

Here is the call graph for this function:

◆ fn_NetSim_DSR_UpdateRouteCache()

int fn_NetSim_DSR_UpdateRouteCache ( unsigned int  length,
NETSIM_IPAddress address,
double  dTime 
)

This function adds a route to the route cache. This is the entire list of address from the device to the target in sequence

Definition at line 21 of file RouteCache.c.

Here is the call graph for this function:

◆ fn_NetSim_DSR_ValidateRouteCache()

bool fn_NetSim_DSR_ValidateRouteCache ( DSR_ROUTE_CACHE cache,
NETSIM_IPAddress addList,
int  count 
)

If the route cache contains the address in the addList, it returns a false.

Definition at line 78 of file RouteCache.c.

◆ getRREQTable()

DSR_RREQ_TABLE * getRREQTable ( NETSIM_IPAddress  target,
DSR_RREQ_TABLE table 
)

If a RREQ to a target is before hand generated, this entry is made in the RREQ Table. This function gets the RREQ table of the target IP if the RREQ was beforehand sent.

Definition at line 184 of file RouteRequest.c.

Here is the caller graph for this function:

◆ isDsrConfigured()

bool isDsrConfigured ( NETSIM_ID  d,
NETSIM_ID  in 
)
Here is the caller graph for this function:

◆ set_dsr_curr()

void set_dsr_curr ( )
Here is the caller graph for this function: