Skip to content

support pcapng file format #1936

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

support pcapng file format #1936

wants to merge 5 commits into from

Conversation

dsseng
Copy link

@dsseng dsseng commented Apr 8, 2025

This PR adds support for Pcapng files to the I/O module

Related to #1403, pcap should be rather simple to implement based on these changes.

  • Factor out common SocketCAN ser/des parts
  • Add PcapngWriter
  • Add PcapngReader

TODO:

  • tests
  • gzip, lz4, zst, perhaps other compression types readers know about

@dsseng dsseng marked this pull request as draft April 8, 2025 10:07
@dsseng dsseng marked this pull request as ready for review April 9, 2025 07:05
@dsseng dsseng force-pushed the pcapng-io branch 3 times, most recently from 1a841c3 to 8d47c73 Compare April 9, 2025 17:48
Comment on lines +46 to +48
try:
import pyzstd
except ImportError:
pyzstd = None
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Zstandard addition should be a distinct commit. Please let me know if you would like to merge with squashing so that I can split it out into a new PR

@zariiii9003
Copy link
Collaborator

Keep the changes minimal. Move the socketcan files back to where they belong, remove zstd and all other unrelated changes. Add test data and documentation (see file_io.rst)

@dsseng
Copy link
Author

dsseng commented May 30, 2025

Keep the changes minimal. Move the socketcan files back to where they belong, remove zstd and all other unrelated changes. Add test data and documentation (see file_io.rst)

I abstracted out some common SocketCAN files for the purpose of not duplicating the code. pcapng expects packets to be serialized as SocketCAN packets, so this code has to be shared. Let me know if there is a better place or way to refactor this.

@zariiii9003
Copy link
Collaborator

you could just import from socketcan without moving the files

@dsseng
Copy link
Author

dsseng commented May 30, 2025

you could just import from socketcan without moving the files

Is this a correct pattern for an IO module to import an interface module? That felt a bit counter-logical

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants