org.jnetpcap.protocol.network
Class Arp

java.lang.Object
  extended by org.jnetpcap.nio.JMemory
      extended by org.jnetpcap.nio.JBuffer
          extended by org.jnetpcap.packet.JHeader
              extended by org.jnetpcap.protocol.network.Arp
All Implemented Interfaces:
JPayloadAccessor

@Header
public class Arp
extends JHeader

Address Resolution Protocol header. ARP is used to translate protocol addresses to hardware interface addresses.

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Nested Class Summary
static class Arp.HardwareType
          Definitions for ARP supported hardware types.
static class Arp.OpCode
          Definitions for all the possible ARP operations as specified by the operation field.
static class Arp.ProtocolType
          Definitions for supported protocol types.
 
Nested classes/interfaces inherited from class org.jnetpcap.packet.JHeader
JHeader.State
 
Nested classes/interfaces inherited from class org.jnetpcap.nio.JMemory
JMemory.Type
 
Field Summary
 
Fields inherited from class org.jnetpcap.packet.JHeader
annotatedHeader, BYTE, EMPTY_HEADER_ARRAY, isSubHeader, packet, state
 
Fields inherited from class org.jnetpcap.nio.JMemory
JNETPCAP_LIBRARY_NAME, MAX_DIRECT_MEMORY_DEFAULT, POINTER
 
Constructor Summary
Arp()
           
 
Method Summary
protected  void decodeHeader()
          Decode header.
 int hardwareType()
          Hardware type.
 java.lang.String hardwareTypeDescription()
          Hardware type description.
 Arp.HardwareType hardwareTypeEnum()
          Hardware type enum.
static int headerLength(JBuffer buffer, int offset)
          Header length.
 int hlen()
          Hlen.
 int operation()
          Operation.
 java.lang.String operationDescription()
          Operation description.
 Arp.OpCode operationEnum()
          Operation enum.
 int plen()
          Plen.
 int protocolType()
          Protocol type.
 java.lang.String protocolTypeDescription()
          Protocol type description.
 Arp.ProtocolType protocolTypeEnum()
          Protocol type enum.
 byte[] sha()
          Sha.
 int shaLength()
          Sha length.
 byte[] spa()
          Spa.
 int spaLength()
          Spa length.
 int spaOffset()
          Spa offset.
 byte[] tha()
          Tha.
 int thaLength()
          Tha length.
 int thaOffset()
          Tha offset.
 byte[] tpa()
          Tpa.
 int tpaLength()
          Tpa length.
 int tpaOffset()
          Tpa offset.
 
Methods inherited from class org.jnetpcap.packet.JHeader
decode, getAnnotatedHeader, getDescription, getFields, getGap, getGapLength, getGapOffset, getHeader, getHeaderLength, getHeaderOffset, getId, getIndex, getLength, getName, getNextHeaderId, getNextHeaderOffset, getNicname, getOffset, getPacket, getParent, getPayload, getPayloadLength, getPayloadOffset, getPostfix, getPostfixLength, getPostfixOffset, getPrefix, getPrefixLength, getPrefixOffset, getPreviousHeaderId, getPreviousHeaderOffset, getState, getSubHeaders, hasDescription, hasGap, hasNextHeader, hasPayload, hasPostfix, hasPrefix, hasPreviousHeader, hasSubHeaders, isFragmented, isGapTruncated, isHeaderTruncated, isPayloadTruncated, isPostfixTruncated, isPrefixTruncated, peer, peer, peerPayloadTo, setPacket, setSubHeaders, sizeof, toString, transferPayloadTo, transferPayloadTo, transferPayloadTo, validateHeader
 
Methods inherited from class org.jnetpcap.nio.JBuffer
findUTF8String, getByte, getByteArray, getByteArray, getByteArray, getDouble, getFloat, getInt, getLong, getShort, getUByte, getUInt, getUShort, getUTF8Char, getUTF8String, getUTF8String, getUTF8String, getUTF8String, isReadonly, order, order, peer, peer, peer, peer, setByte, setByteArray, setByteBuffer, setDouble, setFloat, setInt, setLong, setShort, setShort0, setUByte, setUInt, setUShort, transferFrom, transferFrom, transferFrom, transferTo, transferTo, transferTo
 
Methods inherited from class org.jnetpcap.nio.JMemory
availableDirectMemory, check, cleanup, createReference, isInitialized, isJMemoryBasedOwner, isOwner, maxDirectMemory, peer, reservedDirectMemory, setSize, size, softDirectMemory, toDebugString, toHexdump, toHexdump, totalActiveAllocated, totalAllocateCalls, totalAllocated, totalAllocatedSegments0To255Bytes, totalAllocatedSegments256OrAbove, totalDeAllocateCalls, totalDeAllocated, transferFrom, transferFrom, transferFromDirect, transferOwnership, transferTo, transferTo, transferTo, transferTo, transferTo, transferTo0
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Arp

public Arp()
Method Detail

headerLength

@HeaderLength
public static int headerLength(JBuffer buffer,
                                            int offset)
Header length.

Parameters:
buffer - the buffer
offset - the offset
Returns:
the int

hardwareTypeDescription

@Dynamic(value=DESCRIPTION)
public java.lang.String hardwareTypeDescription()
Hardware type description.

Returns:
the string

hardwareType

@Field(offset=0,
       length=16)
public int hardwareType()
Hardware type.

Returns:
the int

hardwareTypeEnum

public Arp.HardwareType hardwareTypeEnum()
Hardware type enum.

Returns:
the hardware type

protocolType

@Field(offset=16,
       format="%x",
       length=16)
public int protocolType()
Protocol type.

Returns:
the int

protocolTypeDescription

@Dynamic(value=DESCRIPTION)
public java.lang.String protocolTypeDescription()
Protocol type description.

Returns:
the string

protocolTypeEnum

public Arp.ProtocolType protocolTypeEnum()
Protocol type enum.

Returns:
the protocol type

hlen

@Field(offset=32,
       length=8,
       units="bytes",
       display="hardware size")
public int hlen()
Hlen.

Returns:
the int

plen

@Field(offset=40,
       length=8,
       units="bytes",
       display="protocol size")
public int plen()
Plen.

Returns:
the int

operationDescription

@Dynamic(value=DESCRIPTION)
public java.lang.String operationDescription()
Operation description.

Returns:
the string

operation

@Field(offset=48,
       length=16,
       display="op code")
public int operation()
Operation.

Returns:
the int

operationEnum

public Arp.OpCode operationEnum()
Operation enum.

Returns:
the op code

sha

@Field(offset=64,
       format="#mac#",
       display="sender MAC")
public byte[] sha()
Sha.

Returns:
the byte[]

shaLength

@Dynamic(value=LENGTH)
public int shaLength()
Sha length.

Returns:
the int

spa

@Field(format="#ip4#",
       display="sender IP")
public byte[] spa()
Spa.

Returns:
the byte[]

spaOffset

@Dynamic(value=OFFSET)
public int spaOffset()
Spa offset.

Returns:
the int

spaLength

@Dynamic(value=LENGTH)
public int spaLength()
Spa length.

Returns:
the int

tha

@Field(format="#mac#",
       display="target MAC")
public byte[] tha()
Tha.

Returns:
the byte[]

thaOffset

@Dynamic(value=OFFSET)
public int thaOffset()
Tha offset.

Returns:
the int

thaLength

@Dynamic(value=LENGTH)
public int thaLength()
Tha length.

Returns:
the int

tpa

@Field(format="#ip4#",
       display="target IP")
public byte[] tpa()
Tpa.

Returns:
the byte[]

tpaOffset

@Dynamic(value=OFFSET)
public int tpaOffset()
Tpa offset.

Returns:
the int

tpaLength

@Dynamic(value=LENGTH)
public int tpaLength()
Tpa length.

Returns:
the int

decodeHeader

protected void decodeHeader()
Decode header.

Overrides:
decodeHeader in class JHeader
See Also:
JHeader.decodeHeader()