NetSim Source Code Help
Loading...
Searching...
No Matches
IEEE802_11.c
Go to the documentation of this file.
1/************************************************************************************
2* Copyright (C) 2021 *
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* This source code is licensed per the NetSim license agreement. *
12* *
13* No portion of this source code may be used as the basis for a derivative work, *
14* or used, for any purpose other than its intended use per the NetSim license *
15* agreement. *
16* *
17* This source code and the algorithms contained within it are confidential trade *
18* secrets of TETCOS and may not be used as the basis for any other software, *
19* hardware, product or service. *
20* *
21* Author: Shashi Kant Suman *
22* *
23* ----------------------------------------------------------------------------------*/
24#include "main.h"
25#include "IEEE802_11.h"
26#include "IEEE802_11_Phy.h"
27
28//Function prototype
34 int nVersion_Type);
36void print_minstrel_table(PMETRICSWRITER metricsWriter);
37
38_declspec(dllexport) int fn_NetSim_IEEE802_11_Configure(void** var)
39{
41}
42
43_declspec(dllexport) int fn_NetSim_IEEE802_11_Init(struct stru_NetSim_Network *NETWORK_Formal,
47 int nVersion_Type)
48{
49 return fn_NetSim_IEEE802_11_Init_F(NETWORK_Formal,
53}
54
56{
58 {
59 case MAC_OUT_EVENT:
61 break;
62 case MAC_IN_EVENT:
64 break;
67 break;
70 break;
71 case TIMER_EVENT:
73 break;
74 default:
75 fnNetSimError("Unknown event type %d for IEEE802.11 protocol",pstruEventDetails->nEventType);
76 break;
77 }
78 return 0;
79}
80
81/**
82This function is called by NetworkStack.dll, while writing the event trace
83to get the sub event as a string.
84*/
85_declspec(dllexport) char* fn_NetSim_IEEE802_11_Trace(int nSubEvent)
86{
87 return GetStringIEEE802_11_Subevent(nSubEvent);
88}
89
90/**
91This function is called by NetworkStack.dll, to free the WLAN protocol
92pstruMacData->Packet_MACProtocol.
93*/
95{
96 ieee802_11_free_hdr(pstruPacket);
97 free_ieee802_11_phy_header(pstruPacket);
98 return 0;
99}
100
101/**
102This function is called by NetworkStack.dll, to copy the WLAN protocol
103pstruMacData->Packet_MACProtocol from source packet to destination.
104*/
105_declspec(dllexport) int fn_NetSim_IEEE802_11_CopyPacket(NetSim_PACKET* pstruDestPacket,NetSim_PACKET* pstruSrcPacket)
106{
107 ieee802_11_hdr_copy(pstruDestPacket,pstruSrcPacket);
108 copy_ieee802_11_phy_header(pstruDestPacket, pstruSrcPacket);
109 return 0;
110}
111
112/**
113This function call WLAN Metrics function in lib file to write the Metrics in Metrics.txt
114*/
116{
117 fn_NetSim_IEEE802_11_Metrics_F(metricsWriter);
118 print_minstrel_table(metricsWriter);
119 return 0;
120}
121
122/**
123This function is to configure the WLAN protocol packet trace parameter.
124This function return a string which has the parameters separated by comma.
125*/
126_declspec(dllexport) char* fn_NetSim_IEEE802_11_ConfigPacketTrace(const void* xmlNetSimNode)
127{
128 xmlNetSimNode;
129 return "";
130}
131
132/**
133This function is called while writing the Packet trace for WLAN protocol.
134This function is called for every packet while writing the packet trace.
135*/
136_declspec(dllexport) int fn_NetSim_IEEE802_11_WritePacketTrace(NetSim_PACKET* pstruPacket, char** ppszTrace)
137{
138 pstruPacket;
139 ppszTrace;
140 return 1;
141}
142
143/**
144This function is called by NetworkStack.dll, once simulation end to free the
145allocated memory for the network.
146*/
148{
150}
151
153{
155 {
156 case ACK_TIMEOUT:
158 break;
159 case CTS_TIMEOUT:
161 break;
162 default:
163 fnNetSimError("Unknown Timer event-%d subevent for IEEE802.11 protocol in %s\n",
165 __FUNCTION__);
166 }
167}
168
170{
171#ifdef IEEE802_11_LOG
172 return true;
173#else
174 return false;
175#endif
176}
177
179{
180#ifdef IEEE802_11_BACKOFF_LOG
181 return true;
182#else
183 return false;
184#endif
185}
186
void fn_NetSim_IEEE802_11_CSMA_AckTimeOut()
Definition: CSMACA.c:584
int fn_NetSim_IEEE802_11_FreePacket(NetSim_PACKET *pstruPacket)
Definition: IEEE802_11.c:94
int fn_NetSim_IEEE802_11_Configure_F(void **var)
int fn_NetSim_IEEE802_11_CopyPacket(NetSim_PACKET *pstruDestPacket, NetSim_PACKET *pstruSrcPacket)
Definition: IEEE802_11.c:105
int fn_NetSim_IEEE802_11_Metrics_F(PMETRICSWRITER metricsWriter)
void print_minstrel_table(PMETRICSWRITER metricsWriter)
Definition: Minstrel.c:775
int fn_NetSim_IEEE802_11_Metrics(PMETRICSWRITER metricsWriter)
Definition: IEEE802_11.c:115
bool isIEEE802_11_log()
Definition: IEEE802_11.c:169
int fn_NetSim_IEEE802_11_Init(struct stru_NetSim_Network *NETWORK_Formal, NetSim_EVENTDETAILS *pstruEventDetails_Formal, char *pszAppPath_Formal, char *pszWritePath_Formal, int nVersion_Type)
Definition: IEEE802_11.c:43
int fn_NetSim_IEEE802_11_Finish()
Definition: IEEE802_11.c:147
int fn_NetSim_IEEE802_11_Run()
Definition: IEEE802_11.c:55
int fn_NetSim_IEEE802_11_WritePacketTrace(NetSim_PACKET *pstruPacket, char **ppszTrace)
Definition: IEEE802_11.c:136
char * fn_NetSim_IEEE802_11_ConfigPacketTrace(const void *xmlNetSimNode)
Definition: IEEE802_11.c:126
void fn_NetSim_IEEE802_11_Timer()
Definition: IEEE802_11.c:152
char * fn_NetSim_IEEE802_11_Trace(int nSubEvent)
Definition: IEEE802_11.c:85
int fn_NetSim_IEEE802_11_Configure(void **var)
Definition: IEEE802_11.c:38
int fn_NetSim_IEEE802_11_Init_F(struct stru_NetSim_Network *NETWORK_Formal, NetSim_EVENTDETAILS *pstruEventDetails_Formal, char *pszAppPath_Formal, char *pszWritePath_Formal, int nVersion_Type)
bool isieee802_11_Backoff_log()
Definition: IEEE802_11.c:178
void fn_NetSim_IEEE802_11_MacOut()
void ieee802_11_hdr_copy(NetSim_PACKET *src, NetSim_PACKET *dest)
int fn_NetSim_IEEE802_11_Finish_F()
void fn_NetSim_IEEE802_11_RTS_CTS_CTSTimeOut()
Definition: RTS_CTS.c:191
int fn_NetSim_IEEE802_11_MacIn()
void ieee802_11_free_hdr(NetSim_PACKET *packet)
int fn_NetSim_IEEE802_11_PhyOut()
int fn_NetSim_IEEE802_11_PhyIn()
void free_ieee802_11_phy_header(NetSim_PACKET *packet)
void copy_ieee802_11_phy_header(NetSim_PACKET *d, NetSim_PACKET *s)
#define _declspec(dllexport)
This function is used to trigger the update.
Definition: Linux.h:41
#define fnNetSimError(x,...)
Definition: Linux.h:56
void * PMETRICSWRITER
Definition: MetricsWriter.h:27
NetSim_EVENTDETAILS * pstruEventDetails_Formal
Definition: RIP.h:178
NetSim_EVENTDETAILS char * pszAppPath_Formal
Definition: RIP.h:178
NetSim_EVENTDETAILS char char int nVersion_Type
Definition: RIP.h:178
NetSim_EVENTDETAILS char char * pszWritePath_Formal
Definition: RIP.h:178
@ TIMER_EVENT
Definition: Stack.h:114
@ PHYSICAL_OUT_EVENT
Definition: Stack.h:104
@ MAC_OUT_EVENT
Definition: Stack.h:106
@ MAC_IN_EVENT
Definition: Stack.h:107
@ PHYSICAL_IN_EVENT
Definition: Stack.h:105
EXPORTED struct stru_NetSim_EventDetails * pstruEventDetails
Definition: Stack.h:837
EVENT_TYPE nEventType
Definition: Stack.h:747
NETSIM_ID nSubEventType
Definition: Stack.h:757