com.voytechs.tools
Class SlyDecoder

java.lang.Object
  extended by com.voytechs.tools.SlyDecoder

public final class SlyDecoder
extends java.lang.Object

Tool class that decoded the contents of a capture file, such as created with 3rd party tools like, tcpdump, ethereal, snoop, LANAnalyzer.
NPL (Network Protocol Language) is used to define various protocols to decoder. It uses the definitions to parse the file according to the defines rules. You can supply the decoder a list of files to decode, with multiple -r options and it will decode one after the other.
Syntax for class usage is SHELL command line based where all parameters are passed into the Main method.


Field Summary
static int PAD_ADDR
           
static int PAD_DADDR
           
static int PAD_INDEX
           
static int PAD_NAME
           
static int PAD_SADDR
           
static int PAD_TIME
           
static int TIME_ABSOLUTE
          Absolute time mode
static int TIME_FROM_PIVOT
          Relative time mode always starting from first packet
static int TIME_FROM_PREVIOUS
          Relative time mode calculated using previous packet
static int TIME_NULL
          This is special flag for first packet
 
Constructor Summary
SlyDecoder()
           
 
Method Summary
static void exit(int code)
          Exit with a no message.
static void exit(int code, java.lang.String message)
          Exit with a message.
static java.lang.String formatDAddr(Packet packet)
           
static java.lang.String formatPacketForMultiLine(Packet packet)
          Format output for a single summary line per header of the packet.
static java.lang.String formatPacketForSingleLine(Packet packet)
          Format output for a single summary line of the entire packet.
static java.lang.String formatSAddr(Packet packet)
           
static java.lang.String formatTime(Packet packet, Packet pivot, int mode)
          Format time for output.
static Filter getFilter()
           
static void main(java.lang.String[] args)
          Main method to envoke SlyDecoder
static java.lang.String toStringStatic()
          Same thing as toString() method, but static version to output out of this mainly static object.
static void usage()
          Send usage to standard output.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TIME_ABSOLUTE

public static final int TIME_ABSOLUTE
Absolute time mode

See Also:
Constant Field Values

TIME_FROM_PIVOT

public static final int TIME_FROM_PIVOT
Relative time mode always starting from first packet

See Also:
Constant Field Values

TIME_FROM_PREVIOUS

public static final int TIME_FROM_PREVIOUS
Relative time mode calculated using previous packet

See Also:
Constant Field Values

TIME_NULL

public static final int TIME_NULL
This is special flag for first packet

See Also:
Constant Field Values

PAD_INDEX

public static final int PAD_INDEX
See Also:
Constant Field Values

PAD_TIME

public static final int PAD_TIME
See Also:
Constant Field Values

PAD_ADDR

public static final int PAD_ADDR
See Also:
Constant Field Values

PAD_SADDR

public static final int PAD_SADDR
See Also:
Constant Field Values

PAD_DADDR

public static final int PAD_DADDR
See Also:
Constant Field Values

PAD_NAME

public static final int PAD_NAME
See Also:
Constant Field Values
Constructor Detail

SlyDecoder

public SlyDecoder()
Method Detail

formatSAddr

public static java.lang.String formatSAddr(Packet packet)

formatDAddr

public static java.lang.String formatDAddr(Packet packet)

formatTime

public static java.lang.String formatTime(Packet packet,
                                          Packet pivot,
                                          int mode)
Format time for output. Time can be formatted in 3 different ways:

Parameters:
packet - Current packet
pivot - Previous or first packet depending on the time mode. In TIME_ABSOLUTE mode, this parameter should be null.
mode - Display time mode as described above. Use one of the predefined constants.

formatPacketForMultiLine

public static java.lang.String formatPacketForMultiLine(Packet packet)
Format output for a single summary line per header of the packet. Each header is checked for a summary line and that line is formatted for output display. If one of the headers doesn't contain a summary line, then the name of the header/protocol is included with a blank space.

Parameters:
packet - Packet to format out for.
index - Index of the packet being formatted.
time - Preformatted time string at the begining of the output line.
Returns:
Multi line of formatted output.

formatPacketForSingleLine

public static java.lang.String formatPacketForSingleLine(Packet packet)
Format output for a single summary line of the entire packet. The last header found in the packet is used as the summary for the entire packet. If the last header doesn't contain a "summary" property, then the header before it is checked, and so on until one is found with a summary property.

Parameters:
packet - Packet to format out for.
index - Index of the packet being formatted.
time - Preformatted time string at the begining of the output line.
Returns:
Single line of formatted output.

usage

public static void usage()
Send usage to standard output.


exit

public static void exit(int code)
Exit with a no message.


exit

public static void exit(int code,
                        java.lang.String message)
Exit with a message.


toStringStatic

public static java.lang.String toStringStatic()
Same thing as toString() method, but static version to output out of this mainly static object.


main

public static void main(java.lang.String[] args)
Main method to envoke SlyDecoder

Parameters:
args - command line arguments. In the form: SlyDecoder []

getFilter

public static Filter getFilter()