net.sourceforge.jpcap.net
Class EthernetEncoding

java.lang.Object
  |
  +--net.sourceforge.jpcap.net.EthernetEncoding
All Implemented Interfaces:
EthernetFields

public class EthernetEncoding
extends java.lang.Object
implements EthernetFields

Ethernet packet encoding.

Contains link-level information encoding information for an ethernet packet and methods for encoding and decoding ethernet headers.


Fields inherited from interface net.sourceforge.jpcap.net.EthernetFields
ETH_CODE_LEN, ETH_CODE_POS, ETH_DST_POS, ETH_HEADER_LEN, ETH_SRC_POS
 
Constructor Summary
EthernetEncoding()
           
 
Method Summary
static int extractTypeCode(byte[] packetBytes)
          Extract the type field from packet data.
static byte[] generateRandomHeader()
          Generate a random ethernet header.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EthernetEncoding

public EthernetEncoding()
Method Detail

generateRandomHeader

public static byte[] generateRandomHeader()
Generate a random ethernet header.

extractTypeCode

public static int extractTypeCode(byte[] packetBytes)
Extract the type field from packet data. The type field indicates what type of data is contained in the packet's data block.
Parameters:
packetBytes - packet bytes.
Returns:
the ethernet type code. i.e. 0x800 signifies IP datagram.