aboutsip / pkts

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

Library tweaks to support TCP reconstruction #51

Closed neonbunny closed 7 years ago

neonbunny commented 7 years ago

Exposes additional fields and fixes a couple of things. This is part of integrating this project with pcap-reconst

jonbo372 commented 7 years ago

Hi. Sorry for super late response. Been traveling. Looks good overall but will look into it in details this coming weekend. Two asks though:

  1. Please squash your commits.
  2. Could you add at least one unit test
jonbo372 commented 7 years ago

Hey @neonbunny, would you add unit tests etc? In general, I do no accept pull requests without tests...

neonbunny commented 7 years ago

Sure, please leave it with me. This PR is part of a low priority project so it may take me a little while.

neonbunny commented 7 years ago

I've added a couple of unit tests now.

neonbunny commented 7 years ago

This MR now also stops IP packets from inheriting from MAC packets - that was an invalid assumption in the case of LINKTYPE_RAW (and probably a whole bunch of other scenarios). Any code which depends on the old functionality should be modified in the same way the unit tests were - i.e.

pkt.getSourceMacAddress()

becomes:

((MACPacket)pkt.getPacket(Protocol.ETHERNET_II)).getSourceMacAddress()

Callers should probably also do some null checking for cases where there is no Ethernet layer.

jonbo372 commented 7 years ago

I merged this on top of the 3.x branch instead because it did change the interface and as such, it would break 2.x apps. So, all your changes are in the 3.x branch, which I will soon merge to be master. So, closing this one...

jonbo372 commented 7 years ago

and now the 3.x branch is merged back to the master branch... I haven't built a release of 3.x yet because I'm working on some API breaking changes compared to 2.x and want to finalize them before doing the first 3.x release.