示例#1
0
        private void ExtractPacket(IPPacket packet)
        {
            switch (packet.Protocol)
            {
            case ProtocolType.Tcp:
                var tcpPacket = packet.Extract <TcpPacket>();
                if (tcpPacket != null)
                {
                    DestinationPort = tcpPacket.DestinationPort.ToString();
                    SourcePort      = tcpPacket.SourcePort.ToString();
                }
                break;

            case ProtocolType.Udp:
                var udpPacket = packet.Extract <UdpPacket>();
                if (udpPacket != null)
                {
                    DestinationPort = udpPacket.DestinationPort.ToString();
                    SourcePort      = udpPacket.SourcePort.ToString();
                }
                break;

            case ProtocolType.IcmpV6:
                break;

            default:
                break;
            }
        }
示例#2
0
        private void ReadPacket(IPPacket packet)
        {
            switch (packet.Protocol)
            {
            case ProtocolType.IPv6HopByHopOptions:
                break;

            case ProtocolType.Icmp:
                break;

            case ProtocolType.Igmp:
                var igmpPacket = packet.Extract <IgmpV2Packet>();
                if (igmpPacket != null)
                {
                }
                break;

            case ProtocolType.Gpg:
                break;

            case ProtocolType.IPv4:
                break;

            case ProtocolType.Tcp:
                var tcpPacket = packet.Extract <TcpPacket>();
                if (tcpPacket != null)
                {
                    var tcpHeader = new TCPHeader(tcpPacket);
                }
                break;

            case ProtocolType.Egp:
                break;

            case ProtocolType.Pup:
                break;

            case ProtocolType.Udp:
                var udpPacket = packet.Extract <UdpPacket>();
                if (udpPacket != null)
                {
                    var udpHeader = new UDPHeader(udpPacket);
                }
                break;

            case ProtocolType.Idp:
                break;

            case ProtocolType.TP:
                break;

            case ProtocolType.IPv6:
                break;

            case ProtocolType.IPv6RoutingHeader:
                break;

            case ProtocolType.IPv6FragmentHeader:
                break;

            case ProtocolType.Rsvp:
                break;

            case ProtocolType.Gre:
                break;

            case ProtocolType.IPSecEncapsulatingSecurityPayload:
                break;

            case ProtocolType.IPSecAuthenticationHeader:
                break;

            case ProtocolType.IcmpV6:
                var icmpv6Packet = packet.Extract <IcmpV6Packet>();
                if (icmpv6Packet != null)
                {
                    //MakeInformationUDP(udpHeader);
                }
                break;

            case ProtocolType.IPv6NoNextHeader:
                break;

            case ProtocolType.IPv6DestinationOptions:
                break;

            case ProtocolType.Ospf:
                break;

            case ProtocolType.Mtp:
                break;

            case ProtocolType.Encapsulation:
                break;

            case ProtocolType.Pim:
                break;

            case ProtocolType.CompressionHeader:
                break;

            case ProtocolType.MobilityHeader:
                break;

            case ProtocolType.HostIdentity:
                break;

            case ProtocolType.Shim6:
                break;

            case ProtocolType.Reserved253:
                break;

            case ProtocolType.Reserved254:
                break;

            case ProtocolType.Raw:
                break;

            default:
                break;
            }
        }