/// <summary> /// UDP handler. /// </summary> /// <param name="packetData">Packet data.</param> /// <exception cref="OverflowException">Thrown if UDP_Data array length is greater than Int32.MaxValue.</exception> /// <exception cref="sysIO.IOException">Thrown on IO error.</exception> internal static void UDPHandler(byte[] packetData) { UDPPacket udp_packet = new UDPPacket(packetData); Global.mDebugger.Send("[Received] UDP packet from " + udp_packet.SourceIP.ToString() + ":" + udp_packet.SourcePort.ToString()); if (udp_packet.SourcePort == 67) { DHCP.DHCPPacket.DHCPHandler(packetData); return; } else if (udp_packet.SourcePort == 53) { DNS.DNSPacket.DNSHandler(packetData); return; } UdpClient receiver = UdpClient.GetClient(udp_packet.DestinationPort); if (receiver != null) { receiver.ReceiveData(udp_packet); } }
/// <summary> /// Receive data from packet. /// </summary> /// <param name="packet">Packet to receive.</param> /// <exception cref="OverflowException">Thrown on fatal error (contact support).</exception> /// <exception cref="Sys.IO.IOException">Thrown on IO error.</exception> internal void ReceiveData(UDPPacket packet) { rxBuffer.Enqueue(packet); }