org.jnetpcap.protocol.lan
Class SLL

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

@Header(length=16,
        suite=LAN,
        description="Linux Cooked Capture")
public class SLL
extends JHeader

For captures on Linux cooked sockets, we construct a fake header that includes: a 2-byte "packet type" which is one of: LINUX_SLL_HOST packet was sent to us LINUX_SLL_BROADCAST packet was broadcast LINUX_SLL_MULTICAST packet was multicast LINUX_SLL_OTHERHOST packet was sent to somebody else LINUX_SLL_OUTGOING packet was sent *by* us; a 2-byte Ethernet protocol field; a 2-byte link-layer type; a 2-byte link-layer address length; an 8-byte source link-layer address, whose actual length is specified by the previous value. All fields except for the link-layer address are in network byte order. DO NOT change the layout of this structure, or change any of the LINUX_SLL_ values below. If you must change the link-layer header for a "cooked" Linux capture, introduce a new DLT_ type (ask "tcpdump-workers@lists.tcpdump.org" for one, so that you don't give it a value that collides with a value already being used), and use the new header in captures of that type, so that programs that can handle DLT_LINUX_SLL captures will continue to handle them correctly without any change, and so that capture files with different headers can be told apart and programs that read them can dissect the packets in them.

Author:
Mark Bednarczyk, Sly Technologies, Inc.
  #define SLL_HDR_LEN   16                        // total header length
  #define SLL_ADDRLEN   8                           // length of address field
 
  struct sll_header {
    u_int16_t   sll_pkttype;              // packet type
    u_int16_t   sll_hatype;                 // link-layer address type
    u_int16_t   sll_halen;                  // link-layer address length
    u_int8_t    sll_addr[SLL_ADDRLEN];  // link-layer address
    u_int16_t   sll_protocol;           // protocol
  };
 
 

Nested Class Summary
static class SLL.HardwareAddressType
          The Enum HardwareAddressType.
 
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
          Constant numerial ID for this protocol's header.
static int LINUX_SLL_BROADCAST
          The Constant LINUX_SLL_BROADCAST.
static int LINUX_SLL_HOST
          The Constant LINUX_SLL_HOST.
static int LINUX_SLL_MULTICAST
          The Constant LINUX_SLL_MULTICAST.
static int LINUX_SLL_OTHERHOST
          The Constant LINUX_SLL_OTHERHOST.
static int LINUX_SLL_OUTGOING
          The Constant LINUX_SLL_OUTGOING.
static int SLL_HDR_LEN
          The Constant SLL_HDR_LEN.
 
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
SLL()
           
 
Method Summary
 byte[] address()
          Link layer address.
 int addressLength()
          Link Layer address length.
 int haLength()
          Link Layer address length.
 int haType()
          Link Layer address type.
 SLL.HardwareAddressType haTypeEnum()
          Ha type enum.
 int packetType()
          Packet type.
 int type()
          next protocol.
 Ethernet.EthernetType typeEnum()
          Next protocol as an EtherType constant.
 
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

SLL_HDR_LEN

public static final int SLL_HDR_LEN
The Constant SLL_HDR_LEN.

See Also:
Constant Field Values

LINUX_SLL_HOST

public static final int LINUX_SLL_HOST
The Constant LINUX_SLL_HOST.

See Also:
Constant Field Values

LINUX_SLL_BROADCAST

public static final int LINUX_SLL_BROADCAST
The Constant LINUX_SLL_BROADCAST.

See Also:
Constant Field Values

LINUX_SLL_MULTICAST

public static final int LINUX_SLL_MULTICAST
The Constant LINUX_SLL_MULTICAST.

See Also:
Constant Field Values

LINUX_SLL_OTHERHOST

public static final int LINUX_SLL_OTHERHOST
The Constant LINUX_SLL_OTHERHOST.

See Also:
Constant Field Values

LINUX_SLL_OUTGOING

public static final int LINUX_SLL_OUTGOING
The Constant LINUX_SLL_OUTGOING.

See Also:
Constant Field Values

ID

public static int ID
Constant numerial ID for this protocol's header.

Constructor Detail

SLL

public SLL()
Method Detail

packetType

@Field(offset=0,
       length=16)
public int packetType()
Packet type.

Returns:
packet type

haType

@Field(offset=16,
       length=16)
public int haType()
Link Layer address type.

Returns:
address type

haTypeEnum

public SLL.HardwareAddressType haTypeEnum()
Ha type enum.

Returns:
the hardware address type

haLength

@Field(offset=32,
       length=16)
public int haLength()
Link Layer address length.

Returns:
address length in bytes

addressLength

@Dynamic(value=LENGTH)
public int addressLength()
Link Layer address length.

Returns:
address length in bits

address

@Field(offset=48,
       format="#mac#")
public byte[] address()
Link layer address.

Returns:
address

type

@Field(offset=112,
       length=16,
       format="%x")
public int type()
next protocol.

Returns:
next protocol

typeEnum

public Ethernet.EthernetType typeEnum()
Next protocol as an EtherType constant.

Returns:
next protocol