Пример #1
0
        public L3L4ConversationKey(IPPacket sourceIpPacket)
        {
            if (sourceIpPacket == null)
            {
                throw new ArgumentNullException();
            }

            this._l3Key = new L3ConversationKeyStruct(sourceIpPacket);

            var payloadPacket = sourceIpPacket.PayloadPacket;

            switch (payloadPacket)
            {
            case TcpPacket tcpPacket:
                this._l4Key = new L4ConversationKeyStruct(tcpPacket.SourcePort, tcpPacket.DestinationPort, IPProtocolType.TCP);
                break;

            case UdpPacket udpPacket:
                this._l4Key = new L4ConversationKeyStruct(udpPacket.SourcePort, udpPacket.DestinationPort, IPProtocolType.UDP);
                break;

            default:
                throw new ArgumentException($"Unknown transport protocol payload: {payloadPacket}");
            }
        }
Пример #2
0
 public Boolean Equals(L3ConversationKeyStruct other) =>
 Equals(this.Address1, other.Address1) && Equals(this.Address2, other.Address2);
Пример #3
0
 public static Boolean Equals(L3ConversationKeyStruct key1, L3ConversationKeyStruct key2) =>
 key1.Address1.Equals(key2.Address1) && key1.Address2.Equals(key2.Address2);