Skip to content
Snippets Groups Projects
Commit 1dce3e86 authored by Srinivasan Ramasubramanian's avatar Srinivasan Ramasubramanian
Browse files

Adding isTruncated field to the IPv4. It is set to true of the totalLength...

Adding isTruncated field to the IPv4. It is set to true of the totalLength doesn't match the byte[] length during deserialization.
parent cba2d346
No related branches found
No related tags found
No related merge requests found
......@@ -57,12 +57,15 @@ public class IPv4 extends BasePacket {
protected int destinationAddress;
protected byte[] options;
protected boolean isTruncated;
/**
* Default constructor that sets the version to 4.
*/
public IPv4() {
super();
this.version = 4;
isTruncated = false;
}
/**
......@@ -116,6 +119,14 @@ public class IPv4 extends BasePacket {
return identification;
}
public boolean isTruncated() {
return isTruncated;
}
public void setTruncated(boolean isTruncated) {
this.isTruncated = isTruncated;
}
/**
* @param identification the identification to set
*/
......@@ -357,6 +368,9 @@ public class IPv4 extends BasePacket {
}
this.payload = payload.deserialize(data, bb.position(), bb.limit()-bb.position());
this.payload.setParent(this);
if (this.totalLength != length) this.isTruncated = true;
return this;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment