net.clackrouter.ethereal.parser
Class PacketParser

java.lang.Object
  extended by net.clackrouter.ethereal.parser.PacketParser
Direct Known Subclasses:
ARPParser, DefaultParser, EthernetParser, FTPParser, HTTParser, ICMPEchoReplyParser, ICMPEchoRequestParser, ICMPParser, IPv4Parser, LinkStatePacketParser, RIPUpdateParser, TCPParser, UDPParser

public abstract class PacketParser
extends java.lang.Object


Field Summary
protected  int dataLen
           
protected  int dataStart
           
static java.lang.String[] hex
           
protected  int typeLen
           
protected  int typeStart
           
 
Constructor Summary
PacketParser()
           
 
Method Summary
static java.lang.String charFormat(byte[] b)
           
static java.lang.String charFormat(byte[] b, int ofset, int len)
           
static java.lang.String decimalFormat(byte[] b)
           
static java.lang.String decimalFormat(byte[] b, int ofset, int len)
           
 java.lang.String getDst(byte[] packet)
           
abstract  java.lang.String getInfo(byte[] packet)
           
abstract  java.lang.String getProtocol(byte[] packet)
           
 java.lang.String getSrc(byte[] packet)
           
 javax.swing.table.TableModel getTableModel(byte[] bytes)
           
abstract  EtherealTreeNode getTree(byte[] packet)
           
protected  java.lang.Integer getType(byte[] packet)
          You can override this or just set variables typeStart and typeLen
static java.lang.String hexFormat(byte b)
           
 java.lang.String hexFormat(byte[] b, int ofset, int len)
           
static java.lang.String MACFormat(byte[] b)
           
static java.lang.String MACFormat(byte[] b, int ofset, int len)
           
protected  EtherealTreeNode makeNode(java.lang.String string, byte[] packet, int start, int len)
           
protected  EtherealTreeNode makeNode(java.lang.String string, int start, int len)
           
protected  EtherealTreeNode makeNode(java.lang.String string, int value, int start, int len)
           
protected  java.lang.String nextInfo(byte[] packet, java.lang.String parserName)
           
protected  EtherealTreeNode nextNode(byte[] packet, java.lang.String parserName, int headerLen)
           
protected  java.lang.String nextProtocol(byte[] packet, java.lang.String parserName)
           
protected  byte[] strip(byte[] packet)
          You can override this or just set variables dataStart and dataLen.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

typeStart

protected int typeStart

typeLen

protected int typeLen

dataStart

protected int dataStart

dataLen

protected int dataLen

hex

public static final java.lang.String[] hex
Constructor Detail

PacketParser

public PacketParser()
Method Detail

getSrc

public java.lang.String getSrc(byte[] packet)

getDst

public java.lang.String getDst(byte[] packet)

getProtocol

public abstract java.lang.String getProtocol(byte[] packet)

getInfo

public abstract java.lang.String getInfo(byte[] packet)

getTree

public abstract EtherealTreeNode getTree(byte[] packet)

getType

protected java.lang.Integer getType(byte[] packet)
You can override this or just set variables typeStart and typeLen


strip

protected byte[] strip(byte[] packet)
You can override this or just set variables dataStart and dataLen. If dataLen == 0 then it is set to be the packet.length - dataStart


getTableModel

public javax.swing.table.TableModel getTableModel(byte[] bytes)

nextProtocol

protected java.lang.String nextProtocol(byte[] packet,
                                        java.lang.String parserName)

nextInfo

protected java.lang.String nextInfo(byte[] packet,
                                    java.lang.String parserName)

nextNode

protected EtherealTreeNode nextNode(byte[] packet,
                                    java.lang.String parserName,
                                    int headerLen)

makeNode

protected EtherealTreeNode makeNode(java.lang.String string,
                                    int start,
                                    int len)

makeNode

protected EtherealTreeNode makeNode(java.lang.String string,
                                    int value,
                                    int start,
                                    int len)

makeNode

protected EtherealTreeNode makeNode(java.lang.String string,
                                    byte[] packet,
                                    int start,
                                    int len)

MACFormat

public static java.lang.String MACFormat(byte[] b)

MACFormat

public static java.lang.String MACFormat(byte[] b,
                                         int ofset,
                                         int len)

decimalFormat

public static java.lang.String decimalFormat(byte[] b)

decimalFormat

public static java.lang.String decimalFormat(byte[] b,
                                             int ofset,
                                             int len)

hexFormat

public static java.lang.String hexFormat(byte b)

hexFormat

public java.lang.String hexFormat(byte[] b,
                                  int ofset,
                                  int len)

charFormat

public static java.lang.String charFormat(byte[] b)

charFormat

public static java.lang.String charFormat(byte[] b,
                                          int ofset,
                                          int len)