net.floodlightcontroller.packet
Class ARP

java.lang.Object
  extended by net.floodlightcontroller.packet.BasePacket
      extended by net.floodlightcontroller.packet.ARP
All Implemented Interfaces:
IPacket

public class ARP
extends BasePacket

Author:
David Erickson (daviderickson@cs.stanford.edu)

Field Summary
protected  byte hardwareAddressLength
           
protected  short hardwareType
           
static short HW_TYPE_ETHERNET
           
static short OP_RARP_REPLY
           
static short OP_RARP_REQUEST
           
static short OP_REPLY
           
static short OP_REQUEST
           
protected  short opCode
           
static short PROTO_TYPE_IP
           
protected  byte protocolAddressLength
           
protected  short protocolType
           
protected  byte[] senderHardwareAddress
           
protected  byte[] senderProtocolAddress
           
protected  byte[] targetHardwareAddress
           
protected  byte[] targetProtocolAddress
           
 
Fields inherited from class net.floodlightcontroller.packet.BasePacket
log, parent, payload
 
Constructor Summary
ARP()
           
 
Method Summary
 IPacket deserialize(byte[] data, int offset, int length)
          Deserializes this packet layer and all possible payloads
 boolean equals(java.lang.Object obj)
           
 byte getHardwareAddressLength()
           
 short getHardwareType()
           
 short getOpCode()
           
 byte getProtocolAddressLength()
           
 short getProtocolType()
           
 byte[] getSenderHardwareAddress()
           
 byte[] getSenderProtocolAddress()
           
 byte[] getTargetHardwareAddress()
           
 byte[] getTargetProtocolAddress()
           
 int hashCode()
           
 boolean isGratuitous()
           
 byte[] serialize()
          Sets all payloads parent packet if applicable, then serializes this packet and all payloads
 ARP setHardwareAddressLength(byte hardwareAddressLength)
           
 ARP setHardwareType(short hardwareType)
           
 ARP setOpCode(short opCode)
           
 ARP setProtocolAddressLength(byte protocolAddressLength)
           
 ARP setProtocolType(short protocolType)
           
 ARP setSenderHardwareAddress(byte[] senderHardwareAddress)
           
 ARP setSenderProtocolAddress(byte[] senderProtocolAddress)
           
 ARP setSenderProtocolAddress(int address)
           
 ARP setTargetHardwareAddress(byte[] targetHardwareAddress)
           
 ARP setTargetProtocolAddress(byte[] targetProtocolAddress)
           
 ARP setTargetProtocolAddress(int address)
           
 java.lang.String toString()
           
 
Methods inherited from class net.floodlightcontroller.packet.BasePacket
clone, getParent, getPayload, resetChecksum, setParent, setPayload
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

HW_TYPE_ETHERNET

public static short HW_TYPE_ETHERNET

PROTO_TYPE_IP

public static short PROTO_TYPE_IP

OP_REQUEST

public static short OP_REQUEST

OP_REPLY

public static short OP_REPLY

OP_RARP_REQUEST

public static short OP_RARP_REQUEST

OP_RARP_REPLY

public static short OP_RARP_REPLY

hardwareType

protected short hardwareType

protocolType

protected short protocolType

hardwareAddressLength

protected byte hardwareAddressLength

protocolAddressLength

protected byte protocolAddressLength

opCode

protected short opCode

senderHardwareAddress

protected byte[] senderHardwareAddress

senderProtocolAddress

protected byte[] senderProtocolAddress

targetHardwareAddress

protected byte[] targetHardwareAddress

targetProtocolAddress

protected byte[] targetProtocolAddress
Constructor Detail

ARP

public ARP()
Method Detail

getHardwareType

public short getHardwareType()
Returns:
the hardwareType

setHardwareType

public ARP setHardwareType(short hardwareType)
Parameters:
hardwareType - the hardwareType to set

getProtocolType

public short getProtocolType()
Returns:
the protocolType

setProtocolType

public ARP setProtocolType(short protocolType)
Parameters:
protocolType - the protocolType to set

getHardwareAddressLength

public byte getHardwareAddressLength()
Returns:
the hardwareAddressLength

setHardwareAddressLength

public ARP setHardwareAddressLength(byte hardwareAddressLength)
Parameters:
hardwareAddressLength - the hardwareAddressLength to set

getProtocolAddressLength

public byte getProtocolAddressLength()
Returns:
the protocolAddressLength

setProtocolAddressLength

public ARP setProtocolAddressLength(byte protocolAddressLength)
Parameters:
protocolAddressLength - the protocolAddressLength to set

getOpCode

public short getOpCode()
Returns:
the opCode

setOpCode

public ARP setOpCode(short opCode)
Parameters:
opCode - the opCode to set

getSenderHardwareAddress

public byte[] getSenderHardwareAddress()
Returns:
the senderHardwareAddress

setSenderHardwareAddress

public ARP setSenderHardwareAddress(byte[] senderHardwareAddress)
Parameters:
senderHardwareAddress - the senderHardwareAddress to set

getSenderProtocolAddress

public byte[] getSenderProtocolAddress()
Returns:
the senderProtocolAddress

setSenderProtocolAddress

public ARP setSenderProtocolAddress(byte[] senderProtocolAddress)
Parameters:
senderProtocolAddress - the senderProtocolAddress to set

setSenderProtocolAddress

public ARP setSenderProtocolAddress(int address)

getTargetHardwareAddress

public byte[] getTargetHardwareAddress()
Returns:
the targetHardwareAddress

setTargetHardwareAddress

public ARP setTargetHardwareAddress(byte[] targetHardwareAddress)
Parameters:
targetHardwareAddress - the targetHardwareAddress to set

getTargetProtocolAddress

public byte[] getTargetProtocolAddress()
Returns:
the targetProtocolAddress

isGratuitous

public boolean isGratuitous()
Returns:
True if gratuitous ARP (SPA = TPA), false otherwise

setTargetProtocolAddress

public ARP setTargetProtocolAddress(byte[] targetProtocolAddress)
Parameters:
targetProtocolAddress - the targetProtocolAddress to set

setTargetProtocolAddress

public ARP setTargetProtocolAddress(int address)

serialize

public byte[] serialize()
Description copied from interface: IPacket
Sets all payloads parent packet if applicable, then serializes this packet and all payloads

Returns:
a byte[] containing this packet and payloads

deserialize

public IPacket deserialize(byte[] data,
                           int offset,
                           int length)
                    throws PacketParsingException
Description copied from interface: IPacket
Deserializes this packet layer and all possible payloads

offset - offset to start deserializing from
length - length of the data to deserialize
Returns:
the deserialized data
Throws:
PacketParsingException

hashCode

public int hashCode()
Overrides:
hashCode in class BasePacket

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class BasePacket

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object