public class ARP extends BasePacket
| Modifier and Type | Field and Description |
|---|---|
protected byte |
hardwareAddressLength |
protected short |
hardwareType |
static short |
HW_TYPE_ETHERNET |
static short |
INITIAL_HEADER_LENGTH |
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 |
parent, payload| Constructor and Description |
|---|
ARP() |
| Modifier and Type | Method and Description |
|---|---|
static Ethernet |
buildArpReply(Ip4Address srcIp,
MacAddress srcMac,
Ethernet request)
Builds an ARP reply based on a request.
|
static Ethernet |
buildArpRequest(byte[] senderMacAddress,
byte[] senderIpAddress,
byte[] targetMacAddress,
byte[] targetIpAddress,
byte[] destinationMacAddress,
short vlanId)
Builds an ARP request using the supplied parameters.
|
static Ethernet |
buildArpRequest(byte[] senderMacAddress,
byte[] senderIpAddress,
byte[] targetIpAddress,
short vlanId)
Builds an ARP request using the supplied parameters.
|
static Deserializer<ARP> |
deserializer()
Deserializer function for ARP packets.
|
ARP |
duplicate()
Make an exact copy of the ARP packet.
|
boolean |
equals(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 hwAddressLength) |
ARP |
setHardwareType(short hwType) |
ARP |
setOpCode(short op) |
ARP |
setProtocolAddressLength(byte protoAddressLength) |
ARP |
setProtocolType(short protoType) |
ARP |
setSenderHardwareAddress(byte[] senderHWAddress) |
ARP |
setSenderProtocolAddress(byte[] senderProtoAddress) |
ARP |
setSenderProtocolAddress(int address) |
ARP |
setTargetHardwareAddress(byte[] targetHWAddress) |
ARP |
setTargetProtocolAddress(byte[] targetProtoAddress) |
ARP |
setTargetProtocolAddress(int address) |
String |
toString() |
clone, getParent, getPayload, resetChecksum, setParent, setPayloadpublic static final short HW_TYPE_ETHERNET
public static final short PROTO_TYPE_IP
public static final short OP_REQUEST
public static final short OP_REPLY
public static final short OP_RARP_REQUEST
public static final short OP_RARP_REPLY
public static final short INITIAL_HEADER_LENGTH
protected short hardwareType
protected short protocolType
protected byte hardwareAddressLength
protected byte protocolAddressLength
protected short opCode
protected byte[] senderHardwareAddress
protected byte[] senderProtocolAddress
protected byte[] targetHardwareAddress
protected byte[] targetProtocolAddress
public short getHardwareType()
public ARP setHardwareType(short hwType)
hwType - the hardwareType to setpublic short getProtocolType()
public ARP setProtocolType(short protoType)
protoType - the protocolType to setpublic byte getHardwareAddressLength()
public ARP setHardwareAddressLength(byte hwAddressLength)
hwAddressLength - the hardwareAddressLength to setpublic byte getProtocolAddressLength()
public ARP setProtocolAddressLength(byte protoAddressLength)
protoAddressLength - the protocolAddressLength to setpublic short getOpCode()
public ARP setOpCode(short op)
op - the opCode to setpublic byte[] getSenderHardwareAddress()
public ARP setSenderHardwareAddress(byte[] senderHWAddress)
senderHWAddress - the senderHardwareAddress to setpublic byte[] getSenderProtocolAddress()
public ARP setSenderProtocolAddress(byte[] senderProtoAddress)
senderProtoAddress - the senderProtocolAddress to setpublic ARP setSenderProtocolAddress(int address)
public byte[] getTargetHardwareAddress()
public ARP setTargetHardwareAddress(byte[] targetHWAddress)
targetHWAddress - the targetHardwareAddress to setpublic byte[] getTargetProtocolAddress()
public boolean isGratuitous()
public ARP setTargetProtocolAddress(byte[] targetProtoAddress)
targetProtoAddress - the targetProtocolAddress to setpublic ARP setTargetProtocolAddress(int address)
public byte[] serialize()
IPacketpublic int hashCode()
hashCode in class BasePacketpublic boolean equals(Object obj)
equals in class BasePacketpublic static Ethernet buildArpRequest(byte[] senderMacAddress, byte[] senderIpAddress, byte[] targetMacAddress, byte[] targetIpAddress, byte[] destinationMacAddress, short vlanId)
senderMacAddress - the mac address of the sendersenderIpAddress - the ip address of the sendertargetMacAddress - the mac address of the targettargetIpAddress - the ip address to resolvedestinationMacAddress - the mac address put in Ethernet headervlanId - the vlan idpublic static Ethernet buildArpRequest(byte[] senderMacAddress, byte[] senderIpAddress, byte[] targetIpAddress, short vlanId)
senderMacAddress - the mac address of the sendersenderIpAddress - the ip address of the sendertargetIpAddress - the ip address to resolvevlanId - the vlan idpublic static Ethernet buildArpReply(Ip4Address srcIp, MacAddress srcMac, Ethernet request)
srcIp - the IP address to use as the reply sourcesrcMac - the MAC address to use as the reply sourcerequest - the ARP request we gotpublic static Deserializer<ARP> deserializer()
public ARP duplicate()