Skip to content
Snippets Groups Projects
Commit dab81a58 authored by Wilson Ng's avatar Wilson Ng
Browse files

Add ICMP Manager [BVS-328]

parent 6fcc36dc
No related branches found
No related tags found
No related merge requests found
/** /**
* Copyright 2011, Big Switch Networks, Inc. * Copyright 2011, Big Switch Networks, Inc.
* Originally created by David Erickson, Stanford University * Originally created by David Erickson, Stanford University
* *
* Licensed under the Apache License, Version 2.0 (the "License"); you may * Licensed under the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License. You may obtain * not use this file except in compliance with the License. You may obtain
* a copy of the License at * a copy of the License at
...@@ -28,6 +28,9 @@ public class ICMP extends BasePacket { ...@@ -28,6 +28,9 @@ public class ICMP extends BasePacket {
protected byte icmpCode; protected byte icmpCode;
protected short checksum; protected short checksum;
public static byte ECHO_REPLY = 0x0;
public static byte ECHO_REQUEST = 0x8;
/** /**
* @return the icmpType * @return the icmpType
*/ */
...@@ -79,6 +82,7 @@ public class ICMP extends BasePacket { ...@@ -79,6 +82,7 @@ public class ICMP extends BasePacket {
* -checksum : 0 * -checksum : 0
* -length : 0 * -length : 0
*/ */
@Override
public byte[] serialize() { public byte[] serialize() {
int length = 4; int length = 4;
byte[] payloadData = null; byte[] payloadData = null;
...@@ -161,7 +165,7 @@ public class ICMP extends BasePacket { ...@@ -161,7 +165,7 @@ public class ICMP extends BasePacket {
this.icmpType = bb.get(); this.icmpType = bb.get();
this.icmpCode = bb.get(); this.icmpCode = bb.get();
this.checksum = bb.getShort(); this.checksum = bb.getShort();
this.payload = new Data(); this.payload = new Data();
this.payload = payload.deserialize(data, bb.position(), bb.limit()-bb.position()); this.payload = payload.deserialize(data, bb.position(), bb.limit()-bb.position());
this.payload.setParent(this); this.payload.setParent(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