aboutsip / pkts

Pure java based pcap library capable of reading and writing to/from pcaps.
Other
196 stars 91 forks source link

Introduce FramingException for better handling of framing errors #64

Closed epall closed 6 years ago

epall commented 7 years ago

I'm in the process of implementing a tool that needs to be able to seek to arbitrary points in a pcap file in O(1) time, which means I have to depend on the framers to find the next valid packet at a particular point. To that end, I've been adding a bunch of frame validation code, and I wound up adding a new exception type to facilitate checking for framing errors. This patch is just the initial type changes and a teensy bit of validation, so that we can discuss whether this is the right way forward.

I'm looking for feedback on whether this is a good thing and what alternatives might be better. The first thing that comes to mind for me is fleshing out the accept() methods, instead of adding a new exception, but the raw RuntimeException in EthernetFramer made me think this is worthwhile.

aboutsip commented 7 years ago

Ignore the travis checks. I just signed up yesterday but didn't actually set anything up.

If you are working on some bigger change, perhaps push a different fork and we can collaborate on that one? Specially if you are considering several alternatives etc.

epall commented 7 years ago

Sure, will do!