NetSim Source Code Help v14.4
All 13 Components
 
Loading...
Searching...
No Matches
ZRP.h
1/************************************************************************************
2 * Copyright (C) 2023 *
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
16/************************************************************************************
17http://tools.ietf.org/html/draft-ietf-manet-zone-zrp-04
18************************************************************************************/
19#pragma once
20#include "OLSR.h"
21#include "BRP.h"
22#include "IERP.h"
23#ifndef _NETSIM_ZRP_H_
24#define _NETSIM_ZRP_H_
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29FILE* fpRMlog;
30char MPR_Log_filename[BUFSIZ];
31//MPR Log
32void write_MPR_log(OLSR_MPR_SET* mprSet, OLSR_NEIGHBOR_SET* neighborset, OLSR_2HOP_NEIGHBOR_SET* twohopneighborset);
33static void init_MPR_log();
34static void close_MPR_log();
35
36#pragma region GUI_PROTOCOL_LOG_READER
37bool get_protocol_log_status(char* logname);
38#pragma endregion
39
40//Include necessary lib's
41#pragma comment(lib,"NetworkStack.lib")
42
43#define ZRP_IARP_PROTOCOL_DEFAULT _strdup("OLSR");
44#define ZRP_ZONE_RADIUS_DEFAULT 2
45
46// API
47#define flushZone(zrp) {while(zrp->zone) LIST_FREE((void**)&zrp->zone,zrp->zone);}
48
49 typedef struct stru_Node_ZRP NODE_ZRP;
50 typedef struct stru_Zone ZRP_ZONE;
51
52 typedef enum
53 {
54 IERP_ROUTE_REQUEST=NW_PROTOCOL_ZRP*100,
55 IERP_ROUTE_REPLY,
56
57 IERP_ROUTE_REQUEST_WITH_BRP_HEADER,
58 IERP_ROUTE_REPLY_WITH_BRP_HEADER,
59 }ZRP_CONTROL_PACKET;
60#define BRP_DIFF IERP_ROUTE_REQUEST_WITH_BRP_HEADER-IERP_ROUTE_REQUEST
61 struct stru_Zone
62 {
63 NETSIM_IPAddress zoneNodeIP;
64 _ele* ele;
65 };
66#define ZRP_ZONE_ALLOC() (struct stru_Zone*)list_alloc(sizeof(struct stru_Zone),offsetof(struct stru_Zone,ele))
67
69 {
70 NETWORK_LAYER_PROTOCOL iarpProtocol;
71 unsigned int nZoneRadius;
72 ZRP_ZONE* zone;
73 void* iarp;
74 void* ierp;
75 void* brp;
76 };
77
78 //Function prototype
79 NetSim_PACKET* fn_NetSim_ZRP_GeneratePacket(double dTime,
80 unsigned int nPacketType,
81 NETWORK_LAYER_PROTOCOL protocol,
82 NETSIM_ID nSource,
83 NETSIM_ID nDestination,
84 double dPacketSize);
85 int fn_NetSim_ZRP_Configure_F(void** var);
86 int fn_NetSim_ZRP_FreePacket_F(NetSim_PACKET* packet);
87 int fn_NetSim_ZRP_CopyPacket_F(const NetSim_PACKET* destPacket,const NetSim_PACKET* srcPacket);
88 char* fn_NetSim_ZRP_Trace_F(NETSIM_ID id);
89 int fn_NetSim_ZRP_Finish_F();
90 int fn_NetSim_ZRP_Init_F();
91 int addToZoneList(NODE_ZRP* zrp,NETSIM_IPAddress ip);
92
93#ifdef __cplusplus
94}
95#endif
96#endif