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(L4ConversationKeyStruct other) => this.Key == other.Key && this.Protocol == other.Protocol;