Пример #1
0
        public void OnProcessRawPacketBatch(RawPacketBatchRequest request)
        {
            var ack = new RawPacketBatchAck {
                MessageId = request.MessageId
            };

            this._contractor.Tell(ack, this._captureControllerActor);

            // Is actor spawned for given Sender?
            if (this._rawPacketBatchParserActor == null)
            {
                if (!this._isCaptureInfoRequested)
                {
                    this._contractor.Tell(CaptureInfoRequest.Instance);
                    this._isCaptureInfoRequested = true;
                }

                this._reorderingBuffer.Store(request);
                return;
            }

            try
            {
                var batchSeqId = request.SeqId;
                if (batchSeqId == this._currentBatchSeqId)
                {
                    this.SendBatch(request);

                    if (!this._reorderingBuffer.IsEmpty)
                    {
                        this.ReplayPacketBatchReorderBuffer();
                    }
                }
                else if (batchSeqId > this._currentBatchSeqId)
                {
                    this._reorderingBuffer.Store(request);
                }
                else
                {
                    throw new Exception(
                              $"Received batch from the past (possible duplicate). Current {this._currentBatchSeqId}, got {batchSeqId}");
                }
            }
            catch (Exception e)
            {
                this.Logger.Error(e.ToString());
            }
        }
Пример #2
0
        private void OnRawPacketBatchRequest(RawPacketBatchRequest rawPacketBatchRequest)
        {
            var ack = new RawPacketBatchAck {
                MessageId = rawPacketBatchRequest.MessageId
            };

            this.Contractor.Tell(ack);
            try
            {
                foreach (var rawPacket in rawPacketBatchRequest.RawPackets)
                {
                    if (rawPacket.RawPacketData == null)
                    {
                        this._logger.Error("RawPacket has no packet data");
                        continue;
                    }

                    var parsedPacket = Packet.ParsePacket(rawPacket.LinkType, rawPacket.RawPacketData);
                    if (!(parsedPacket.PayloadPacket is IPPacket))
                    {
                        //this._logger.Debug("Ignoring non-IP packet");
                        continue;
                    }

                    var frame = FrameFactory.CreateFromPacket(parsedPacket, rawPacket.DateTimeTicks);

                    if (frame.IsValidTransportPacket || frame.IsIpv4Fragmented)
                    {
                        this.CaptureTrackingActor.Tell(frame);
                    }

                    //else //TODO ALL NON TCP or UDP traffic
                    //{
                    //  this._logger.Error($"Frame is invalid: {frame}");
                    //}
                }
            }
            catch (Exception e)
            {
                this._logger.Error(e, "Exception during Raw packet parsing.");
            }
        }
Пример #3
0
        private void OnRawPacketBatchRequest(RawPacketBatchRequest rawPacketBatchRequest)
        {
            var ack = new RawPacketBatchAck {
                MessageId = rawPacketBatchRequest.MessageId
            };

            this.Contractor.Tell(ack);

            foreach (var rawPacket in rawPacketBatchRequest.RawPackets)
            {
                if (rawPacket.RawPacketData == null)
                {
                    this._logger.Error("RawPacket has no packet data");
                    continue;
                }

                try
                {
                    var parsedPacket = Packet.ParsePacket(rawPacket.LinkType, rawPacket.RawPacketData);
                    if (!(parsedPacket.PayloadPacket is IPPacket))
                    {
                        //this._logger.Debug("Ignoring non-IP packet");
                        continue;
                    }

                    var frame = FrameFactory.CreateFromPacket(parsedPacket, rawPacket.DateTimeTicks);
                    if (frame.IsValidTransportPacket || frame.IsIpv4Fragmented)
                    {
                        this.CaptureTrackingActor.Tell(frame);
                    }
                }
                catch (Exception e)
                {
                    this._logger.Error(e, $"Parsing of a raw packet ({rawPacket}) caused exception.");
                }
            }
        }
Пример #4
0
 private void OnRawPacketBatchAck(RawPacketBatchAck ack)
 {
     this.ReassemblerMessageProxy.MatchReceivedMessage(ack);
 }
Пример #5
0
 private void OnRawPacketBatchAck(RawPacketBatchAck ack)
 {
     this.askProxy.MatchReceivedMessage(ack);
 }