Esempio n. 1
0
        /// <summary>
        /// Handle packet.
        /// </summary>
        /// <param name="packetData">Packet data array.</param>
        /// <exception cref="ArgumentOutOfRangeException">Thrown on fatal error (contact support).</exception>
        /// <exception cref="Sys.IO.IOException">Thrown on IO error.</exception>
        /// <exception cref="ArgumentException">Thrown on fatal error (contact support).</exception>
        /// <exception cref="OverflowException">Thrown on fatal error (contact support).</exception>
        internal static void HandlePacket(byte[] packetData)
        {
            if (packetData == null)
            {
                Global.mDebugger.Send("Error packet data null");
                return;
            }

            UInt16 etherType = (UInt16)((packetData[12] << 8) | packetData[13]);

            switch (etherType)
            {
            case 0x0806:
                ARPPacket.ARPHandler(packetData);
                break;

            case 0x0800:
                IPPacket.IPv4Handler(packetData);
                break;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Handle packet.
        /// </summary>
        /// <param name="packetData">Packet data array.</param>
        /// <exception cref="ArgumentOutOfRangeException">Thrown on fatal error (contact support).</exception>
        /// <exception cref="Sys.IO.IOException">Thrown on IO error.</exception>
        /// <exception cref="ArgumentException">Thrown on fatal error (contact support).</exception>
        /// <exception cref="OverflowException">Thrown on fatal error (contact support).</exception>
        internal static void HandlePacket(byte[] packetData)
        {
            debugger.Send("Packet Received Length=" + packetData.Length.ToString());
            if (packetData == null)
            {
                debugger.Send("Error packet data null");
                return;
            }

            UInt16 etherType = (UInt16)((packetData[12] << 8) | packetData[13]);

            switch (etherType)
            {
            case 0x0806:
                ARPPacket.ARPHandler(packetData);
                break;

            case 0x0800:
                IPPacket.IPv4Handler(packetData);
                break;
            }
        }