NIST-SIP: The Reference Implementation for JAIN-SIP 1.2

gov.nist.javax.sip.parser
Class PipelinedMsgParser

java.lang.Object
  extended by gov.nist.javax.sip.parser.PipelinedMsgParser
All Implemented Interfaces:
Runnable

public final class PipelinedMsgParser
extends Object
implements Runnable

This implements a pipelined message parser suitable for use with a stream - oriented input such as TCP. The client uses this class by instatiating with an input stream from which input is read and fed to a message parser. It keeps reading from the input stream and process messages in a never ending interpreter loop. The message listener interface gets called for processing messages or for processing errors. The payload specified by the content-length header is read directly from the input stream. This can be accessed from the SIPMessage using the getContent and getContentBytes methods provided by the SIPMessage class.

Version:
1.2 $Revision: 1.23 $ $Date: 2009/08/16 17:28:28 $
Author:
M. Ranganathan
See Also:
SIPMessageListener

Constructor Summary
PipelinedMsgParser(Pipeline in)
          This is the constructor for the pipelined parser.
PipelinedMsgParser(SIPMessageListener sipMessageListener, Pipeline in, boolean debug, int maxMessageSize)
          Constructor when we are given a message listener and an input stream (could be a TCP connection or a file)
PipelinedMsgParser(SIPMessageListener mhandler, Pipeline in, int maxMsgSize)
          This is the constructor for the pipelined parser.
 
Method Summary
 void close()
           
 void processInput()
          Start reading and processing input.
 void run()
          This is input reading thread for the pipelined parser.
 void setMessageListener(SIPMessageListener mlistener)
          Add a class that implements a SIPMessageListener interface whose methods get called * on successful parse and error conditons.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PipelinedMsgParser

public PipelinedMsgParser(SIPMessageListener sipMessageListener,
                          Pipeline in,
                          boolean debug,
                          int maxMessageSize)
Constructor when we are given a message listener and an input stream (could be a TCP connection or a file)

Parameters:
sipMessageListener - Message listener which has methods that get called back from the parser when a parse is complete
in - Input stream from which to read the input.
debug - Enable/disable tracing or lexical analyser switch.

PipelinedMsgParser

public PipelinedMsgParser(SIPMessageListener mhandler,
                          Pipeline in,
                          int maxMsgSize)
This is the constructor for the pipelined parser.

Parameters:
mhandler - a SIPMessageListener implementation that provides the message handlers to handle correctly and incorrectly parsed messages.
in - An input stream to read messages from.

PipelinedMsgParser

public PipelinedMsgParser(Pipeline in)
This is the constructor for the pipelined parser.

Parameters:
in - - An input stream to read messages from.
Method Detail

processInput

public void processInput()
Start reading and processing input.


setMessageListener

public void setMessageListener(SIPMessageListener mlistener)
Add a class that implements a SIPMessageListener interface whose methods get called * on successful parse and error conditons.

Parameters:
mlistener - a SIPMessageListener implementation that can react to correct and incorrect pars.

run

public void run()
This is input reading thread for the pipelined parser. You feed it input through the input stream (see the constructor) and it calls back an event listener interface for message processing or error. It cleans up the input - dealing with things like line continuation

Specified by:
run in interface Runnable

close

public void close()

NIST-SIP: The Reference Implementation for JAIN-SIP 1.2

A product of the NIST/ITL Advanced Networking Technologies Division.
See conditions of use.
Submit a bug report or feature request.