NetSim Source Code Help
Loading...
Searching...
No Matches
Protocol.h
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#ifndef _NETSIM_PROTOCOL_H_
15#define _NETSIM_PROTOCOL_H_
16#ifdef __cplusplus
17extern "C" {
18#endif
19# define MAX_NAME_CHAR 100
20# define MAX_CONTROL_PACKET 100
22{
25};
27{
61 nStaticProtocolCount, //Keep this at last
62};
63
65{
72};
73#ifndef _NETSIM_CODE_
76#else
77#ifndef _NETSIM_PROTOCOL_INTERFACE_CODE_
79extern UINT nProtocolCount;
80#else
83#endif
84#endif
86/*****************************************************************************
87 Common function for all protocol. These are the interface function present in
88 protocol dll by which stack interact with protocol.
89******************************************************************************/
90//Function Pointer for protocol main function
91typedef int (*protocol_run)(); //Function name must be fn_NetSim_[Protocol Name]_run
93//Function pointer for protocol initialization function
94typedef int (*protocol_init)(const struct stru_NetSim_Network*,const struct stru_NetSim_EventDetails*,const char*,const char*,int);
95protocol_init* fnpProtocol_Init; //Function name must be fn_NetSim_[Protocol Name]_init
96//Function pointer for event trace
97typedef char* (*protocol_trace)(int); //Function name must be fn_NetSim_[Protocol Name]_trace
99//Function pointer for copy packet
100typedef int (*protocol_CopyPacket)(const NetSim_PACKET* pstruDestPacket,const NetSim_PACKET* pstruSrcPacket);
101protocol_CopyPacket* fnpProtocol_CopyPacket; //Function name must be fn_NetSim_[Protocol Name]_CopyPacket
102//Function pointer for free packet
103typedef int (*protocol_FreePacket)(const NetSim_PACKET* pstruPacket);
104protocol_FreePacket* fnpProtocol_FreePacket; //Function name must be fn_NetSim_[Protocol Name]_FreePacket
105//Function pointer for metrics
106typedef int (*protocol_Metrics)(const char* szMetricsFile);
107protocol_Metrics* fnpProtocol_Metrics; //Function name must be fn_NetSim_[Protocol Name]_Metrics
108//Function pointer for finish
109typedef int (*protocol_Finish)();
110protocol_Finish* fnpProtocol_Finish; //Function name must be fn_NetSim_[Protocol Name]_Finish
111//Function pointer for configure
112typedef int (*protocol_Configure)(void**);
113protocol_Configure* fnpProtocol_Configure; //Function name must be fn_NetSim_[Protocol Name]_Configure
114//Function pointer to configure packet trace
115typedef char* (*protocol_ConfigPacketTrace)(const void* xmlNetSimNode);
116protocol_ConfigPacketTrace* fnpProtocol_ConfigPacketTrace; //Function name must be fn_NetSim_[Protocol Name]_ConfigPacketTrace
117//Function pointer to write packet trace
118typedef int (*protocol_WritePacketTrace)(const NetSim_PACKET*,char**);
119protocol_WritePacketTrace* fnpProtocol_WritePacketTrace; //Function name must be fn_NetSim_[Protocol Name]_WritePacketTrace
120
121_declspec(dllexport) int fnCallProtocol(int nProtocol);
122_declspec(dllexport) int fn_NetSim_LoadProtocolDll(int nId,const char* name,const char* dllName);
123_declspec(dllexport) void fn_NetSim_Stack_EnableProtocolDll(const char* protocolName);
124#ifdef __cplusplus
125}
126#endif
127#endif
128
129
#define UINT
Definition: Linux.h:38
#define HINSTANCE
Definition: Linux.h:47
#define _declspec(dllexport)
This function is used to trigger the update.
Definition: Linux.h:41
int fnCallProtocol(int nProtocol)
protocol_CopyPacket * fnpProtocol_CopyPacket
Definition: Protocol.h:101
void fn_NetSim_Stack_EnableProtocolDll(const char *protocolName)
int(* protocol_CopyPacket)(const NetSim_PACKET *pstruDestPacket, const NetSim_PACKET *pstruSrcPacket)
Definition: Protocol.h:100
protocol_WritePacketTrace * fnpProtocol_WritePacketTrace
Definition: Protocol.h:119
dll_id
Definition: Protocol.h:27
@ libWSMP
Definition: Protocol.h:53
@ libCSMACD
Definition: Protocol.h:50
@ libLTE
Definition: Protocol.h:44
@ libRTP
Definition: Protocol.h:60
@ libCDMA
Definition: Protocol.h:39
@ libARP
Definition: Protocol.h:40
@ libEthernet
Definition: Protocol.h:36
@ libIP
Definition: Protocol.h:29
@ libAloha
Definition: Protocol.h:49
@ libUWAN
Definition: Protocol.h:57
@ libLTE_NR
Definition: Protocol.h:58
@ libSDN
Definition: Protocol.h:56
@ libApplication
Definition: Protocol.h:43
@ libTCP
Definition: Protocol.h:28
@ libDSR
Definition: Protocol.h:33
@ libRPL
Definition: Protocol.h:54
@ libGSM
Definition: Protocol.h:38
@ libMobility
Definition: Protocol.h:42
@ libToken_BR
Definition: Protocol.h:51
@ libZigbee
Definition: Protocol.h:37
@ libOSPF
Definition: Protocol.h:32
@ libP2P
Definition: Protocol.h:55
@ libWLAN
Definition: Protocol.h:35
@ libDTDMA
Definition: Protocol.h:46
@ libSATELLITE
Definition: Protocol.h:59
@ libZRP
Definition: Protocol.h:47
@ libCR
Definition: Protocol.h:41
@ libOLSR
Definition: Protocol.h:48
@ libTDMA
Definition: Protocol.h:45
@ libVanet
Definition: Protocol.h:52
@ libAODV
Definition: Protocol.h:34
@ libUDP
Definition: Protocol.h:30
@ libRIP
Definition: Protocol.h:31
@ nStaticProtocolCount
Definition: Protocol.h:61
#define MAX_NAME_CHAR
Definition: Protocol.h:19
int(* protocol_init)(const struct stru_NetSim_Network *, const struct stru_NetSim_EventDetails *, const char *, const char *, int)
Definition: Protocol.h:94
int(* protocol_run)()
Definition: Protocol.h:91
int(* protocol_FreePacket)(const NetSim_PACKET *pstruPacket)
Definition: Protocol.h:103
char *(* protocol_ConfigPacketTrace)(const void *xmlNetSimNode)
Definition: Protocol.h:115
protocol_Finish * fnpProtocol_Finish
Definition: Protocol.h:110
protocol_ConfigPacketTrace * fnpProtocol_ConfigPacketTrace
Definition: Protocol.h:116
int(* protocol_Configure)(void **)
Definition: Protocol.h:112
protocol_run * fnpProtocol_Run
Definition: Protocol.h:92
struct stru_ProtocolInfo * pstruProtocolInfo
Definition: Protocol.h:74
enum_isConfigured
Definition: Protocol.h:22
@ ENABLE
Definition: Protocol.h:24
@ DISABLE
Definition: Protocol.h:23
int(* protocol_Finish)()
Definition: Protocol.h:109
protocol_FreePacket * fnpProtocol_FreePacket
Definition: Protocol.h:104
protocol_trace * fnpProtocol_Trace
Definition: Protocol.h:98
int fn_NetSim_LoadProtocolDll(int nId, const char *name, const char *dllName)
protocol_init * fnpProtocol_Init
Definition: Protocol.h:95
UINT nProtocolCount
Definition: Protocol.h:75
HINSTANCE * hProtocolDll
Definition: Protocol.h:85
char *(* protocol_trace)(int)
Definition: Protocol.h:97
protocol_Metrics * fnpProtocol_Metrics
Definition: Protocol.h:107
int(* protocol_WritePacketTrace)(const NetSim_PACKET *, char **)
Definition: Protocol.h:118
int(* protocol_Metrics)(const char *szMetricsFile)
Definition: Protocol.h:106
protocol_Configure * fnpProtocol_Configure
Definition: Protocol.h:113
#define MAX_CONTROL_PACKET
Definition: Protocol.h:20
enum enum_isConfigured ISCONFIGURED
Definition: main.h:145
char protocolName[MAX_NAME_CHAR]
Definition: Protocol.h:68
char pszControlPacketName[MAX_CONTROL_PACKET][MAX_NAME_CHAR]
Definition: Protocol.h:71
ISCONFIGURED status
Definition: Protocol.h:70
char dllName[MAX_NAME_CHAR]
Definition: Protocol.h:67