net.sourceforge.jpcap.net
Class EthernetEncoding

java.lang.Object
  |
  +--net.sourceforge.jpcap.net.EthernetEncoding

public class EthernetEncoding
extends java.lang.Object

Ethernet packet encoding.

Contains link-level information encoding information for an ethernet packet.


Constructor Summary
EthernetEncoding()
           
 
Method Summary
static EthernetPacket create(int lLen, byte[] bytes)
          EthernetPacket factory.
static java.lang.String extractMACAddress(int lLen, boolean sourceFlag, byte[] packetBytes)
          Extract a MAC address from an ethernet header.
static int extractTypeCode(byte[] packetBytes)
          Extract the type field from packet data.
 
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

create

public static EthernetPacket create(int lLen,
                                    byte[] bytes)
EthernetPacket factory.

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.

extractMACAddress

public static java.lang.String extractMACAddress(int lLen,
                                                 boolean sourceFlag,
                                                 byte[] packetBytes)
Extract a MAC address from an ethernet header.
Parameters:
sourceFlag - whether the extract query is for the source address.
packetBytes - packet bytes.