/// <summary> /// IPv4 handler. /// </summary> /// <param name="packetData">Packet data.</param> /// <exception cref="sys.ArgumentOutOfRangeException">Thrown on fatal error (contact support).</exception> /// <exception cref="sys.IO.IOException">Thrown on IO error.</exception> /// <exception cref="sys.ArgumentException">Thrown on fatal error (contact support).</exception> /// <exception cref="sys.OverflowException">Thrown if packetData array length is greater than Int32.MaxValue.</exception> internal static void IPv4Handler(byte[] packetData) { var ip_packet = new IPPacket(packetData); if (ip_packet.SourceIP == null) { Global.mDebugger.Send("SourceIP null in IPv4Handler!"); } ARPCache.Update(ip_packet.SourceIP, ip_packet.SourceMAC); if ((NetworkStack.AddressMap.ContainsKey(ip_packet.DestinationIP.Hash) == true) || (ip_packet.DestinationIP.address[3] == 255)) { switch (ip_packet.Protocol) { case 1: ICMPPacket.ICMPHandler(packetData); break; case 6: TCPPacket.TCPHandler(packetData); break; case 17: UDPPacket.UDPHandler(packetData); break; } } else if (NetworkStack.MACMap.ContainsKey(ip_packet.DestinationMAC.Hash)) { DHCPPacket.DHCPHandler(packetData); } }
internal static void AddPacket(IPPacket packet) { ensureQueueExists(); NetworkDevice nic = Config.FindInterface(packet.SourceIP); packet.SourceMAC = nic.MACAddress; queue.Add(new BufferEntry(nic, packet)); }
internal static void IPv4Handler(byte[] packetData) { IPPacket ip_packet = new IPPacket(packetData); //Sys.Console.WriteLine("Received IP Packet"); //Sys.Console.WriteLine(ip_packet.ToString()); ARPCache.Update(ip_packet.SourceIP, ip_packet.SourceMAC); if ((NetworkStack.AddressMap.ContainsKey(ip_packet.DestinationIP.Hash) == true) || (ip_packet.DestinationIP.address[3] == 255)) { switch (ip_packet.Protocol) { case 1: ICMPPacket.ICMPHandler(packetData); break; //case 6: // IPv4_TCPHandler(packetData); // break; case 17: UDPPacket.UDPHandler(packetData); break; } } }
internal static void IPv4Handler(byte[] packetData) { IPPacket ip_packet = new IPPacket(packetData); //Sys.Console.WriteLine("Received IP Packet"); //Sys.Console.WriteLine(ip_packet.ToString()); if (ip_packet.SourceIP == null) { global::System.Console.WriteLine("SourceIP null in IPv4Handler!"); } ARPCache.Update(ip_packet.SourceIP, ip_packet.SourceMAC); if ((NetworkStack.AddressMap.ContainsKey(ip_packet.DestinationIP.Hash) == true) || (ip_packet.DestinationIP.address[3] == 255)) { switch (ip_packet.Protocol) { case 1: ICMPPacket.ICMPHandler(packetData); break; //case 6: // IPv4_TCPHandler(packetData); // break; case 17: UDPPacket.UDPHandler(packetData); break; } } }
/// <summary> /// Add packet. /// </summary> /// <param name="packet">IP packet.</param> internal static void AddPacket(IPPacket packet) { EnsureQueueExists(); NetworkDevice nic = IPConfig.FindInterface(packet.SourceIP); packet.SourceMAC = nic.MACAddress; queue.Add(new BufferEntry(nic, packet)); }
/// <summary> /// Create new instance of the <see cref="BufferEntry"/> class. /// </summary> /// <param name="nic">Network device.</param> /// <param name="packet">IP packet.</param> public BufferEntry(NetworkDevice nic, IPPacket packet) { this.NIC = nic; this.Packet = packet; if (Packet.DestinationIP.IsBroadcastAddress()) { this.Status = EntryStatus.DHCP_REQUEST; } else { this.Status = EntryStatus.ADDED; } }
protected UInt16 CalcOcCRC(UInt16 offset, UInt16 length) { return(IPPacket.CalcOcCRC(this.RawData, offset, length)); }
/// <summary> /// Add packet. /// </summary> /// <param name="packet">IP packet.</param> /// <param name="device">Network Interface Controller.</param> internal static void AddPacket(IPPacket packet, NetworkDevice device) { EnsureQueueExists(); packet.SourceMAC = device.MACAddress; queue.Add(new BufferEntry(device, packet)); }
public BufferEntry(NetworkDevice nic, IPPacket packet) { this.NIC = nic; this.Packet = packet; this.Status = EntryStatus.ADDED; }
public BufferEntry(NetworkDevice nic, IPPacket packet) { this.NIC = nic; this.Packet = packet; this.Status = EntryStatus.ADDED; }