Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""
Gets the current PSML (packet summary xml) structure in a tuple ((None, leftover_data)),
only if the capture is configured to return it, else returns (None, leftover_data).
A coroutine.
"""
data = b''
psml_struct = None
if self.only_summaries:
# If summaries are read, we need the psdml structure which appears on top of the file.
while not psml_struct:
data += yield From(fd.read(self.SUMMARIES_BATCH_SIZE))
psml_struct, data = self._extract_tag_from_data(data, b'structure')
if psml_struct:
psml_struct = psml_structure_from_xml(psml_struct)
raise Return(psml_struct, data)
else:
raise Return(None, data)
"""Gets the current PSML (packet summary xml) structure in a tuple ((None, leftover_data)),
only if the capture is configured to return it, else returns (None, leftover_data).
A coroutine.
"""
data = b""
psml_struct = None
if self._only_summaries:
# If summaries are read, we need the psdml structure which appears on top of the file.
while not psml_struct:
new_data = await fd.read(self.SUMMARIES_BATCH_SIZE)
data += new_data
psml_struct, data = self._extract_tag_from_data(data, b"structure")
if psml_struct:
psml_struct = psml_structure_from_xml(psml_struct)
elif not new_data:
return None, data
return psml_struct, data
else:
return None, data