15#define _CRT_SECURE_NO_DEPRECATE
38 unsigned int unProtocolId;
47 ARP_TABLE *pstruTableHead,*pstruCurrentTable;
69 fnNetSimError(
"Mismatch in ARP Protocol IPV4 Adress Length ");
74 fnNetSimError(
"Mismatch in ARP Protocol IPV6 Adress Length ");
79 pstruCurrentTable = pstruTableHead;
81 szSrcIPadd = pstruArpRequestPkt->
sz_ar$spa;
83 while(pstruCurrentTable != NULL)
181 szTargetMAC = pstruArpReplyPkt->
sz_ar$sha;
182 printf(
"ARP---ARP_ReplySent\tEventTime:%0.3lf\tSrcIP:%s\tMAC_Add:%s\tDestIP:%s \n",
191 fnNetSimError(
"Error in ARP REQEUST. This function should never be called");
195 pstruTemp_Data = NULL;
#define IPV4_PROTOCOL_ADDREES_LENGTH
Length of 32 bit IP address in bytes.
int fn_NetSim_Add_IP_MAC_AddressTo_ARP_Table(ARP_TABLE **, NETSIM_IPAddress, PNETSIM_MACADDRESS, int)
Function to add the new entry to the ARP_TABLE(IP add, MAC add and Type)
#define IPV4_ARP_PACKET_SIZE_WITH_ETH_HEADER
ARP frame size in Bytes: 28 + 14.
#define IPV6_NETWORK_OVERHEADS
In bytes for IPV6 (320 bits).
#define IPV6_PROTOCOL_ADDREES_LENGTH
Length of 128 bit IP address in bytes.
#define IPV4_NETWORK_OVERHEADS
In bytes for IPV4.
#define HARDWARE_ADDRESS_LENGTH
Lenghth of 48 bit MAC address in bytes.
#define IPV6_ARP_PACKET_SIZE_WITH_ETH_HEADER
ARP frame size in Bytes: 52 + 14.
int fn_NetSim_Generate_ARP_Reply(NetSim_EVENTDETAILS *pstruEventDetails, struct stru_NetSim_Network *NETWORK)
NETSIM_IPAddress IP_COPY(NETSIM_IPAddress ip)
#define IP_COMPARE(ip1, ip2)
#define fnNetSimError(x,...)
#define fnpAllocateMemory(count, size)
bool fn_NetSim_GetBufferStatus(NetSim_BUFFER *pstruBuffer)
void add_dest_to_packet(NetSim_PACKET *packet, NETSIM_ID dest)
NETWORK_LAYER_PROTOCOL fn_NetSim_Stack_GetNWProtocol(NETSIM_ID nDeviceId)
#define DEVICE_NWADDRESS(DeviceId, InterfaceId)
MAC_LAYER_PROTOCOL fn_NetSim_Stack_GetMacProtocol(NETSIM_ID nDeviceId, NETSIM_ID nInterfaceId)
EXPORTED struct stru_NetSim_Network * NETWORK
EXPORTED struct stru_NetSim_EventDetails * pstruEventDetails
#define DEVICE_INTERFACE(DeviceId, InterfaceId)
#define fn_NetSim_Packet_CreatePacket(layer)
#define fn_NetSim_Packet_FreePacket(pstruPacket)
#define fnpAddEvent(pstruEvent)
#define fn_NetSim_Packet_AddPacketToList(pstruBuffer, pstruPacket, nInsertionType)
ARP_METRICS * pstruArpMetrics
NetSim specific ARP metrics structure.
ARP_TABLE * pstruArpTable
int nArpReplySentCount
Number of replies sent from the destination.
struct stru_ARP_Table * pstruNextEntry
Next entry pointer.
NETSIM_IPAddress szIPAddress
IP address of the deivce
This Arp packet structure is according to RFC 826.
PNETSIM_MACADDRESS szDestMac
Destination MAC address.
unsigned short int usn_ar$pln
Protocol address length 1 byte,specifies the sizes of the protocol address in bytes.
ETHERNET_TYPE nEther_type
Ethernet Type.
NETSIM_IPAddress sz_ar$spa
Protocol address of the sender.
PNETSIM_MACADDRESS sz_ar$tha
Hardware address of target (if know) otherwise empty 6 bytes.
OPCODE n_ar$op
Operation REQUEST/REPLY 2 bytes.
unsigned short int usn_ar$hln
H/W address length 1 byte ,specifies the sizes of the H/W address in bytes.
HARDWARETYPE n_ar$hrd
Hardware Type 2 bytes.
PNETSIM_MACADDRESS sz_ar$sha
Hardware address of the sender.
PNETSIM_MACADDRESS szSrcMac
Source MAC address.
PROTOCOLTYPE n_ar$pro
Protocol Type 2 bytes.
NETSIM_IPAddress sz_ar$tpa
Protocol address of target.
struct stru_NetSim_Packet * pPacket
PNETSIM_MACADDRESS szDestMac
PNETSIM_MACADDRESS szSourceMac
NETWORK_LAYER_PROTOCOL nNetworkProtocol
NETSIM_IPAddress szDestIP
void * Packet_NetworkProtocol
NETSIM_IPAddress szSourceIP
struct stru_NetSim_Packet_NetworkLayer * pstruNetworkData
unsigned int nControlDataType
struct stru_NetSim_Packet * pstruNextPacket
PACKET_PRIORITY nPacketPriority
struct stru_NetSim_Packet_MACLayer * pstruMacData
char str_ip[_NETSIM_IP_LEN]