org.jnetpcap.protocol.lan
Class IEEE802dot3

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.lan.IEEE802dot3
All Implemented Interfaces:
JPayloadAccessor

@Header(length=14,
        dlt=IEEE802)
public class IEEE802dot3
extends JHeader

IEEE 802.3 data link header definition

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Nested Class Summary
 
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
static int ID
          The Constant ID.
 
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
IEEE802dot3()
           
 
Method Summary
 long calculateChecksum()
          Calculates a checksum using protocol specification for a header.
 long checksum()
          Retrieves the header's checksum.
 boolean checksumCheck()
          Checks if FCS is available for this Ethernet frame.
 java.lang.String checksumDescription()
          Checksum description.
 int checksumOffset()
          Calculates the offset of the FCS field within the Ethernet frame.
 byte[] destination()
          Destination.
 void destination(byte[] array)
          Destination.
 byte[] destinationToByteArray(byte[] array)
          Destination to byte array.
 int length()
          Length.
 void length(int len)
          Length.
 byte[] source()
          Source.
 void source(byte[] array)
          Source.
 byte[] sourceToByteArray(byte[] array)
          Source to byte array.
 
Methods inherited from class org.jnetpcap.packet.JHeader
decode, decodeHeader, 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
 

Field Detail

ID

public static final int ID
The Constant ID.

See Also:
Constant Field Values
Constructor Detail

IEEE802dot3

public IEEE802dot3()
Method Detail

destination

@Field(offset=0,
       length=48,
       format="#mac#")
public byte[] destination()
Destination.

Returns:
the byte[]

destinationToByteArray

public byte[] destinationToByteArray(byte[] array)
Destination to byte array.

Parameters:
array - the array
Returns:
the byte[]

destination

public void destination(byte[] array)
Destination.

Parameters:
array - the array

source

@Field(offset=48,
       length=48,
       format="#mac#")
public byte[] source()
Source.

Returns:
the byte[]

source

public void source(byte[] array)
Source.

Parameters:
array - the array

sourceToByteArray

public byte[] sourceToByteArray(byte[] array)
Source to byte array.

Parameters:
array - the array
Returns:
the byte[]

length

@Field(offset=96,
       length=16,
       format="%d")
public int length()
Length.

Returns:
the int

length

public void length(int len)
Length.

Parameters:
len - the len

checksumCheck

@Dynamic(field="checksum",
         value=CHECK)
public boolean checksumCheck()
Checks if FCS is available for this Ethernet frame. FCS is typically stripped by the OS and not provided to Libpcap/jNetPcap on most platforms.

Returns:
true if FCS is present, otherwise false

checksumOffset

@Dynamic(value=OFFSET)
public int checksumOffset()
Calculates the offset of the FCS field within the Ethernet frame.

Returns:
offset, in bits, from the start of the packet buffer

checksumDescription

@Dynamic(value=DESCRIPTION)
public java.lang.String checksumDescription()
Checksum description.

Returns:
the string

checksum

@Field(length=32,
       format="%x",
       display="FCS")
public long checksum()
Retrieves the header's checksum.

Returns:
header's stored checksum

calculateChecksum

public long calculateChecksum()
Calculates a checksum using protocol specification for a header. Checksums for partial headers or fragmented packets (unless the protocol allows it) are not calculated.

Returns:
header's calculated checksum