NetSim Source Code Help
Loading...
Searching...
No Matches
IP.c File Reference
#include "main.h"
#include "List.h"
#include "IP.h"
#include "Protocol.h"
#include "NetSim_utility.h"
#include "../Firewall/Firewall.h"
#include "Animation.h"
#include "../SupportFunction/Scheduling.h"
Include dependency graph for IP.c:

Go to the source code of this file.

Macros

#define QUEUING_MAX_TH_MB_DEFAULT   7.0
 
#define QUEUING_MIN_TH_MB_DEFAULT   4.0
 
#define QUEUING_MAX_P_DEFAULT   0.05
 
#define QUEUING_WQ_DEFAULT   0.0002
 
#define QUEUING_LOW_MAX_TH_MB_DEFAULT   7.0
 
#define QUEUING_NORMAL_MAX_TH_MB_DEFAULT   7.0
 
#define QUEUING_MEDIUM_MAX_TH_MB_DEFAULT   7.0
 
#define QUEUING_HIGH_MAX_TH_MB_DEFAULT   7.0
 
#define QUEUING_LOW_MIN_TH_MB_DEFAULT   4.0
 
#define QUEUING_NORMAL_MIN_TH_MB_DEFAULT   4.5
 
#define QUEUING_MEDIUM_MIN_TH_MB_DEFAULT   5.0
 
#define QUEUING_HIGH_MIN_TH_MB_DEFAULT   5.5
 
#define QUEUING_LOW_MAX_P_DEFAULT   0.05
 
#define QUEUING_NORMAL_MAX_P_DEFAULT   0.05
 
#define QUEUING_MEDIUM_MAX_P_DEFAULT   0.05
 
#define QUEUING_HIGH_MAX_P_DEFAULT   0.05
 
#define SCHEDULING_MAX_LATENCY_UGS_MS_DEFAULT   100
 
#define SCHEDULING_MAX_LATENCY_rtPS_MS_DEFAULT   150
 
#define SCHEDULING_MAX_LATENCY_ertPS_MS_DEFAULT   300
 
#define SCHEDULING_MAX_LATENCY_nrtPS_MS_DEFAULT   300
 
#define SCHEDULING_MAX_LATENCY_BE_MS_DEFAULT   100000
 
#define BUFFER_BUFFER_PLOT_DEFAULT   true
 

Functions

int fn_NetSim_IP_VPN_Init ()
 
NETWORK_LAYER_PROTOCOL fnGetLocalNetworkProtocol (NetSim_EVENTDETAILS *pstruEventDetails)
 
int freeVPN (void *vpn)
 
int freeDNS (void *dns)
 
int freeVPNPacket (void *vpnPacket)
 
void * copyVPNPacket (void *vpnPacket)
 
static void add_default_ip_table_entry (NETSIM_ID d)
 
void set_public_ip (NETSIM_ID d)
 
void configure_static_ip_route (NETSIM_ID d, char *file)
 
static void init_ip_anim ()
 
int fn_NetSim_IP_ICMP_GenerateDstUnreachableMsg ()
 
int fn_NetSim_IP_ICMP_EchoRequest ()
 
int fn_NetSim_IP_ICMP_EchoReply ()
 
int fn_NetSim_IP_ICMP_ProcessRouterAdvertisement ()
 
int fn_NetSim_IP_ICMP_ProcessDestUnreachableMsg ()
 
int fn_NetSim_IP_ICMP_Init ()
 
int fn_NetSim_IP_ICMP_POLL ()
 
int fn_NetSim_IP_ICMP_AdvertiseRouter ()
 
int fn_NetSim_IP_ConfigStaticIPTable (char *szVal)
 
static IP_PROTOCOL_ACTION decide_action_for_packet (NetSim_PACKET *packet, NETSIM_ID dev)
 
int fn_NetSim_IP_Init (struct stru_NetSim_Network *NETWORK_Formal, NetSim_EVENTDETAILS *pstruEventDetails_Formal, char *pszAppPath_Formal, char *pszWritePath_Formal, int nVersion_Type, void **fnPointer)
 
static ptrIP_FORWARD_ROUTE build_route (NetSim_PACKET *packet)
 
static void ip_handle_processing_delay ()
 
int fn_NetSim_IP_Run ()
 
int fn_NetSim_IP_Finish ()
 
char * fn_NetSim_IP_Trace (NETSIM_ID nSubeventid)
 
static void ip_queuing_read_config (NETSIM_ID d, NETSIM_ID in, void *xmlNetSimNode)
 
static void ip_scheduling_read_config (NETSIM_ID d, NETSIM_ID in, void *xmlNetSimNode)
 
int fn_NetSim_IP_Configure (void **var)
 
int fn_NetSim_IP_FreePacket (NetSim_PACKET *pstruPacket)
 
int fn_NetSim_IP_CopyPacket (NetSim_PACKET *pstruDestPacket, NetSim_PACKET *pstruSrcPacket)
 
int fn_NetSim_IP_Metrics (PMETRICSWRITER metricsWriter)
 
char * fn_NetSim_IP_ConfigPacketTrace (const void *xmlNetSimNode)
 
int fn_NetSim_IP_WritePacketTrace (NetSim_PACKET *pstruPacket, char **ppszTrace)
 
static bool isSameIPForOtherInterface (NETSIM_ID d, NETSIM_ID in)
 
void ip_write_to_pcap (NetSim_PACKET *packet, NETSIM_ID d, NETSIM_ID i, double time)
 
static void init_event_to_write (NETSIM_ID d)
 

Variables

int IP_packetTraceFiledFlag [4] = { 0,0,0,0 }
 
char pszTrace [BUFSIZ]
 

Macro Definition Documentation

◆ BUFFER_BUFFER_PLOT_DEFAULT

#define BUFFER_BUFFER_PLOT_DEFAULT   true

Definition at line 809 of file IP.c.

◆ QUEUING_HIGH_MAX_P_DEFAULT

#define QUEUING_HIGH_MAX_P_DEFAULT   0.05

Definition at line 677 of file IP.c.

◆ QUEUING_HIGH_MAX_TH_MB_DEFAULT

#define QUEUING_HIGH_MAX_TH_MB_DEFAULT   7.0

Definition at line 668 of file IP.c.

◆ QUEUING_HIGH_MIN_TH_MB_DEFAULT

#define QUEUING_HIGH_MIN_TH_MB_DEFAULT   5.5

Definition at line 672 of file IP.c.

◆ QUEUING_LOW_MAX_P_DEFAULT

#define QUEUING_LOW_MAX_P_DEFAULT   0.05

Definition at line 674 of file IP.c.

◆ QUEUING_LOW_MAX_TH_MB_DEFAULT

#define QUEUING_LOW_MAX_TH_MB_DEFAULT   7.0

Definition at line 665 of file IP.c.

◆ QUEUING_LOW_MIN_TH_MB_DEFAULT

#define QUEUING_LOW_MIN_TH_MB_DEFAULT   4.0

Definition at line 669 of file IP.c.

◆ QUEUING_MAX_P_DEFAULT

#define QUEUING_MAX_P_DEFAULT   0.05

Definition at line 662 of file IP.c.

◆ QUEUING_MAX_TH_MB_DEFAULT

#define QUEUING_MAX_TH_MB_DEFAULT   7.0

Definition at line 659 of file IP.c.

◆ QUEUING_MEDIUM_MAX_P_DEFAULT

#define QUEUING_MEDIUM_MAX_P_DEFAULT   0.05

Definition at line 676 of file IP.c.

◆ QUEUING_MEDIUM_MAX_TH_MB_DEFAULT

#define QUEUING_MEDIUM_MAX_TH_MB_DEFAULT   7.0

Definition at line 667 of file IP.c.

◆ QUEUING_MEDIUM_MIN_TH_MB_DEFAULT

#define QUEUING_MEDIUM_MIN_TH_MB_DEFAULT   5.0

Definition at line 671 of file IP.c.

◆ QUEUING_MIN_TH_MB_DEFAULT

#define QUEUING_MIN_TH_MB_DEFAULT   4.0

Definition at line 660 of file IP.c.

◆ QUEUING_NORMAL_MAX_P_DEFAULT

#define QUEUING_NORMAL_MAX_P_DEFAULT   0.05

Definition at line 675 of file IP.c.

◆ QUEUING_NORMAL_MAX_TH_MB_DEFAULT

#define QUEUING_NORMAL_MAX_TH_MB_DEFAULT   7.0

Definition at line 666 of file IP.c.

◆ QUEUING_NORMAL_MIN_TH_MB_DEFAULT

#define QUEUING_NORMAL_MIN_TH_MB_DEFAULT   4.5

Definition at line 670 of file IP.c.

◆ QUEUING_WQ_DEFAULT

#define QUEUING_WQ_DEFAULT   0.0002

Definition at line 663 of file IP.c.

◆ SCHEDULING_MAX_LATENCY_BE_MS_DEFAULT

#define SCHEDULING_MAX_LATENCY_BE_MS_DEFAULT   100000

Definition at line 683 of file IP.c.

◆ SCHEDULING_MAX_LATENCY_ertPS_MS_DEFAULT

#define SCHEDULING_MAX_LATENCY_ertPS_MS_DEFAULT   300

Definition at line 681 of file IP.c.

◆ SCHEDULING_MAX_LATENCY_nrtPS_MS_DEFAULT

#define SCHEDULING_MAX_LATENCY_nrtPS_MS_DEFAULT   300

Definition at line 682 of file IP.c.

◆ SCHEDULING_MAX_LATENCY_rtPS_MS_DEFAULT

#define SCHEDULING_MAX_LATENCY_rtPS_MS_DEFAULT   150

Definition at line 680 of file IP.c.

◆ SCHEDULING_MAX_LATENCY_UGS_MS_DEFAULT

#define SCHEDULING_MAX_LATENCY_UGS_MS_DEFAULT   100

Definition at line 679 of file IP.c.

Function Documentation

◆ add_default_ip_table_entry()

static void add_default_ip_table_entry ( NETSIM_ID  d)
static

Definition at line 1332 of file IP.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ build_route()

static ptrIP_FORWARD_ROUTE build_route ( NetSim_PACKET packet)
static

Definition at line 154 of file IP.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ configure_static_ip_route()

void configure_static_ip_route ( NETSIM_ID  d,
char *  file 
)

This function is to configure static ip table

Definition at line 420 of file IP_Routing.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ copyVPNPacket()

void * copyVPNPacket ( void *  vpnPacket)
Here is the caller graph for this function:

◆ decide_action_for_packet()

static IP_PROTOCOL_ACTION decide_action_for_packet ( NetSim_PACKET packet,
NETSIM_ID  dev 
)
static

Definition at line 57 of file IP.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fn_NetSim_IP_ConfigPacketTrace()

char * fn_NetSim_IP_ConfigPacketTrace ( const void *  xmlNetSimNode)

This function will return the string to write packet trace heading.

Definition at line 1183 of file IP.c.

Here is the call graph for this function:

◆ fn_NetSim_IP_ConfigStaticIPTable()

int fn_NetSim_IP_ConfigStaticIPTable ( char *  szVal)

◆ fn_NetSim_IP_Configure()

int fn_NetSim_IP_Configure ( void **  var)

This function is called by NetworkStack.dll, while configuring the device NETWORK layer for IP protocol.

Definition at line 816 of file IP.c.

Here is the call graph for this function:

◆ fn_NetSim_IP_CopyPacket()

int fn_NetSim_IP_CopyPacket ( NetSim_PACKET pstruDestPacket,
NetSim_PACKET pstruSrcPacket 
)

This function is to copy the IP information from source to the destination.

Definition at line 1048 of file IP.c.

Here is the call graph for this function:

◆ fn_NetSim_IP_Finish()

int fn_NetSim_IP_Finish ( )

This function is called by NetworkStack.dll, once simulation end to free the allocated memory for the network.

Definition at line 582 of file IP.c.

Here is the call graph for this function:

◆ fn_NetSim_IP_FreePacket()

int fn_NetSim_IP_FreePacket ( NetSim_PACKET pstruPacket)

This function is to free the memory allocated for packets of this protocol.

Definition at line 1031 of file IP.c.

Here is the call graph for this function:

◆ fn_NetSim_IP_ICMP_AdvertiseRouter()

int fn_NetSim_IP_ICMP_AdvertiseRouter ( )
Here is the caller graph for this function:

◆ fn_NetSim_IP_ICMP_EchoReply()

int fn_NetSim_IP_ICMP_EchoReply ( )
Here is the caller graph for this function:

◆ fn_NetSim_IP_ICMP_EchoRequest()

int fn_NetSim_IP_ICMP_EchoRequest ( )
Here is the caller graph for this function:

◆ fn_NetSim_IP_ICMP_GenerateDstUnreachableMsg()

int fn_NetSim_IP_ICMP_GenerateDstUnreachableMsg ( )
Here is the caller graph for this function:

◆ fn_NetSim_IP_ICMP_Init()

int fn_NetSim_IP_ICMP_Init ( )
Here is the caller graph for this function:

◆ fn_NetSim_IP_ICMP_POLL()

int fn_NetSim_IP_ICMP_POLL ( )
Here is the caller graph for this function:

◆ fn_NetSim_IP_ICMP_ProcessDestUnreachableMsg()

int fn_NetSim_IP_ICMP_ProcessDestUnreachableMsg ( )
Here is the caller graph for this function:

◆ fn_NetSim_IP_ICMP_ProcessRouterAdvertisement()

int fn_NetSim_IP_ICMP_ProcessRouterAdvertisement ( )
Here is the caller graph for this function:

◆ fn_NetSim_IP_Init()

int fn_NetSim_IP_Init ( struct stru_NetSim_Network NETWORK_Formal,
NetSim_EVENTDETAILS pstruEventDetails_Formal,
char *  pszAppPath_Formal,
char *  pszWritePath_Formal,
int  nVersion_Type,
void **  fnPointer 
)

This function initializes the IP parameters.

Definition at line 90 of file IP.c.

Here is the call graph for this function:

◆ fn_NetSim_IP_Metrics()

int fn_NetSim_IP_Metrics ( PMETRICSWRITER  metricsWriter)

This function write the Metrics in Metrics.txt

Definition at line 1066 of file IP.c.

Here is the call graph for this function:

◆ fn_NetSim_IP_Run()

int fn_NetSim_IP_Run ( )

This function is called by NetworkStack.dll, whenever the event gets triggered inside the NetworkStack.dll for IP.It includes NETWORK_OUT,NETWORK_IN and TIMER_EVENT.

Definition at line 223 of file IP.c.

Here is the call graph for this function:

◆ fn_NetSim_IP_Trace()

char * fn_NetSim_IP_Trace ( NETSIM_ID  nSubeventid)

This function is called by NetworkStack.dll, while writing the event trace to get the sub event as a string.

Definition at line 619 of file IP.c.

◆ fn_NetSim_IP_VPN_Init()

int fn_NetSim_IP_VPN_Init ( )

This function is to initialize the VPN(Virtual Private Network).

Definition at line 25 of file VPN.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ fn_NetSim_IP_WritePacketTrace()

int fn_NetSim_IP_WritePacketTrace ( NetSim_PACKET pstruPacket,
char **  ppszTrace 
)

This function will return the string to write packet trace.

Definition at line 1232 of file IP.c.

◆ fnGetLocalNetworkProtocol()

NETWORK_LAYER_PROTOCOL fnGetLocalNetworkProtocol ( NetSim_EVENTDETAILS pstruEventDetails)

This function is to get the local network protocol

Definition at line 1283 of file IP.c.

Here is the caller graph for this function:

◆ freeDNS()

int freeDNS ( void *  dns)
Here is the caller graph for this function:

◆ freeVPN()

int freeVPN ( void *  vpn)
Here is the caller graph for this function:

◆ freeVPNPacket()

int freeVPNPacket ( void *  vpnPacket)
Here is the caller graph for this function:

◆ init_event_to_write()

static void init_event_to_write ( NETSIM_ID  d)
static

Definition at line 1492 of file IP.c.

Here is the caller graph for this function:

◆ init_ip_anim()

static void init_ip_anim ( )
static

Definition at line 1505 of file IP.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ip_handle_processing_delay()

static void ip_handle_processing_delay ( )
static

Definition at line 182 of file IP.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ip_queuing_read_config()

static void ip_queuing_read_config ( NETSIM_ID  d,
NETSIM_ID  in,
void *  xmlNetSimNode 
)
static

Definition at line 685 of file IP.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ip_scheduling_read_config()

static void ip_scheduling_read_config ( NETSIM_ID  d,
NETSIM_ID  in,
void *  xmlNetSimNode 
)
static

Definition at line 764 of file IP.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ip_write_to_pcap()

void ip_write_to_pcap ( NetSim_PACKET packet,
NETSIM_ID  d,
NETSIM_ID  i,
double  time 
)

Definition at line 1476 of file IP.c.

Here is the caller graph for this function:

◆ isSameIPForOtherInterface()

static bool isSameIPForOtherInterface ( NETSIM_ID  d,
NETSIM_ID  in 
)
static

Definition at line 1298 of file IP.c.

Here is the caller graph for this function:

◆ set_public_ip()

void set_public_ip ( NETSIM_ID  d)

Definition at line 185 of file IP_Utility.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ IP_packetTraceFiledFlag

int IP_packetTraceFiledFlag[4] = { 0,0,0,0 }

Definition at line 1178 of file IP.c.

◆ pszTrace

char pszTrace[BUFSIZ]

Definition at line 1179 of file IP.c.