24#ifndef _NETSIM_STACK_H_
25#define _NETSIM_STACK_H_
34#define EXPORTED _declspec(dllexport)
36#define EXPORTED _declspec(dllimport)
38#ifdef _NETSIM_METRIC_CODE_
46#define EXPORTED extern
48#ifdef _NETSIM_METRIC_CODE_
54EXPORTED
bool isSimulationContinued;
57#define MICROSECOND (1.0)
58#define NANOSECOND (MICROSECOND/1000.0)
59#define MILLISECOND (1000.0*MICROSECOND)
60#define SECOND (1000.0*MILLISECOND)
61#define MINUTE (60.0*SECOND)
62#define HOUR (60.0*MINUTE)
66#define INFINITY (0xFFFFFFFF)
68#ifndef NEGATIVE_INFINITY
69#define NEGATIVE_INFINITY (-1.0*INFINITY)
80typedef enum enum_sim_state
87_declspec(dllexport)
void netsim_set_simstate(SIMSTATE state);
88_declspec(dllexport) SIMSTATE netsim_get_simstate();
104 PHYSICAL_OUT_EVENT = PHYSICAL_LAYER*10+1,
105 PHYSICAL_IN_EVENT = PHYSICAL_LAYER*10+2,
106 MAC_OUT_EVENT = MAC_LAYER*10+1,
107 MAC_IN_EVENT = MAC_LAYER*10+2,
108 NETWORK_OUT_EVENT = NETWORK_LAYER*10+1,
109 NETWORK_IN_EVENT = NETWORK_LAYER*10+2,
110 TRANSPORT_OUT_EVENT = TRANSPORT_LAYER*10+1,
111 TRANSPORT_IN_EVENT = TRANSPORT_LAYER*10+2,
112 APPLICATION_OUT_EVENT = APPLICATION_LAYER*10+1,
113 APPLICATION_IN_EVENT = APPLICATION_LAYER*10+2,
115 INTERNAL_NETSIM_EVENT=2,
118typedef enum enum_common_subevent
120 SUBEVENT_GETLINKQUALITY= TIMER_EVENT*100+1,
121 SUBEVENT_JOIN_MULTICAST_GROUP,
125 SUBEVENT_HWI_CLEANUP,
126 SUBEVENT_PAUSESIMULATION,
127 SUBEVENT_EXECUTECOMMAND,
131static char subeventName[SUBEVNET_LAST][100] = {
"GET_LINK_QUALITY",
132"JOIN_MULTICAST_GROUP",
141#define PROTOCOL_METRICS 2
142#define PROTOCOL_MOBILITY 3
143#define PROTOCOL_APPLICATION 4
144#define PROTOCOL_LINK 5
145#define PROTOCOL_HWI 6
146#define PROTOCOL_CLI 7
151 APP_PROTOCOL_NULL = 0,
154 APP_PROTOCOL_RIP = APPLICATION_LAYER*100+1,
158 APP_PROTOCOL_OPENFLOW,
162 APP_PROTOCOL_CBR=PROTOCOL_APPLICATION,
163 APP_PROTOCOL_VOICE=PROTOCOL_APPLICATION,
164 APP_PROTOCOL_FTP=PROTOCOL_APPLICATION,
165 APP_PROTOCOL_HTTP=PROTOCOL_APPLICATION,
166 APP_PROTOCOL_BSM=PROTOCOL_APPLICATION,
167 APP_PROTOCOL_COAP=PROTOCOL_APPLICATION,
168 APP_PROTOCOL_DATABASE=PROTOCOL_APPLICATION,
169 APP_PROTOCOL_CUSTOM=PROTOCOL_APPLICATION,
170 APP_PROTOCOL_EMAIL=PROTOCOL_APPLICATION,
171 APP_PROTOCOL_ERLANGCALL=PROTOCOL_APPLICATION,
172 APP_PROTOCOL_VIDEO=PROTOCOL_APPLICATION,
173 APP_PROTOCOL_EMULATION=PROTOCOL_APPLICATION,
174 APP_PROTOCOL_INTERACTIVE_GAMING=PROTOCOL_APPLICATION,
180 TX_PROTOCOL_NULL = 0,
181 TX_PROTOCOL_TCP = TRANSPORT_LAYER*100+1,
190 NW_PROTOCOL_IPV4 = NETWORK_LAYER*100+1,
209 MAC_PROTOCOL_IEEE802_11 = MAC_LAYER*100+1,
210 MAC_PROTOCOL_IEEE802_15_4,
211 MAC_PROTOCOL_IEEE802_22,
214 MAC_PROTOCOL_IEEE802_3,
229 MAC_PROTOCOL_TOKEN_RING_BUS,
231 MAC_PROTOCOL_IEEE1609,
235 MAC_PROTOCOL_SATELLITE,
243 PHY_MEDIUM_WIRELESS = 1,
244 PHY_MEDIUM_WIRED = 2,
248enum enum_InterfaceType
251 INTERFACE_LAN_802_3=1,
252 INTERFACE_LAN_802_11,
253 INTERFACE_LAN_802_15_4,
254 INTERFACE_LAN_802_22,
255 INTERFACE_WAN_ROUTER,
261 INTERFACE_5G = INTERFACE_LTE_NR,
262 INTERFACE_NTN = INTERFACE_LTE_NR,
264 INTERFACE_TOKEN_RING,
333 LinkMode_HalfDuplex=1,
334 LinkMode_FullDuplex=2,
338enum enum_SimulationEndType
344enum enum_SchedulingType
348 SCHEDULING_PRIORITY=2,
349 SCHEDULING_ROUNDROBIN=3,
352 SCHEDULING_CLASSBASED=6,
355typedef enum enum_QueuingTechnique
363enum enum_TransmissionType
371enum emum_wireshark_option
379typedef enum enum_NodeAction
390 unsigned long long int nmacaddress;
391 char szmacaddress[13];
393}NETSIM_MACADDRESS,*PNETSIM_MACADDRESS;
395EXPORTED PNETSIM_MACADDRESS BROADCAST_MAC;
398#define M_PI 3.14159265358979323846
400#define DegreesToRadians(degree) ((degree) * (M_PI / 180.0))
401#define RadiansToDegrees(radian) ((radian) * (180.0 / M_PI))
404typedef enum enum_refEllipsoid
406 REFERENCEELLIPSOID_SPHERE,
407 REFERENCEELLIPSOID_WGS84,
408 REFERENCEELLIPSOID_GRS80,
410 REFERENCEELLIPSOID_COUNT,
411} GEOCORR_REFERENCEELLIPSOID;
413typedef enum enum_corrType
418}NETSIM_COORDINATETYPE;
422 NETSIM_COORDINATETYPE corrType;
430 GEOCORR_REFERENCEELLIPSOID refEllipsoid;
438_declspec(dllexport)
void fn_NetSim_Coordinate_ConvertMapToCartesian(
double lat,
double lon, NetSim_COORDINATES* pos);
439_declspec(dllexport)
void fn_NetSim_Coordinate_ConvertCartesianToMap(NetSim_COORDINATES* pos);
441_declspec(dllexport)
void fn_NetSim_Coordinate_ConvertGeoToCartesian(
double lat,
double lon,
442 double altitude,
char* strRefEllipsoid,
443 NetSim_COORDINATES* pos);
444_declspec(dllexport)
void fn_NetSim_Coordinate_ConvertCartesianToGeo(NetSim_COORDINATES* pos,
445 GEOCORR_REFERENCEELLIPSOID refEllipsoid);
450 SIMULATION_END_TYPE nSimulationExitType;
458 NETSIM_ID applicationId;
459 NETSIM_ID applicationInstance;
460 APPLICATION_LAYER_PROTOCOL appProtocol;
461 TRANSPORT_LAYER_PROTOCOL trxProtocol;
462 UINT16 localPortNumber;
463 UINT16 remotePortNumber;
466}SOCKETINTERFACE, *ptrSOCKETINTERFACE;
467_declspec(dllexport) ptrSOCKETINTERFACE fn_NetSim_Socket_CreateNewSocket(NETSIM_ID deviceId,
469 TRANSPORT_LAYER_PROTOCOL trxProtocol,
472_declspec(dllexport) ptrSOCKETINTERFACE fn_NetSim_Socket_GetSocketInterface(NETSIM_ID deviceId,
473 APPLICATION_LAYER_PROTOCOL appProtocol,
474 TRANSPORT_LAYER_PROTOCOL trxProtocol,
477_declspec(dllexport)
void fn_NetSim_Socket_PassPacketToInterface(NETSIM_ID deviceId,
478 NetSim_PACKET* packet,
479 ptrSOCKETINTERFACE socketInterface);
485 LAYER_TYPE nLayerType;
486 UINT nappProtocolCount;
490_declspec(dllexport)
void* fn_NetSim_Stack_RegisterNewApplicationProtocol(NETSIM_ID deviceId,
492_declspec(dllexport)
void* fn_NetSim_Stack_GetAppProtocolData(NETSIM_ID deviceId,
494_declspec(dllexport)
void fn_NetSim_Stack_SetAppProtocolData(NETSIM_ID deviceId,
497_declspec(dllexport)
bool fn_NetSim_Socket_GetBufferStatus(ptrSOCKETINTERFACE s);
498_declspec(dllexport) NetSim_PACKET* fn_NetSim_Socket_GetPacketFromInterface(ptrSOCKETINTERFACE s,
504 unsigned int isTCP:1;
505 unsigned int isUDP:1;
506 TRANSPORT_LAYER_PROTOCOL nTransportLayerProtocol;
507 LAYER_TYPE nLayerType;
511 void* TransportProtocolVar;
519}IP_WRAPPER, *ptrIP_WRAPPER;
524 LAYER_TYPE nLayerType;
525 NETWORK_LAYER_PROTOCOL nRoutingProtocolId;
527 int (*routerFunction)();
529 ptrIP_WRAPPER ipWrapper;
531 double dMaxPacketLen;
537 LAYER_TYPE nLayerType;
538 MAC_LAYER_PROTOCOL nMacProtocolId;
539 PNETSIM_MACADDRESS szMacAddress;
540 bool isWiresharkWriter;
541 double dFragmentSize;
548 LAYER_TYPE nLayerType;
549 PHYSICAL_LAYER_MEDIUM nPhyMedium;
553 double dLastPacketEndTime;
558 PHYPROP_WIRELESS wireless;
571 NETSIM_ID interfaceId;
573 double dMaxBufferSize;
574 double dCurrentBufferSize;
576 SCHEDULING_TYPE nSchedulingType;
577 QUEUINGTECHNIQUE queuingTechnique;
579 void* schedulingParam;
584 unsigned int nQueuedPacket;
585 unsigned int nDequeuedPacket;
586 unsigned int nDroppedPacket;
604}NODE_JOIN_PROFILE,*PNODE_JOIN_PROFILE;
605#define JOIN_PROFILE_ALLOC() (PNODE_JOIN_PROFILE)list_alloc(sizeof(NODE_JOIN_PROFILE),offsetof(NODE_JOIN_PROFILE,ele))
606#define JOIN_PROFILE_NEXT(profile) profile=(PNODE_JOIN_PROFILE)LIST_NEXT(profile)
607#define JOIN_PROFILE_ADD(lprofile,profile) LIST_ADD_LAST((void**)lprofile,profile)
612 NETSIM_ID nConfigLinkId;
615 PHYSICAL_LAYER_MEDIUM nLinkMedium;
622 double dPropagationDelayUp;
625 double dPropagationDelayDown;
626 double dDataRateDown;
627 double dErrorRateDown;
632 double dDataRateDown;
633 PPROPAGATION propagation;
640 NETSIM_ID nFirstDeviceId;
641 NETSIM_ID nFirstInterfaceId;
642 NETSIM_ID nSecondDeviceId;
643 NETSIM_ID nSecondInterfaceId;
647 NETSIM_ID nConnectedDeviceCount;
648 NETSIM_ID nCenterDeviceId;
649 NETSIM_ID nCenterInterfaceId;
651 NETSIM_ID* anDevInterfaceIds;
655 NETSIM_ID nConnectedDeviceCount;
657 NETSIM_ID* anDevInterfaceIds;
660 bool isLinkFailureMode;
663 LINK_STATE linkState;
664 unsigned int nLinkUpCount;
666 unsigned int nLinkDownCount;
667 double* dLinkDownTime;
668 int(*fnLinkFailureModelCallBack)(NETSIM_ID, LINK_STATE);
669 }struLinkFailureModel;
677 NETSIM_ID nInterfaceId;
678 NETSIM_ID nConfigInterfaceId;
679 INTERFACE_TYPE nInterfaceType;
680 char* szInterfaceName;
683 NETSIM_ID nParentInterfaceId;
684 char* virtualInterfaceName;
685 bool isNwAddressChanged;
689 NETWORK_LAYER_PROTOCOL nProtocolId;
690 NETSIM_IPAddress szAddress;
691 NETSIM_IPAddress publicIP;
692 NETSIM_IPAddress szSubnetMask;
693 unsigned int prefix_len;
694 NETSIM_IPAddress szDefaultGateWay;
697 NETWORK_LAYER_PROTOCOL nLocalNetworkProtocol;
698 void* localProtocolVar;
705_declspec(dllexport) NETSIM_ID fn_NetSim_Stack_GetInterfaceIdByName(NETSIM_ID nDeviceId,
const char* szInterfaceName);
711 NETSIM_ID nConfigDeviceId;
713 netsimDEVICE_TYPE nDeviceType;
715 NETSIM_Name szDeviceName;
716 NETSIM_ID nNumOfInterface;
717 unsigned long ulSeed[SEED_COUNT];
721 ptrSOCKETINTERFACE pstruSocketInterface;
726 WIRESHARK_OPTION wireshark_option;
727 PNODE_JOIN_PROFILE node_join_profile;
728 NODE_ACTION node_status;
738 UINT nApplicationCount;
747 unsigned long long int nEventId;
749 EVENT_TYPE nEventType;
750 NETSIM_ID nProtocolId;
751 netsimDEVICE_TYPE nDeviceType;
753 NETSIM_ID nInterfaceId;
754 NETSIM_ID nApplicationId;
757 long long int nPacketId;
759 NETSIM_ID nSubEventType;
760 void* szOtherDetails;
761 unsigned long long int nPrevEventId;
764 UINT64 executionTime;
765 bool isEmulatedEvent;
771#define DEVICE(DeviceId) NETWORK->ppstruDeviceList[DeviceId-1]
775#define DEVICE_TYPE(DeviceId) DEVICE(DeviceId)->nDeviceType
776#define DEVICE_NAME(DeviceId) DEVICE(DeviceId)->szDeviceName
777#define DEVICE_VAR(DeviceId) DEVICE(DeviceId)->deviceVar
778#define DEVICE_SEED0(DeviceId) &(DEVICE(DeviceId)->ulSeed[0])
779#define DEVICE_SEED1(DeviceId) &(DEVICE(DeviceId)->ulSeed[1])
780#define DEVICE_SEED(DeviceId) DEVICE_SEED0(DeviceId),DEVICE_SEED1(DeviceId)
781#define DEVICE_CONFIGID(DeviceId) DEVICE(DeviceId)->nConfigDeviceId
782#define DEVICE_INTERFACE(DeviceId,InterfaceId) DEVICE(DeviceId)->ppstruInterfaceList[InterfaceId-1]
783#define DEVICE_INTERFACE_CONFIGID(DeviceId,InterfaceId) DEVICE_INTERFACE(DeviceId,InterfaceId)->nConfigInterfaceId
784#define DEVICE_APPLAYER(DeviceId) DEVICE(DeviceId)->pstruApplicationLayer
785#define DEVICE_APPVAR(DeviceId,protocolId) (fn_NetSim_Stack_GetAppProtocolData(DeviceId,protocolId))
786#define DEVICE_TRXLayer(DeviceId) DEVICE(DeviceId)->pstruTransportLayer
787#define DEVICE_NWLAYER(DeviceId) DEVICE(DeviceId)->pstruNetworkLayer
788#define DEVICE_MACLAYER(DeviceId,InterfaceId) DEVICE_INTERFACE(DeviceId,InterfaceId)->pstruMACLayer
789#define DEVICE_MACPROTOCOL(DeviceId,InterfaceId) DEVICE_MACLAYER(DeviceId,InterfaceId)->nMacProtocolId
790#define DEVICE_PHYLAYER(DeviceId,InterfaceId) DEVICE_INTERFACE(DeviceId,InterfaceId)->pstruPhysicalLayer
791#define DEVICE_LINK(DeviceId,InterfaceId) (DEVICE_PHYLAYER(DeviceId,InterfaceId)->pstruNetSimLinks)
792#define DEVICE_POSITION(DeviceId) DEVICE(DeviceId)->pstruDevicePosition
793#define DEVICE_MOBILITY(DeviceId) DEVICE(DeviceId)->pstruDeviceMobility
794#define DEVICE_SOCKETINTERFACE(DeviceId) DEVICE(DeviceId)->pstruSocketInterface
795#define DEVICE_MAC_NW_INTERFACE(DeviceId,InterfaceId) DEVICE_INTERFACE(DeviceId,InterfaceId)->pstruAccessInterface
796#define DEVICE_ACCESSBUFFER(DeviceId,InterfaceId) DEVICE_MAC_NW_INTERFACE(DeviceId,InterfaceId)->pstruAccessBuffer
797#define DEVICE_MYACCESSBUFFER() DEVICE_ACCESSBUFFER(pstruEventDetails->nDeviceId,pstruEventDetails->nInterfaceId)
798#define DEVICE_PHYMEDIUM(DeviceId,InterfaceId) DEVICE_PHYLAYER(DeviceId,InterfaceId)->nPhyMedium
799#define DEVICE_PHYVAR(DeviceId,InterfaceId) DEVICE_PHYLAYER(DeviceId,InterfaceId)->phyVar
800#define DEVICE_MACVAR(DeviceId,InterfaceId) DEVICE_MACLAYER(DeviceId,InterfaceId)->MacVar
801#define DEVICE_HWADDRESS(DeviceId,InterfaceId) DEVICE_MACLAYER(DeviceId,InterfaceId)->szMacAddress
802#define DEVICE_NWROUTINGVAR(DeviceId) DEVICE_NWLAYER(DeviceId)->RoutingVar
803#define IP_WRAPPER_GET(DeviceId) ((ptrIP_WRAPPER)(DEVICE_NWLAYER(DeviceId)->ipWrapper))
804#define IP_TABLE_GET(DeviceId) ((ptrIP_ROUTINGTABLE)(IP_WRAPPER_GET(DeviceId)->table))
805#define PIP_TABLE_GET(DeviceId) (&IP_TABLE_GET(DeviceId))
806#define DEVICE_NWPROTOCOL(DeviceId,InterfaceId) DEVICE_INTERFACE(DeviceId,InterfaceId)->nProtocolId
807#define DEVICE_NWADDRESS(DeviceId,InterfaceId) DEVICE_INTERFACE(DeviceId,InterfaceId)->szAddress
808#define DEVICE_MYIP() DEVICE_NWADDRESS(pstruEventDetails->nDeviceId,pstruEventDetails->nInterfaceId)
809#define DEVICE_SUBNETMASK(DeviceId,InterfaceId) DEVICE_INTERFACE(DeviceId,InterfaceId)->szSubnetMask
810#define DEVICE_MYMASK() DEVICE_SUBNETMASK(pstruEventDetails->nDeviceId,pstruEventDetails->nInterfaceId)
811#define DEVICE_PUBLICIP(DeviceId,InterfaceId) DEVICE_INTERFACE(DeviceId,InterfaceId)->publicIP
812#define DEVICE_FIRST_PUBLICIP(DeviceId) DEVICE_PUBLICIP(DeviceId,1)
813#define DEVICE_TCPVAR(DeviceId) DEVICE_TRXLayer(DeviceId)->TCPProtocol
814#define DEVICE_UDPVAR(DeviceId) DEVICE_TRXLayer(DeviceId)->UDPProtocol
815#define DEVICE_APPINFO(DeviceId) DEVICE_APPLAYER(DeviceId)->pstruApplicationInfo
816#define DEVICE_DISTANCE(d1,d2) (fn_NetSim_Utilities_CalculateDistance(DEVICE_POSITION(d1), DEVICE_POSITION(d2)))
820#define EVENT_TYPE(EventDetails) (EventDetails)->nEventType
821#define EVENT_TIME(EventDetails) (EventDetails)->dEventTime
822#define EVENT_DEVICETYPE(EventDetails) (EventDetails)->nDeviceType
823#define EVENT_DEVICEID(EventDetails) (EventDetails)->nDeviceId
824#define EVENT_INTERFACEID(EventDetails) (EventDetails)->nInterfaceId
825#define EVENT_APPID(EventDetails) (EventDetails)->nApplicationId
826#define EVENT_PACKETSIZE(EventDetails) (EventDetails)->dPacketSize
827#define EVENT_PACKET(EventDetails) (EventDetails)->pPacket
828#define EVENT_PACKETID(EventDetails) (EventDetails)->nPacketId
829#define EVENT_SUBEVENTTYPE(EventDetails) (EventDetails)->nSubEventType
830#define EVENT_OTHERDETAILS(EventDetails) (EventDetails)->szOtherDetails
835_declspec(dllexport)
int fnDeleteEvent(
unsigned long long int nEventId);
836_declspec(dllexport)
void set_thread_safe_kernel(
bool status);
840EXPORTED
double ldEventTime;
841EXPORTED EVENT_TYPE nEventType;
842EXPORTED
char* pszAppPath;
844EXPORTED
char* pszIOPath;
845EXPORTED
char* pszIOLogPath;
846EXPORTED NETSIM_VERSIONTYPE nVersionType;
847EXPORTED
int nDbgFlag;
849EXPORTED
int wireshark_flag;
851#define NETSIM_RAND_MAX (double)10000000000
853_declspec(dllexport)
bool isHost(NETSIM_ID d);
854_declspec(dllexport)
bool isRouter(NETSIM_ID d);
855_declspec(dllexport)
bool isL3Device(NETSIM_ID d);
858_declspec(dllexport)
double fn_NetSim_Utilities_CalculateDistance(NetSim_COORDINATES* coordinate1,NetSim_COORDINATES* coordinates2);
860_declspec(dllexport)
double fn_NetSim_Utilities_GenerateRandomNo(
unsigned long *uSeed,
unsigned long *uSeed1);
861#define NETSIM_RAND() fn_NetSim_Utilities_GenerateRandomNo(DEVICE_SEED(1))
862#define NETSIM_RAND_01() (NETSIM_RAND()/NETSIM_RAND_MAX)
863#define NETSIM_RAND_RN(max,min) (min+NETSIM_RAND_01()*(max-min))
866_declspec(dllexport)
int fn_NetSim_Utilities_ConcatString(
int num,
char* arg1,
const char* arg2,...);
870_declspec(dllexport)
int fn_NetSim_Utils_Distribution(
int nDistributionType,
double *fDistOut,
unsigned long *uSeed,
unsigned long *uSeed1,
double fFirstArg,
double fSecondArg);
873_declspec(dllexport) NETSIM_ID fn_NetSim_Stack_GetDeviceId_asName(
const char* name);
876_declspec(dllexport) NETSIM_ID fn_NetSim_Stack_GetDeviceId_asIP(NETSIM_IPAddress ip,NETSIM_ID* nInterfaceId);
879_declspec(dllexport) NETSIM_ID fn_NetSim_Stack_GetDeviceId_asMac(PNETSIM_MACADDRESS mac,NETSIM_ID* nInterfaceId);
882_declspec(dllexport) NETSIM_ID fn_NetSim_Stack_GetWirelessInterface(NETSIM_ID nLinkId,NETSIM_ID nDevId);
885_declspec(dllexport) NETSIM_ID fn_NetSim_Stack_GetInterfaceIdFromIP(NETSIM_ID nDeviceId,NETSIM_IPAddress ip);
888_declspec(dllexport) NETSIM_ID* fn_NetSim_Stack_GetInterfaceIdbyMacProtocol(NETSIM_ID devId,MAC_LAYER_PROTOCOL protocol,
unsigned int* count);
891_declspec(dllexport) NETSIM_ID* fn_NetSim_Stack_GetInterfaceIdbyInterfaceType(NETSIM_ID devId,INTERFACE_TYPE ifType,
unsigned int* count);
903_declspec(dllexport) NETSIM_ID fn_NetSim_Stack_GetConnectedDevice(NETSIM_ID nDeviceId,NETSIM_ID nInterfaceId,NETSIM_ID* nConnectedDevId,NETSIM_ID* nConnectedInterfaceId);
904_declspec(dllexport) NETSIM_ID fn_NetSim_Stack_GetFirstConnectedDevice(NETSIM_ID nDeviceId, NETSIM_ID nInterfaceId, NETSIM_ID* nConnectedDevId, NETSIM_ID* nConnectedInterfaceId);
907_declspec(dllexport) NETSIM_ID fn_NetSim_Stack_GetConnectedInterface(NETSIM_ID devId,NETSIM_ID ifid,NETSIM_ID conId);
910_declspec(dllexport) NETSIM_ID fn_NetSim_Stack_GetConnectedInterface_Both(NETSIM_ID d, NETSIM_ID r, NETSIM_ID* din, NETSIM_ID* rin);
913_declspec(dllexport) NetSim_LINKS* fn_NetSim_Stack_RemoveDeviceFromlink(NETSIM_ID nDeviceId,NETSIM_ID nInterfaceId,NETSIM_ID nLinkId);
916_declspec(dllexport) NetSim_LINKS* fn_NetSim_Stack_AddDeviceTolink(NETSIM_ID nDeviceId,NETSIM_ID nInterfaceId,NETSIM_ID nLinkId);
919_declspec(dllexport) MAC_LAYER_PROTOCOL fn_NetSim_Stack_GetMacProtocol(NETSIM_ID nDeviceId,NETSIM_ID nInterfaceId);
921_declspec(dllexport) NETWORK_LAYER_PROTOCOL fn_NetSim_Stack_GetNWProtocol(NETSIM_ID nDeviceId);
923_declspec(dllexport) NETWORK_LAYER_PROTOCOL fn_NetSim_Stack_GetNWRoutingProtocol(NETSIM_ID nDeviceId);
927_declspec (dllexport)
char* fn_NetSim_xmlConfig_GetVal(
void* xmlNetSimNode,
const char* szName,
int flag);
929_declspec (dllexport)
char* fn_NetSim_xmlConfigPacketTraceField(
const void* xmlNetSimNode,
const char* name);
931_declspec(dllexport)
int NetSimxmlError(
const char* msg,
char* val,
const void* xmlNetSimNode);
934_declspec(dllexport)
void* fn_NetSim_xmlGetChildElement(
void* xmlNetSimNode,
const char* childName,
int count);
935#define fn_NetSim_xmlGetFirstChildElement(xmlNetSimNode,childName) fn_NetSim_xmlGetChildElement(xmlNetSimNode,childName,0)
936_declspec(dllexport)
void* fn_NetSim_xmlGetNextChildElement(
void* xmlNetSimNode,
void* prevChild);
939_declspec(dllexport)
void fn_NetSim_xmlIterateOverChildElement(
void* xmlNetSimNode,
const char* childName,
940 int(*fun)(
void* childNode,
int argc,
char* argv[]),
944_declspec(dllexport) LINK_TYPE fn_NetSim_Config_GetLinkType(
const char* value);
946_declspec(dllexport) SUPPRESSION_MODEL fn_NetSim_Config_GetSuppressionModel(
char* model);
948_declspec(dllexport) SERVICE_TYPE fn_NetSim_Config_GetServiceType(
char* type);
950_declspec(dllexport) netsimDEVICE_TYPE fn_NetSim_Config_GetDeviceType(
const char* type);
952_declspec(dllexport) DISTRIBUTION fn_NetSim_Config_GetDistribution(
const char* szDistribution);
954_declspec(dllexport) INTERFACE_TYPE fn_NetSim_Config_GetInterfaceType(
const char* value);
956_declspec(dllexport)
int fn_NetSim_Config_GetProtocol(
const char* value);
958_declspec(dllexport) PROPAGATION_MODEL fn_NetSim_Config_GetPropagationModel(
char* model);
959_declspec(dllexport) PROP_MEDIUM fn_NetSim_Config_GetPropagationMedium(
char* med);
960_declspec(dllexport) SHADOW_MODEL fn_NetSim_Config_GetShadowModel(
char* model);
961_declspec(dllexport) FADING_MODEL fn_NetSim_Config_GetFadingModel(
char* model);
962_declspec(dllexport) PATHLOSS_MODEL fn_NetSim_Config_GetPathLossModel(
char* model);
965_declspec(dllexport) NETSIM_IPAddress fn_NetSim_Stack_GetIPAddressByName(
const NETSIM_Name szDeviceName,NETSIM_ID nInterfaceId);
967_declspec(dllexport) PNETSIM_MACADDRESS fn_NetSim_Stack_GetMacAddressFromIP(
const NETSIM_IPAddress szIPAddress);
969_declspec(dllexport) NETSIM_IPAddress fn_NetSim_Stack_GetIPAddressFromMac(
const PNETSIM_MACADDRESS szMacAddress);
971_declspec(dllexport) NETSIM_IPAddress fn_NetSim_Stack_GetFirstIPAddressAsId(NETSIM_ID nDeviceId,
unsigned int type);
973_declspec(dllexport) NETSIM_IPAddress fn_NetSim_Stack_GetIPAddressAsId(NETSIM_ID nDeviceId,NETSIM_ID nInterfaceId);
975_declspec(dllexport) NETSIM_IPAddress fn_NetSim_Stack_GetFirstIPAddressByName(
const NETSIM_Name szDeviceName);
977_declspec(dllexport) NETSIM_ID fn_NetSim_Stack_GetConfigIdOfLinkById(NETSIM_ID nLinkId);
978_declspec(dllexport) NETSIM_ID fn_NetSim_Stack_GetLinkIdByConfigId(NETSIM_ID nLinkId);
980_declspec(dllexport) NETSIM_ID fn_NetSim_Stack_GetConfigIdOfDeviceById(NETSIM_ID nDeviceId);
982_declspec (dllexport) NETSIM_ID fn_NetSim_GetDeviceIdByConfigId(NETSIM_ID
id);
984_declspec(dllexport)
bool isIPForSameDevice(NETSIM_IPAddress ip, NETSIM_ID d);
986_declspec(dllexport) NETSIM_IPAddress get_ip_from_same_subnet(NETSIM_ID d, NETSIM_IPAddress ip);
989_declspec(dllexport) NETSIM_ID fn_NetSim_Stack_GetApplicationIdByConfigId(NETSIM_ID
id);
991_declspec(dllexport) NETSIM_ID fn_NetSim_GetInterfaceIdByConfigId(NETSIM_ID devId,NETSIM_ID
id);
993_declspec(dllexport) PHYSICAL_LAYER_MEDIUM fn_NetSim_Cofig_GetConnectionMedium(
char* medium);
995_declspec(dllexport)
int fn_NetSim_xmlConfigureProtocolProperty(
void* xmlChildNode, NETSIM_ID nDeviceId, NETSIM_ID nInterfaceId, LAYER_TYPE nLayerType, UINT nProtocolId);
996_declspec(dllexport)
bool fn_NetSim_Stack_isProtocolConfigured(NETSIM_ID d,
1000#define fn_NetSim_Metrics_Add(packet) fn_NetSim_Metrics_Add_new(packet,__LINE__,__FILE__,__FUNCTION__)
1001_declspec(dllexport)
void fn_NetSim_Metrics_Add_new(
const NetSim_PACKET* pPacket,
int line,
char* file,
char* function);
1003#define DEFAULT_MAC_FRAGMENT_SIZE 1500
1004#define DEFAULT_TRX_MSS 1472
1005#define DEFAULT_NW_LAYER_SIZE 1480
1006_declspec(dllexport)
double fn_NetSim_Stack_GetMSS(
const NetSim_PACKET* pPacket);
1010_declspec(dllexport)
int fn_NetSim_Stack_RegisterICMPCallback(
int (*fnCallBack)(NetSim_PACKET* errPacket,NETSIM_ID nDeviceId,
unsigned int nICMPErr));
1012_declspec(dllexport)
int fn_NetSim_Stack_CallICMPErrorFun(NetSim_PACKET* packet,NETSIM_ID nDeviceId,
unsigned int nICMPErr);
1014_declspec(dllexport)
double fn_NetSim_stack_get_link_quality(NETSIM_ID trx, NETSIM_ID tri, NETSIM_ID rx, NETSIM_ID ri);
1017typedef NETSIM_IPAddress (*fndns_query)(NETSIM_ID nDeviceId,NETSIM_ID id);
1018EXPORTED fndns_query fnDNS;
1019_declspec(dllexport) NETSIM_IPAddress DNS_QUERY(NETSIM_ID nDeviceId,NETSIM_ID
id);
1022typedef int (*_fnMobilityCallBack)(NETSIM_ID nDeviceId);
1023_declspec(dllexport)
int fnMobilityRegisterCallBackFunction(_fnMobilityCallBack fnCallBack);
1026typedef int (*_fnNodeJoinCallBack)(NETSIM_ID nDeviceId,
double time,NODE_ACTION);
1027_declspec(dllexport)
int fnNodeJoinRegisterCallBackFunction(_fnNodeJoinCallBack fnCallBack);
1030typedef enum xmlDataType
1047_declspec(dllexport)
int GetXmlVal(
void* var,
const char* name,
void* xmlNode,
int flag, XMLDATATYPE type);
1048#define getXmlVar(var,name,xmlNode,flag,type,protocol) if(!GetXmlVal(var,#name,xmlNode,flag,type)) *(var)= protocol##_##name##_DEFAULT
1059_declspec(dllexport)
double fn_NetSim_Config_read_Frequency(
void* xmlNetSimNode,
1062 const char* returnUnit);
1071_declspec(dllexport)
double fn_NetSim_Config_read_dataRate(
void* xmlNetSimNode,
1073 double defaultDataRate,
1074 const char* returnUnit);
1083_declspec(dllexport)
double fn_NetSim_Config_read_dataLen(
void* xmlNetSimNode,
1085 double defaultDataLen,
1086 const char* returnUnit);
1094_declspec(dllexport)
double fn_NetSim_Config_read_txPower(
void* xmlNetSimNode,
1096 double defaultTxPower,
1097 const char* returnUnit);
1106_declspec(dllexport)
double fn_NetSim_Config_read_time(
void* xmlNetSimNode,
1109 const char* returnUnit);
1111_declspec(dllexport)
int fn_NetSim_Config_ConvertStrToEnum(
void* xmlNode,
const char* attributeName,
const char** enumstr,
const char* enumName,
int length,
bool isErrorMsg);
1112#define ConfigReadEnum(xmlNode,attriName,enumName,isErrorMsg) fn_NetSim_Config_ConvertStrToEnum(xmlNode,attriName,(const char**)str ## enumName, #enumName, sizeof(str ## enumName)/sizeof(str ## enumName ## [0]), isErrorMsg)
1115_declspec(dllexport) PNETSIM_MACADDRESS STR_TO_MAC(
char* mac);
1116_declspec(dllexport)
char* MAC_TO_STR(PNETSIM_MACADDRESS mac);
1117_declspec(dllexport) PNETSIM_MACADDRESS MAC_COPY(PNETSIM_MACADDRESS mac);
1118_declspec(dllexport)
int MAC_COMPARE(PNETSIM_MACADDRESS mac1, PNETSIM_MACADDRESS mac2);
1119_declspec(dllexport)
void MAC_FREE(PNETSIM_MACADDRESS mac);
1120_declspec(dllexport)
void MAC_FREE_ALL();
1121_declspec(dllexport) PNETSIM_MACADDRESS multicastIP_to_Mac(NETSIM_IPAddress multicastIP);
1122_declspec(dllexport)
bool isBroadcastMAC(PNETSIM_MACADDRESS mac);
1123_declspec(dllexport)
bool isMulticastMAC(PNETSIM_MACADDRESS mac);
1126_declspec(dllexport)
void sim_time_to_string(
double time,
char* strTime);
1129_declspec(dllexport)
void set_emulation(
bool isCustom,
1130 int(*load_emulation)(
void* emuInterface));
1133typedef int(*fun)(NETSIM_ID, NETSIM_ID, bool);
1134_declspec(dllexport)
void register_interface_state_change(NETSIM_ID d,
1137_declspec(dllexport)
void notify_interface_up(NETSIM_ID d, NETSIM_ID in);
1138_declspec(dllexport)
void notify_interface_down(NETSIM_ID d, NETSIM_ID in);
1141_declspec(dllexport)
int fn_NetSim_Link_RegisterLinkFailureCallback(NETSIM_ID linkId,
1142 int(*fnLinkCallBack)(NETSIM_ID, LINK_STATE));
1145_declspec(dllexport)
bool isFastEmulation();
1148_declspec(dllexport) NETSIM_ID fn_NetSim_Stack_CreateVirtualInterface(NETSIM_ID deviceId, NETSIM_ID parentInterfaceId,
1149 char* virtualInterfaceName,
1150 bool isNwChanged,
bool isMacChanged,
bool isPhyChanged);
1151_declspec(dllexport) NETSIM_ID fn_NetSim_Stack_FindVirtualInterface(NETSIM_ID d, NETSIM_ID parentIf,
char* name);
1152_declspec(dllexport)
bool isVirtualInterface(NETSIM_ID d, NETSIM_ID in);
1155_declspec(dllexport)
void netsim_pause_progress();
1156_declspec(dllexport)
void netsim_resume_progress();
1159_declspec(dllexport) UINT64 start_timer(NETSIM_ID d, NETSIM_ID in, UINT eventId,
double time,
void* data);
1160_declspec(dllexport)
void cancel_timer(UINT64 eventId);