Ejemplo n.º 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}");
            }
        }
Ejemplo n.º 2
0
 public L3L4ConversationKey(IPAddress sourceIpAddress,
                            IPAddress destinationIpAddress,
                            UInt16 sourcePort,
                            UInt16 destinationPort,
                            IPProtocolType ipProtocolType)
 {
     this._l3Key = new L3ConversationKeyStruct(sourceIpAddress, destinationIpAddress);
     this._l4Key = new L4ConversationKeyStruct(sourcePort, destinationPort, ipProtocolType);
 }
Ejemplo n.º 3
0
 public L3L4ConversationKey(Frame frame)
 {
     if (frame == null)
     {
         throw new ArgumentNullException();
     }
     this._l3Key = new L3ConversationKeyStruct(frame);
     this._l4Key = new L4ConversationKeyStruct(frame);
 }
Ejemplo n.º 4
0
 public Boolean Equals(L3ConversationKeyStruct other) =>
 Equals(this.IpAddress1, other.IpAddress1) && Equals(this.IpAddress2, other.IpAddress2);
Ejemplo n.º 5
0
 public static Boolean Equals(L3ConversationKeyStruct key1, L3ConversationKeyStruct key2) =>
 key1.IpAddress1.Equals(key2.IpAddress1) && key1.IpAddress2.Equals(key2.IpAddress2);