NetSim Source Code Help v14.4
All 13 Components
 
Loading...
Searching...
No Matches
Protocol.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#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
21enum enum_isConfigured
22{
23 DISABLE=0,
24 ENABLE=1,
25};
26enum dll_id
27{
28 libTCP=0,
29 libIP,
30 libUDP,
31 libRIP,
32 libOSPF,
33 libDSR,
34 libAODV,
35 libWLAN,
36 libEthernet,
37 libZigbee,
38 libGSM,
39 libCDMA,
40 libARP,
41 libCR,
42 libMobility,
43 libApplication,
44 libLTE,
45 libTDMA,
46 libDTDMA,
47 libZRP,
48 libOLSR,
49 libAloha,
50 libCSMACD,
51 libToken_BR,
52 libVanet,
53 libWSMP,
54 libRPL,
55 libP2P,
56 libSDN,
57 libUWAN,
58 libLTE_NR,
59 libSATELLITE,
60 libRTP,
61 nStaticProtocolCount, //Keep this at last
62};
63
65{
66 int nComponentId;
67 char dllName[MAX_NAME_CHAR];
68 char protocolName[MAX_NAME_CHAR];
69 int protocolId;
70 ISCONFIGURED status;
71 char pszControlPacketName[MAX_CONTROL_PACKET][MAX_NAME_CHAR];
72};
73#ifndef _NETSIM_CODE_
74_declspec(dllimport) struct stru_ProtocolInfo* pstruProtocolInfo;
75_declspec(dllimport) UINT nProtocolCount;
76#else
77#ifndef _NETSIM_PROTOCOL_INTERFACE_CODE_
78extern struct stru_ProtocolInfo* pstruProtocolInfo;
79extern UINT nProtocolCount;
80#else
81_declspec(dllexport) UINT nProtocolCount;
82_declspec(dllexport) struct stru_ProtocolInfo* pstruProtocolInfo;
83#endif
84#endif
85HINSTANCE* hProtocolDll;
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
92protocol_run* fnpProtocol_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
98protocol_trace* fnpProtocol_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