in transcoder/source/file/PcapFileMessageSource.py [0:0]
def get_message_iterator(self):
# pylint: disable=unused-variable
# pylint: disable=no-member
for timestamp, packet in self.pcap_reader:
ethernet = dpkt.ethernet.Ethernet(packet)
if not isinstance(ethernet.data, dpkt.ip.IP):
logging.debug('Packet type not supported %s\n', ethernet.data.__class__.__name__)
else:
proto = ethernet.ip.tcp if 'tcp' in ethernet.ip.__dict__.keys() else ethernet.ip.udp
pck_len = len(proto.data)
if pck_len > self.length_threshold:
stripped = proto.data[self.message_skip_bytes:pck_len]
yield stripped
self.increment_count()
self._log_percentage_read()