Skip to content

Conversation

@sandeepkumarnv
Copy link

Please review these initial version of changes. Since I have to iterate inside the header elements constructor I am forced to take out the "final" declarations on information elements. I didn't want to do that though. Please take a look at this and let me know your thoughts on it. Also I have not worked on factory implementation yet. I will be working on that soon. Thanks

@coveralls
Copy link

Coverage Status

Coverage increased (+0.09%) to 70.393% when pulling 584d14e on sandeepkumarnv:v1 into db6a43f on kaitoy:v1.

@kaitoy
Copy link
Owner

kaitoy commented Jul 18, 2017

Thank you for your PR. I will take a look at it.

@sandeepkumarnv
Copy link
Author

Please let me know your feedback on this when you get a chance to review. Thanks

@lennartkoopmann
Copy link

I'm also very interested in this and would love to help if necessary.

@kaitoy
Copy link
Owner

kaitoy commented Aug 6, 2017

Sorry for my late response. Currently I don't have enough time for Pcap4J...
Actually, this PR has some problems. I will explain them tomorrow.

Copy link
Owner

@kaitoy kaitoy left a comment

Choose a reason for hiding this comment

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

In addition to comments in line, getRawFields, buildString, calcHashCode, and equals must be modified with consideration of element order.

private final Dot11InterworkingElement interworking;
private final Dot11MeshIdElement meshId;
private final List<Dot11VendorSpecificElement> vendorSpecificElements;
private Dot11SsidElement ssid = null;
Copy link
Owner

Choose a reason for hiding this comment

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

All fields should be final as possible.

private Dot11MeshIdElement meshId = null;
private List<Dot11VendorSpecificElement> vendorSpecificElements = new ArrayList<Dot11VendorSpecificElement>();

private List<Dot11InformationElement> infoElementOrderedList = new LinkedList<Dot11InformationElement>();
Copy link
Owner

Choose a reason for hiding this comment

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

infoElementOrderedList holds the same objects as the other fields such as meshId, which is a bad practice.

int elemLen = elem.length();
offset += elemLen;
length -= elemLen;
short iterCount = 0;
Copy link
Owner

Choose a reason for hiding this comment

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

I want the below code to be replaced with a packet factory like StaticIpV4OptionFactory for maintainability and enhanceability.

* @return infoElementOrderedList
*/
public List<Dot11InformationElement> getInformationElementOrderedList() {
return infoElementOrderedList;
Copy link
Owner

Choose a reason for hiding this comment

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

All fields must be immutable. So, here must make a defensive copy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants