145 static UINT64 seqNumber = 1;
291 strcpy(packet->
szPacketType,
"ICMP_RouterAdvertisement");
526 memcpy(dm,sm,
sizeof* dm);
538 if (ipVar && !ipVar->
isICMP)
540 fnNetSimError(
"ICMP packet %d is arrives to device %d from device %d.\n ICMP is not configured in this device.\n",
596 for (si = 1; si <=
DEVICE(s)->nNumOfInterface; si++)
601 for (di = 1; di <=
DEVICE(d)->nNumOfInterface; di++)
628 sprintf(msg,
"Reply from %s: bytes %d time=%dus TTL=%d\n",
640 bool(*
resp)(
void*,
char*,
bool),
656 memset(&pevent, 0,
sizeof pevent);
672 goto SEND_ECHO_REQUEST;
681 goto SEND_ECHO_REQUEST;
688 goto ADD_NEXT_SEND_REQUEST;
710 memset(&pevent, 0,
sizeof pevent);
721ADD_NEXT_SEND_REQUEST:
static ANIM_HANDLE handle
void process_icmp_packet()
struct stru_ICMP_Data * ptrICMPDATA
void ICMP_copyPacket(NetSim_PACKET *d, NetSim_PACKET *s)
unsigned long advertiseseed2
void replyRecevied(NetSim_PACKET *packet)
void icmp_send_echo_request()
struct stru_pingHandle PINGHANDLER
void IP_find_best_IP(NETSIM_ID s, NETSIM_ID d, NETSIM_IPAddress *sIP, NETSIM_IPAddress *dIP)
struct stru_ICMP_Data ICMPDATA
unsigned long advertiseseed1
struct stru_pingHandle * ptrPINGHANDLER
int fn_NetSim_IP_ICMP_GenerateDstUnreachableMsg()
int fn_NetSim_IP_ICMP_EchoReply()
int fn_NetSim_IP_ICMP_POLL()
int fn_NetSim_IP_ICMP_ProcessRouterAdvertisement()
int fn_NetSim_IP_ICMP_Init()
int fn_NetSim_IP_ICMP_AdvertiseRouter()
int fn_NetSim_IP_ICMP_ProcessDestUnreachableMsg()
int fn_NetSim_IP_ICMP_EchoRequest()
@ GATEWAYSTATE_NOTIFICATION_PENDING
int ICMP_CHECKSTATE(NETSIM_IPAddress ip)
int iptable_delete(ptrIP_WRAPPER wrapper, NETSIM_IPAddress dest, NETSIM_IPAddress in, char *type)
ptrIP_ROUTINGTABLE iptable_add(ptrIP_WRAPPER wrapper, NETSIM_IPAddress dest, NETSIM_IPAddress subnet, unsigned int prefix_len, NETSIM_IPAddress gateway, UINT interfaceCount, NETSIM_IPAddress *interfaceIp, NETSIM_ID *interfaceId, unsigned int metric, char *type)
@ PACKET_ICMP_DstUnreachableMsg
@ PACKET_ROUTER_ADVERTISEMENT
@ PACKET_ICMP_ECHORequest
void * ICMP_StartPingRequest(NETSIM_ID src, NETSIM_ID dest, UINT count, bool(*resp)(void *, char *, bool), void *arg)
NETSIM_IPAddress IP_COPY(NETSIM_IPAddress ip)
#define IP_NETWORK_ADDRESS_IPV4(ip, subnet)
#define IP_COMPARE4(ip1, ip2)
#define IP_COMPARE(ip1, ip2)
#define STR_TO_IP4(ipstr)
#define _declspec(dllexport)
This function is used to trigger the update.
#define fnNetSimError(x,...)
double fnGetPacketSize(NetSim_PACKET *pstruData)
#define PACKET_NWPROTOCOLDATA(pPacket)
bool isMulticastPacket(NetSim_PACKET *packet)
#define PACKET_NWDATA(pPacket)
NETSIM_ID get_first_dest_from_packet(NetSim_PACKET *packet)
void add_dest_to_packet(NetSim_PACKET *packet, NETSIM_ID dest)
bool resp(ptrCLIENTINFO info, char *msg, bool isMore)
EXPORTED double ldEventTime
int fn_NetSim_Stack_CallICMPErrorFun(NetSim_PACKET *packet, NETSIM_ID nDeviceId, unsigned int nICMPErr)
#define DEVICE_TYPE(DeviceId)
#define DEVICE_NWADDRESS(DeviceId, InterfaceId)
NETSIM_IPAddress fn_NetSim_Stack_GetFirstIPAddressAsId(NETSIM_ID nDeviceId, unsigned int type)
#define DEVICE_SUBNETMASK(DeviceId, InterfaceId)
double fn_NetSim_Utilities_GenerateRandomNo(unsigned long *uSeed, unsigned long *uSeed1)
EXPORTED struct stru_NetSim_Network * NETWORK
#define DEVICE_NWLAYER(DeviceId)
EXPORTED struct stru_NetSim_EventDetails * pstruEventDetails
#define DEVICE_INTERFACE(DeviceId, InterfaceId)
#define IP_WRAPPER_GET(DeviceId)
#define IP_TABLE_GET(DeviceId)
#define fn_NetSim_Packet_CopyPacket(pstruPacket)
#define fn_NetSim_Packet_CreatePacket(layer)
#define fn_NetSim_Packet_FreePacket(pstruPacket)
#define fnpAddEvent(pstruEvent)
void(* callBack)(NetSim_PACKET *)
Structure to store the device ip details.
NETSIM_IPAddress * GatewayIPAddress
unsigned int nRouterAdverLifeTime
unsigned int nRouterAdverMaxInterval
IP_GATEWAYSTATE * nGatewayState
unsigned int nRouterAdvertisementFlag
unsigned int nICMPPollingTime
unsigned int nRouterAdverMinInterval
unsigned int nGatewayCount
struct stru_NetSim_NetworkLayer * pstruNetworkLayer
struct stru_NetSim_Interface ** ppstruInterfaceList
NETSIM_ID nNumOfInterface
netsimDEVICE_TYPE nDeviceType
struct stru_NetSim_Packet * pPacket
netsimDEVICE_TYPE nDeviceType
unsigned short int SequenceNumber
If code = 0, a sequence number to aid in matching echos and replies, may be zero.
unsigned short int Lifetime
NETSIM_IPAddress * RouterAddress
Structure to store ip routing table.
NETSIM_IPAddress networkDestination
INTERFACE_TYPE nInterfaceType
NETSIM_IPAddress szAddress
struct stru_NetSim_Device ** ppstruDeviceList
NETSIM_IPAddress szGatewayIP
IP_PROTOCOL_NUMBER IPProtocol
NETWORK_LAYER_PROTOCOL nNetworkProtocol
NETSIM_IPAddress szDestIP
void * Packet_NetworkProtocol
NETSIM_IPAddress szNextHopIp
NETSIM_IPAddress szSourceIP
char szPacketType[MAX_PACKET_TYPE_LEN]
struct stru_NetSim_Packet_NetworkLayer * pstruNetworkData
unsigned int nControlDataType
PACKET_PRIORITY nPacketPriority
char str_ip[_NETSIM_IP_LEN]
bool(* ResponseHandler)(void *arg, char *msg, bool isMore)