verinec.netsim.firewall.util
Class TraversePackets

java.lang.Object
  extended by verinec.netsim.firewall.util.TraversePackets

public class TraversePackets
extends Object

Utility Class to traverse Packets to access their specific payload.

Version:
$Revision: 825 $
Author:
jason.hug@unifr.ch

Constructor Summary
TraversePackets()
           
 
Method Summary
static ARPPacket getARP(Packet packet)
          Gets the ARP Packet out of the payload of a Data Link Packet.
static IPPacket getIP(Packet packet)
          Gets the IP Packet out of the payload of a Data Link Packet.
static TCPPacket getTCP(Packet packet)
          Gets the TCP packet out of the payload of a Data Link Packet.
static UDPPacket getUDP(Packet packet)
          Gets the UDP packet out of the payload of a Data Link Packet.
static boolean isEthernet(Packet packet)
          This method checks if the packet has a Data Link header.
private static void log(String log)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TraversePackets

public TraversePackets()
Method Detail

isEthernet

public static boolean isEthernet(Packet packet)
This method checks if the packet has a Data Link header.

Parameters:
packet - The Packet to be checked.
Returns:
True if Data Link header is present in the packet.

getIP

public static IPPacket getIP(Packet packet)
Gets the IP Packet out of the payload of a Data Link Packet.

Parameters:
packet - The Data Link packet from which to get the IP packet from.
Returns:
IPPacket if IP payload is present. Null otherwise.

getARP

public static ARPPacket getARP(Packet packet)
Gets the ARP Packet out of the payload of a Data Link Packet.

Parameters:
packet - The Data Link packet from which to get the IP packet from.
Returns:
ARPPacket if ARP payload is present. Null otherwise.

getUDP

public static UDPPacket getUDP(Packet packet)
Gets the UDP packet out of the payload of a Data Link Packet.

Parameters:
packet - The Data Link packet from which to get the UDP packet from.
Returns:
UDPPacket if UDP payload is present. Null otherwise.

getTCP

public static TCPPacket getTCP(Packet packet)
Gets the TCP packet out of the payload of a Data Link Packet.

Parameters:
packet - The Data Link packet from which to get the TCP packet from.
Returns:
TCPPacket if TCP payload is present. Null otherwise.

log

private static void log(String log)

Copyright © 2005 Verinec, DIUF