NetSim Source Code Help
Loading...
Searching...
No Matches
main.h File Reference
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <errno.h>
#include <stdint.h>
#include <stdbool.h>
#include <direct.h>
#include <malloc.h>
#include <assert.h>
#include <dlfcn.h>
#include "Linux.h"
#include "Memory.h"
#include "IP_Addressing.h"
#include "Stack.h"
#include "Packet.h"
#include "MetricsWriter.h"
Include dependency graph for main.h:

Go to the source code of this file.

Macros

#define _CRT_SECURE_NO_DEPRECATE
 
#define _CRT_SECURE_NO_WARNINGS
 
#define _LICENSE_CHECK
 
#define _NETSIM_MEMORY_LEAK_TEST_
 
#define _CRTDBG_MAP_ALLOC
 
#define _NETSIM_MAIN_H_
 
#define HINSTANCE   void*
 
#define VERSION   132
 
#define __CALLBACK__
 
#define __IN__
 
#define __OUT__
 
#define fn_NetSim_LoadAppDllFunction(hsharedlib, path, sharedlibName, funName)   fn_NetSim_LoadAppDllFunction_dbg(hsharedlib,path,sharedlibName,funName,__LINE__,__FILE__);
 
#define fn_NetSim_Utilities_LoadSharedlibFunction(hsharedlib, sharedlibName, funName)   fn_NetSim_Utilities_LoadSharedlibFunction_dbg(hsharedlib,sharedlibName,funName,__LINE__,__FILE__)
 
#define fn_NetSim_Packet_FreePacket(pstruPacket)   fn_NetSim_Packet_FreePacket_dbg(&(pstruPacket),__LINE__,__FILE__)
 
#define fn_NetSim_Packet_AddPacketToList(pstruBuffer, pstruPacket, nInsertionType)   fn_NetSim_Packet_AddPacketToList_dbg(pstruBuffer,pstruPacket,nInsertionType /* 1- head,2-Tail,3-Order of event time*/,__LINE__,__FILE__)
 
#define fn_NetSim_Packet_CopyPacket(pstruPacket)   fn_NetSim_Packet_CopyPacket_dbg(pstruPacket,__LINE__,__FILE__)
 
#define fn_NetSim_Packet_CopyPacketList(pstruPacket)   fn_NetSim_Packet_CopyPacketList_dbg(pstruPacket,__LINE__,__FILE__)
 
#define fn_NetSim_Packet_CreatePacket(layer)   fn_NetSim_Packet_CreatePacket_dbg(layer,__LINE__,__FILE__)
 
#define fn_NetSim_WritePacketTrace(pstruPacket)   fn_NetSim_WritePacketTrace_dbg(pstruPacket,__LINE__,__FILE__)
 
#define fnpAddEvent(pstruEvent)   fnAddEvent_F(pstruEvent,__LINE__,__FILE__)
 
#define ANSI_COLOR_RED   "\x1b[31m"
 
#define ANSI_COLOR_GREEN   "\x1b[32m"
 
#define ANSI_COLOR_YELLOW   "\x1b[33m"
 
#define ANSI_COLOR_BLUE   "\x1b[34m"
 
#define ANSI_COLOR_MAGENTA   "\x1b[35m"
 
#define ANSI_COLOR_CYAN   "\x1b[36m"
 
#define ANSI_COLOR_RESET   "\x1b[0m"
 
#define ANSI_BOLD_TEXT   "\x1b[1m"
 

Typedefs

typedef struct stru_NetSim_SimulationParameter SIMULATIONPARAMETER
 
typedef struct stru_NetSim_Device NetSim_DEVICE
 
typedef struct stru_NetSim_DeviceptrNetSim_DEVICE
 
typedef struct stru_NetSim_Interface NetSIm_DEVICEINTERFACE
 
typedef struct stru_NetSim_InterfaceptrNetSim_DEVICEINTERFACE
 
typedef struct stru_NetSim_ApplicationLayer NetSim_APPLICATIONLAYER
 
typedef struct stru_NetSim_SocketInterface NetSim_SOCKETINTERFACE
 
typedef struct stru_NetSim_TransportLayer NetSim_TRANSPORTLAYER
 
typedef struct stru_NetSim_Coordinates NetSim_COORDINATES
 
typedef struct stru_NetSim_NetworkLayer NetSim_NETWORKLAYER
 
typedef struct stru_NetSim_MAC_NW_Interface NetSim_MAC_NW_INTERFACE
 
typedef struct stru_NetSim_MacLayer NetSim_MACLAYER
 
typedef struct stru_NetSim_PhysicalLayer NetSim_PHYSICALLAYER
 
typedef struct stru_ApplicationInformation NetSim_APPLICATIONINFO
 
typedef struct stru_NetSim_Device_Buffer NetSim_BUFFER
 
typedef struct stru_NetSim_Packet NetSim_PACKET
 
typedef struct stru_NetSim_Packet_PhyLayer NetSim_PACKET_PHYLAYER
 
typedef struct stru_NetSim_Packet_MACLayer NetSim_PACKET_MACLAYER
 
typedef struct stru_NetSim_Packet_NetworkLayer NetSim_PACKET_NETWORKLAYER
 
typedef struct stru_NetSim_Packet_TransportLayer NetSim_PACKET_TRANSPORTLAYER
 
typedef struct stru_NetSim_Packet_AppLayer NetSim_PACKET_APPLAYER
 
typedef struct stru_NetSim_EventDetails NetSim_EVENTDETAILS
 
typedef struct stru_NetSim_Links NetSim_LINKS
 
typedef enum enum_Distribution DISTRIBUTION
 
typedef enum enum_PacketType PACKET_TYPE
 
typedef enum enum_SuppressionModel SUPPRESSION_MODEL
 
typedef enum enum_ServiceType SERVICE_TYPE
 
typedef enum enum_PacketPriority PACKET_PRIORITY
 
typedef enum enum_Packet_QOS QUALITY_OF_SERVICE
 
typedef enum enum_PacketStatus PACKET_STATUS
 
typedef enum enum_Segment PACKET_FRAGMENT
 
typedef enum enum_EventType EVENT_TYPE
 
typedef enum enum_AppProtocol APPLICATION_LAYER_PROTOCOL
 
typedef enum enum_TrxProtocol TRANSPORT_LAYER_PROTOCOL
 
typedef enum enum_NWProtocol NETWORK_LAYER_PROTOCOL
 
typedef enum enum_MACProtocol MAC_LAYER_PROTOCOL
 
typedef enum enum_PhyMedium PHYSICAL_LAYER_MEDIUM
 
typedef enum enum_LayerType LAYER_TYPE
 
typedef enum enum_InterfaceType INTERFACE_TYPE
 
typedef enum enum_DeviceType netsimDEVICE_TYPE
 
typedef enum enum_LinkType LINK_TYPE
 
typedef enum enum_LinkMode LINK_MODE
 
typedef enum enum_LinkState LINK_STATE
 
typedef enum enum_SimulationEndType SIMULATION_END_TYPE
 
typedef enum enum_SchedulingType SCHEDULING_TYPE
 
typedef enum enum_TransmissionType TRANSMISSION_TYPE
 
typedef enum enum_isConfigured ISCONFIGURED
 
typedef enum emum_wireshark_option WIRESHARK_OPTION
 
typedef unsigned int NETSIM_ID
 
typedef char * NETSIM_Name
 
typedef char * string
 
typedef enum enum_Flag FLAG
 

Enumerations

enum  NETSIM_VERSIONTYPE {
  NETSIM_PRO =VERSION*10+5 , NETSIM_STANDARD =VERSION*10+4 , NETSIM_ACEDEMIC =VERSION*10+3 , NETSIM_DEMO =VERSION*10+2 ,
  NETSIM_COMER =VERSION*10+1
}
 

Functions

FARPROC fn_NetSim_LoadAppDllFunction_dbg (HINSTANCE *hdll, const char *path, const char *dllName, const char *funName, int line, char *file)
 
FARPROC fn_NetSim_Utilities_LoadSharedlibFunction_dbg (HINSTANCE *hsharedlib, const char *sharedlibName, const char *funName, int line, const char *file)
 
int ReportError (bool isStopOnError, const char *msg, int line, const char *file, int flag,...)
 
int fn_NetSim_Packet_AddPacketToList_dbg (NetSim_BUFFER *pstruBuffer, NetSim_PACKET *pstruPacket, int nInsertionType, int line, const char *file)
 
unsigned long long int fnAddEvent_F (struct stru_NetSim_EventDetails *pstruEvent, int line, const char *file)
 
bool fn_NetSim_Stack_RegisterCallBackFunction (int nSubeventId, int(*_fnCallBack)())
 
int fn_NetSim_Anim_MoveNode (NETSIM_ID src, double x, double y, double time)
 
bool CHECK_FOR_USER_DLL (const char *dllName)
 

Variables

static const char libext [] = ".so"
 

Macro Definition Documentation

◆ __CALLBACK__

#define __CALLBACK__

Definition at line 87 of file main.h.

◆ __IN__

#define __IN__

Definition at line 88 of file main.h.

◆ __OUT__

#define __OUT__

Definition at line 89 of file main.h.

◆ _CRT_SECURE_NO_DEPRECATE

#define _CRT_SECURE_NO_DEPRECATE

Definition at line 19 of file main.h.

◆ _CRT_SECURE_NO_WARNINGS

#define _CRT_SECURE_NO_WARNINGS

Definition at line 22 of file main.h.

◆ _CRTDBG_MAP_ALLOC

#define _CRTDBG_MAP_ALLOC

Definition at line 31 of file main.h.

◆ _LICENSE_CHECK

#define _LICENSE_CHECK

Definition at line 24 of file main.h.

◆ _NETSIM_MAIN_H_

#define _NETSIM_MAIN_H_

Definition at line 54 of file main.h.

◆ _NETSIM_MEMORY_LEAK_TEST_

#define _NETSIM_MEMORY_LEAK_TEST_

Definition at line 30 of file main.h.

◆ ANSI_BOLD_TEXT

#define ANSI_BOLD_TEXT   "\x1b[1m"

Definition at line 208 of file main.h.

◆ ANSI_COLOR_BLUE

#define ANSI_COLOR_BLUE   "\x1b[34m"

Definition at line 203 of file main.h.

◆ ANSI_COLOR_CYAN

#define ANSI_COLOR_CYAN   "\x1b[36m"

Definition at line 205 of file main.h.

◆ ANSI_COLOR_GREEN

#define ANSI_COLOR_GREEN   "\x1b[32m"

Definition at line 201 of file main.h.

◆ ANSI_COLOR_MAGENTA

#define ANSI_COLOR_MAGENTA   "\x1b[35m"

Definition at line 204 of file main.h.

◆ ANSI_COLOR_RED

#define ANSI_COLOR_RED   "\x1b[31m"

Definition at line 200 of file main.h.

◆ ANSI_COLOR_RESET

#define ANSI_COLOR_RESET   "\x1b[0m"

Definition at line 206 of file main.h.

◆ ANSI_COLOR_YELLOW

#define ANSI_COLOR_YELLOW   "\x1b[33m"

Definition at line 202 of file main.h.

◆ fn_NetSim_LoadAppDllFunction

#define fn_NetSim_LoadAppDllFunction (   hsharedlib,
  path,
  sharedlibName,
  funName 
)    fn_NetSim_LoadAppDllFunction_dbg(hsharedlib,path,sharedlibName,funName,__LINE__,__FILE__);

Definition at line 169 of file main.h.

◆ fn_NetSim_Packet_AddPacketToList

#define fn_NetSim_Packet_AddPacketToList (   pstruBuffer,
  pstruPacket,
  nInsertionType 
)    fn_NetSim_Packet_AddPacketToList_dbg(pstruBuffer,pstruPacket,nInsertionType /* 1- head,2-Tail,3-Order of event time*/,__LINE__,__FILE__)

Definition at line 179 of file main.h.

◆ fn_NetSim_Packet_CopyPacket

#define fn_NetSim_Packet_CopyPacket (   pstruPacket)    fn_NetSim_Packet_CopyPacket_dbg(pstruPacket,__LINE__,__FILE__)

Definition at line 182 of file main.h.

◆ fn_NetSim_Packet_CopyPacketList

#define fn_NetSim_Packet_CopyPacketList (   pstruPacket)    fn_NetSim_Packet_CopyPacketList_dbg(pstruPacket,__LINE__,__FILE__)

Definition at line 184 of file main.h.

◆ fn_NetSim_Packet_CreatePacket

#define fn_NetSim_Packet_CreatePacket (   layer)    fn_NetSim_Packet_CreatePacket_dbg(layer,__LINE__,__FILE__)

Definition at line 186 of file main.h.

◆ fn_NetSim_Packet_FreePacket

#define fn_NetSim_Packet_FreePacket (   pstruPacket)    fn_NetSim_Packet_FreePacket_dbg(&(pstruPacket),__LINE__,__FILE__)

Definition at line 177 of file main.h.

◆ fn_NetSim_Utilities_LoadSharedlibFunction

#define fn_NetSim_Utilities_LoadSharedlibFunction (   hsharedlib,
  sharedlibName,
  funName 
)    fn_NetSim_Utilities_LoadSharedlibFunction_dbg(hsharedlib,sharedlibName,funName,__LINE__,__FILE__)

Definition at line 172 of file main.h.

◆ fn_NetSim_WritePacketTrace

#define fn_NetSim_WritePacketTrace (   pstruPacket)    fn_NetSim_WritePacketTrace_dbg(pstruPacket,__LINE__,__FILE__)

Definition at line 188 of file main.h.

◆ fnpAddEvent

#define fnpAddEvent (   pstruEvent)    fnAddEvent_F(pstruEvent,__LINE__,__FILE__)

Definition at line 191 of file main.h.

◆ HINSTANCE

#define HINSTANCE   void*

Definition at line 76 of file main.h.

◆ VERSION

#define VERSION   132

Definition at line 84 of file main.h.

Typedef Documentation

◆ APPLICATION_LAYER_PROTOCOL

Definition at line 131 of file main.h.

◆ DISTRIBUTION

Definition at line 122 of file main.h.

◆ EVENT_TYPE

typedef enum enum_EventType EVENT_TYPE

Definition at line 130 of file main.h.

◆ FLAG

typedef enum enum_Flag FLAG

Definition at line 154 of file main.h.

◆ INTERFACE_TYPE

Definition at line 137 of file main.h.

◆ ISCONFIGURED

Definition at line 145 of file main.h.

◆ LAYER_TYPE

typedef enum enum_LayerType LAYER_TYPE

Definition at line 136 of file main.h.

◆ LINK_MODE

typedef enum enum_LinkMode LINK_MODE

Definition at line 140 of file main.h.

◆ LINK_STATE

typedef enum enum_LinkState LINK_STATE

Definition at line 141 of file main.h.

◆ LINK_TYPE

typedef enum enum_LinkType LINK_TYPE

Definition at line 139 of file main.h.

◆ MAC_LAYER_PROTOCOL

Definition at line 134 of file main.h.

◆ NetSim_APPLICATIONINFO

typedef struct stru_ApplicationInformation NetSim_APPLICATIONINFO

Definition at line 110 of file main.h.

◆ NetSim_APPLICATIONLAYER

Definition at line 102 of file main.h.

◆ NetSim_BUFFER

Definition at line 111 of file main.h.

◆ NetSim_COORDINATES

Definition at line 105 of file main.h.

◆ NetSim_DEVICE

Definition at line 100 of file main.h.

◆ NetSIm_DEVICEINTERFACE

Definition at line 101 of file main.h.

◆ NetSim_EVENTDETAILS

Definition at line 118 of file main.h.

◆ NETSIM_ID

typedef unsigned int NETSIM_ID

Definition at line 150 of file main.h.

◆ NetSim_LINKS

Definition at line 119 of file main.h.

◆ NetSim_MAC_NW_INTERFACE

typedef struct stru_NetSim_MAC_NW_Interface NetSim_MAC_NW_INTERFACE

Definition at line 107 of file main.h.

◆ NetSim_MACLAYER

Definition at line 108 of file main.h.

◆ NETSIM_Name

typedef char* NETSIM_Name

Definition at line 152 of file main.h.

◆ NetSim_NETWORKLAYER

Definition at line 106 of file main.h.

◆ NetSim_PACKET

Definition at line 112 of file main.h.

◆ NetSim_PACKET_APPLAYER

Definition at line 117 of file main.h.

◆ NetSim_PACKET_MACLAYER

Definition at line 114 of file main.h.

◆ NetSim_PACKET_NETWORKLAYER

Definition at line 115 of file main.h.

◆ NetSim_PACKET_PHYLAYER

Definition at line 113 of file main.h.

◆ NetSim_PACKET_TRANSPORTLAYER

Definition at line 116 of file main.h.

◆ NetSim_PHYSICALLAYER

Definition at line 109 of file main.h.

◆ NetSim_SOCKETINTERFACE

Definition at line 103 of file main.h.

◆ NetSim_TRANSPORTLAYER

Definition at line 104 of file main.h.

◆ netsimDEVICE_TYPE

Definition at line 138 of file main.h.

◆ NETWORK_LAYER_PROTOCOL

Definition at line 133 of file main.h.

◆ PACKET_FRAGMENT

Definition at line 129 of file main.h.

◆ PACKET_PRIORITY

Definition at line 126 of file main.h.

◆ PACKET_STATUS

Definition at line 128 of file main.h.

◆ PACKET_TYPE

Definition at line 123 of file main.h.

◆ PHYSICAL_LAYER_MEDIUM

Definition at line 135 of file main.h.

◆ ptrNetSim_DEVICE

Definition at line 100 of file main.h.

◆ ptrNetSim_DEVICEINTERFACE

Definition at line 101 of file main.h.

◆ QUALITY_OF_SERVICE

Definition at line 127 of file main.h.

◆ SCHEDULING_TYPE

Definition at line 143 of file main.h.

◆ SERVICE_TYPE

Definition at line 125 of file main.h.

◆ SIMULATION_END_TYPE

Definition at line 142 of file main.h.

◆ SIMULATIONPARAMETER

Definition at line 99 of file main.h.

◆ string

typedef char* string

Definition at line 153 of file main.h.

◆ SUPPRESSION_MODEL

Definition at line 124 of file main.h.

◆ TRANSMISSION_TYPE

Definition at line 144 of file main.h.

◆ TRANSPORT_LAYER_PROTOCOL

Definition at line 132 of file main.h.

◆ WIRESHARK_OPTION

Definition at line 146 of file main.h.

Enumeration Type Documentation

◆ NETSIM_VERSIONTYPE

Enumerator
NETSIM_PRO 
NETSIM_STANDARD 
NETSIM_ACEDEMIC 
NETSIM_DEMO 
NETSIM_COMER 

Definition at line 157 of file main.h.

Function Documentation

◆ CHECK_FOR_USER_DLL()

bool CHECK_FOR_USER_DLL ( const char *  dllName)

◆ fn_NetSim_Anim_MoveNode()

int fn_NetSim_Anim_MoveNode ( NETSIM_ID  src,
double  x,
double  y,
double  time 
)

◆ fn_NetSim_LoadAppDllFunction_dbg()

FARPROC fn_NetSim_LoadAppDllFunction_dbg ( HINSTANCE hdll,
const char *  path,
const char *  dllName,
const char *  funName,
int  line,
char *  file 
)

◆ fn_NetSim_Packet_AddPacketToList_dbg()

int fn_NetSim_Packet_AddPacketToList_dbg ( NetSim_BUFFER pstruBuffer,
NetSim_PACKET pstruPacket,
int  nInsertionType,
int  line,
const char *  file 
)

◆ fn_NetSim_Stack_RegisterCallBackFunction()

bool fn_NetSim_Stack_RegisterCallBackFunction ( int  nSubeventId,
int(*)()  _fnCallBack 
)

◆ fn_NetSim_Utilities_LoadSharedlibFunction_dbg()

FARPROC fn_NetSim_Utilities_LoadSharedlibFunction_dbg ( HINSTANCE hsharedlib,
const char *  sharedlibName,
const char *  funName,
int  line,
const char *  file 
)

◆ fnAddEvent_F()

unsigned long long int fnAddEvent_F ( struct stru_NetSim_EventDetails pstruEvent,
int  line,
const char *  file 
)

◆ ReportError()

int ReportError ( bool  isStopOnError,
const char *  msg,
int  line,
const char *  file,
int  flag,
  ... 
)

Variable Documentation

◆ libext

const char libext[] = ".so"
static

Definition at line 77 of file main.h.