java.lang.Object
com.voytechs.jnetstream.npl.Visitor
com.voytechs.jnetstream.codec.Decoder
- Direct Known Subclasses:
- FilterDecoder
- public class Decoder
- extends com.voytechs.jnetstream.npl.Visitor
|
Method Summary |
protected void |
exportGlobalProperties(com.voytechs.jnetstream.npl.Context global)
|
protected void |
exportPacketProperties(com.voytechs.jnetstream.npl.Context packet)
|
void |
link(com.voytechs.jnetstream.npl.NodeList block)
Link code in the block. |
protected com.voytechs.jnetstream.npl.StatementContainer |
lookupTopLevelHeader(java.lang.String name)
|
static void |
main(java.lang.String[] args)
Test function for Decoder |
Packet |
nextPacket()
Decode the next packet based on previously initialized PacketInputStream
and the parsed NPL AST. |
Packet |
nextPacketWithEOP()
Processes the next packet in the packet-byte-stream. |
com.voytechs.jnetstream.io.PacketInputStream |
openCaptureFile(java.lang.String file)
Open capture file. |
protected java.io.InputStream |
openFile(java.lang.String file)
Convenience method that opens up a new file while closing the old one. |
protected com.voytechs.jnetstream.npl.NodeList |
parse(com.voytechs.jnetstream.npl.ExpTokenizer tokens)
Parse NPL based on the tokenizer stream. |
void |
parse(java.lang.String file)
Parse a file with the given name. |
boolean |
traverse(com.voytechs.jnetstream.npl.AssertStatement stat,
java.lang.Object user1,
java.lang.Object user2)
|
boolean |
traverse(com.voytechs.jnetstream.npl.BreakStatement stat,
java.lang.Object user1,
java.lang.Object user2)
|
boolean |
traverse(com.voytechs.jnetstream.npl.ContinueStatement stat,
java.lang.Object user1,
java.lang.Object user2)
|
boolean |
traverse(com.voytechs.jnetstream.npl.FamilyStatement stat,
java.lang.Object user1,
java.lang.Object user2)
|
boolean |
traverse(com.voytechs.jnetstream.npl.FieldStatement stat,
java.lang.Object user1,
java.lang.Object user2)
FIELD STATEMENT |
boolean |
traverse(com.voytechs.jnetstream.npl.ForStatement stat,
java.lang.Object user1,
java.lang.Object user2)
|
boolean |
traverse(com.voytechs.jnetstream.npl.HeaderStatement stat,
java.lang.Object user1,
java.lang.Object user2)
|
boolean |
traverse(com.voytechs.jnetstream.npl.IfStatement stat,
java.lang.Object user1,
java.lang.Object user2)
|
boolean |
traverse(com.voytechs.jnetstream.npl.LinkStatement stat,
java.lang.Object user1,
java.lang.Object user2)
|
boolean |
traverse(com.voytechs.jnetstream.npl.OpNode node,
java.lang.Object user1,
java.lang.Object user2)
Convenience function that dispatches visitor to all nodes in the list. |
boolean |
traverse(com.voytechs.jnetstream.npl.PrintStatement stat,
java.lang.Object user1,
java.lang.Object user2)
|
boolean |
traverse(com.voytechs.jnetstream.npl.PropertyStatement stat,
java.lang.Object user1,
java.lang.Object user2)
|
boolean |
traverse(com.voytechs.jnetstream.npl.VariableStatement stat,
java.lang.Object user1,
java.lang.Object user2)
|
boolean |
traverse(com.voytechs.jnetstream.npl.WhileStatement stat,
java.lang.Object user1,
java.lang.Object user2)
|
protected void |
updateProperty(java.lang.String name,
com.voytechs.jnetstream.npl.Context context,
int value)
|
protected void |
updateProperty(java.lang.String name,
com.voytechs.jnetstream.npl.Context context,
com.voytechs.jnetstream.primitive.address.IpAddress value)
|
protected void |
updateProperty(java.lang.String name,
com.voytechs.jnetstream.npl.Context context,
long value)
|
protected void |
updateProperty(java.lang.String name,
com.voytechs.jnetstream.npl.Context context,
java.lang.String value)
|
protected void |
updateProperty(java.lang.String name,
com.voytechs.jnetstream.npl.Context context,
java.sql.Timestamp value)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DEBUG_DEFAULT
public static final int DEBUG_DEFAULT
- See Also:
- Constant Field Values
DEBUG_STREAM
public static final int DEBUG_STREAM
- See Also:
- Constant Field Values
debug
private static final boolean debug
- See Also:
- Constant Field Values
debugLevel
private static final int debugLevel
- See Also:
- Constant Field Values
PROTOCOL_PATH
public static final java.lang.String PROTOCOL_PATH
- See Also:
- Constant Field Values
FILE_FORMATS
public static final java.lang.String FILE_FORMATS
- See Also:
- Constant Field Values
globalTable
private com.voytechs.jnetstream.npl.SymTable globalTable
packetTable
private com.voytechs.jnetstream.npl.SymTable packetTable
globalContext
private com.voytechs.jnetstream.npl.Context globalContext
in
private com.voytechs.jnetstream.io.PacketInputStream in
root
private com.voytechs.jnetstream.npl.NodeList root
packet
private Packet packet
header
private Header header
field
private Field field
linkedField
private com.voytechs.jnetstream.npl.FieldStatement linkedField
perm
private java.util.Hashtable perm
fileStream
private java.io.InputStream fileStream
Decoder
public Decoder(com.voytechs.jnetstream.io.PacketInputStream in)
throws java.io.FileNotFoundException,
java.io.IOException,
com.voytechs.jnetstream.npl.SyntaxError
Decoder
public Decoder(java.lang.String captureFile)
throws java.io.FileNotFoundException,
java.io.IOException,
com.voytechs.jnetstream.npl.SyntaxError
Decoder
public Decoder(java.lang.String captureFile,
java.lang.String nplFile)
throws java.io.FileNotFoundException,
java.io.IOException,
com.voytechs.jnetstream.npl.SyntaxError
Decoder
public Decoder(com.voytechs.jnetstream.io.PacketInputStream in,
java.lang.String nplFile)
throws java.io.FileNotFoundException,
java.io.IOException,
com.voytechs.jnetstream.npl.SyntaxError
openCaptureFile
public com.voytechs.jnetstream.io.PacketInputStream openCaptureFile(java.lang.String file)
throws java.io.FileNotFoundException,
java.io.IOException
- Open capture file. The format of the file is
checked and appropriate File reader is used.
openFile
protected java.io.InputStream openFile(java.lang.String file)
throws java.io.FileNotFoundException
- Convenience method that opens up a new file while closing the old one.
parse
public void parse(java.lang.String file)
throws java.io.FileNotFoundException,
com.voytechs.jnetstream.npl.SyntaxError
- Parse a file with the given name.
parse
protected com.voytechs.jnetstream.npl.NodeList parse(com.voytechs.jnetstream.npl.ExpTokenizer tokens)
throws com.voytechs.jnetstream.npl.SyntaxError
- Parse NPL based on the tokenizer stream.
link
public void link(com.voytechs.jnetstream.npl.NodeList block)
throws com.voytechs.jnetstream.npl.SyntaxError,
com.voytechs.jnetstream.npl.NodeException
- Link code in the block.
nextPacket
public Packet nextPacket()
throws com.voytechs.jnetstream.io.StreamFormatException,
java.io.IOException,
com.voytechs.jnetstream.npl.SyntaxError
- Decode the next packet based on previously initialized PacketInputStream
and the parsed NPL AST.
nextPacketWithEOP
public Packet nextPacketWithEOP()
throws com.voytechs.jnetstream.npl.NodeException,
com.voytechs.jnetstream.io.EOPacketStream,
com.voytechs.jnetstream.io.StreamFormatException,
java.io.IOException
- Processes the next packet in the packet-byte-stream. A number of exceptions
can be thrown by this method. A Packet object is returned containing all of the
headers that could be parsed.
exportPacketProperties
protected void exportPacketProperties(com.voytechs.jnetstream.npl.Context packet)
exportGlobalProperties
protected void exportGlobalProperties(com.voytechs.jnetstream.npl.Context global)
updateProperty
protected void updateProperty(java.lang.String name,
com.voytechs.jnetstream.npl.Context context,
com.voytechs.jnetstream.primitive.address.IpAddress value)
updateProperty
protected void updateProperty(java.lang.String name,
com.voytechs.jnetstream.npl.Context context,
java.lang.String value)
updateProperty
protected void updateProperty(java.lang.String name,
com.voytechs.jnetstream.npl.Context context,
int value)
updateProperty
protected void updateProperty(java.lang.String name,
com.voytechs.jnetstream.npl.Context context,
long value)
updateProperty
protected void updateProperty(java.lang.String name,
com.voytechs.jnetstream.npl.Context context,
java.sql.Timestamp value)
lookupTopLevelHeader
protected com.voytechs.jnetstream.npl.StatementContainer lookupTopLevelHeader(java.lang.String name)
throws com.voytechs.jnetstream.npl.NodeException
traverse
public boolean traverse(com.voytechs.jnetstream.npl.FamilyStatement stat,
java.lang.Object user1,
java.lang.Object user2)
throws com.voytechs.jnetstream.npl.NodeException
traverse
public boolean traverse(com.voytechs.jnetstream.npl.HeaderStatement stat,
java.lang.Object user1,
java.lang.Object user2)
throws com.voytechs.jnetstream.npl.NodeException
traverse
public boolean traverse(com.voytechs.jnetstream.npl.VariableStatement stat,
java.lang.Object user1,
java.lang.Object user2)
throws com.voytechs.jnetstream.npl.NodeException
traverse
public boolean traverse(com.voytechs.jnetstream.npl.FieldStatement stat,
java.lang.Object user1,
java.lang.Object user2)
throws com.voytechs.jnetstream.npl.NodeException
- FIELD STATEMENT
traverse
public boolean traverse(com.voytechs.jnetstream.npl.AssertStatement stat,
java.lang.Object user1,
java.lang.Object user2)
throws com.voytechs.jnetstream.npl.NodeException
traverse
public boolean traverse(com.voytechs.jnetstream.npl.LinkStatement stat,
java.lang.Object user1,
java.lang.Object user2)
throws com.voytechs.jnetstream.npl.NodeException
traverse
public boolean traverse(com.voytechs.jnetstream.npl.OpNode node,
java.lang.Object user1,
java.lang.Object user2)
throws com.voytechs.jnetstream.npl.NodeException
- Description copied from class:
com.voytechs.jnetstream.npl.Visitor
- Convenience function that dispatches visitor to all nodes in the list.
traverse
public boolean traverse(com.voytechs.jnetstream.npl.IfStatement stat,
java.lang.Object user1,
java.lang.Object user2)
throws com.voytechs.jnetstream.npl.NodeException
traverse
public boolean traverse(com.voytechs.jnetstream.npl.ForStatement stat,
java.lang.Object user1,
java.lang.Object user2)
throws com.voytechs.jnetstream.npl.NodeException
traverse
public boolean traverse(com.voytechs.jnetstream.npl.WhileStatement stat,
java.lang.Object user1,
java.lang.Object user2)
throws com.voytechs.jnetstream.npl.NodeException
traverse
public boolean traverse(com.voytechs.jnetstream.npl.ContinueStatement stat,
java.lang.Object user1,
java.lang.Object user2)
throws com.voytechs.jnetstream.npl.NodeException
traverse
public boolean traverse(com.voytechs.jnetstream.npl.BreakStatement stat,
java.lang.Object user1,
java.lang.Object user2)
throws com.voytechs.jnetstream.npl.NodeException
traverse
public boolean traverse(com.voytechs.jnetstream.npl.PrintStatement stat,
java.lang.Object user1,
java.lang.Object user2)
throws com.voytechs.jnetstream.npl.NodeException
traverse
public boolean traverse(com.voytechs.jnetstream.npl.PropertyStatement stat,
java.lang.Object user1,
java.lang.Object user2)
throws com.voytechs.jnetstream.npl.NodeException
main
public static void main(java.lang.String[] args)
- Test function for Decoder