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

gov.nist.javax.sip.stack
Class MessageProcessor

java.lang.Object
  extended by gov.nist.javax.sip.stack.MessageProcessor
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
TCPMessageProcessor, TLSMessageProcessor, UDPMessageProcessor

public abstract class MessageProcessor
extends Object
implements Runnable

This is the Stack abstraction for the active object that waits for messages to appear on the wire and processes these messages by calling the MessageFactory interface to create a ServerRequest or ServerResponse object. The main job of the message processor is to instantiate message channels for the given transport.

Version:
1.2 $Revision: 1.15 $ $Date: 2009/07/29 20:38:14 $
Author:
M. Ranganathan

Constructor Summary
MessageProcessor(InetAddress ipAddress, int port, String transport)
          Constructor
 
Method Summary
abstract  MessageChannel createMessageChannel(gov.nist.core.HostPort targetHostPort)
          Create a message channel for the specified host/port.
abstract  MessageChannel createMessageChannel(InetAddress targetHost, int port)
          Create a message channel for the specified host/port.
static int getDefaultPort(String transport)
          Get the defalt port for the message processor.
abstract  int getDefaultTargetPort()
          Default target port used by this processor.
 InetAddress getIpAddress()
           
 ListeningPointImpl getListeningPoint()
           
abstract  int getMaximumMessageSize()
          Maximum number of bytes that this processor can handle.
 int getPort()
          Get the port identifier.
 String getSavedIpAddress()
          Get the saved IP Address.
 String getSentBy()
          Get the sentby string.
abstract  SIPTransactionStack getSIPStack()
          Get the SIP Stack.
 String getTransport()
          Get the transport string.
 Via getViaHeader()
          Get the Via header to assign for this message processor.
abstract  boolean inUse()
          Return true if there are pending messages to be processed (which prevents the message channel from being closed).
abstract  boolean isSecure()
          Flags whether this processor is secure or not.
 boolean isSentBySet()
           
abstract  void run()
          Run method.
 void setListeningPoint(ListeningPointImpl lp)
           
 void setSentBy(String sentBy)
          Set the sentby string.
abstract  void start()
          Start our thread.
abstract  void stop()
          Stop method.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageProcessor

public MessageProcessor(InetAddress ipAddress,
                        int port,
                        String transport)
Constructor

Parameters:
ipAddress - -- ip address where I am listening for incoming requests.
port - -- port where i am listening for incoming requests.
transport - -- transport to use for the message processor (UDP/TCP/TLS).
Method Detail

getTransport

public String getTransport()
Get the transport string.

Returns:
A string that indicates the transport. (i.e. "tcp" or "udp")

getPort

public int getPort()
Get the port identifier.

Returns:
the port for this message processor. This is where you receive messages.

getViaHeader

public Via getViaHeader()
Get the Via header to assign for this message processor. The topmost via header of the outoging messages use this.

Returns:
the ViaHeader to be used by the messages sent via this message processor.

getListeningPoint

public ListeningPointImpl getListeningPoint()

setListeningPoint

public void setListeningPoint(ListeningPointImpl lp)

getSavedIpAddress

public String getSavedIpAddress()
Get the saved IP Address.


getIpAddress

public InetAddress getIpAddress()
Returns:
the ip address for this message processor.

setSentBy

public void setSentBy(String sentBy)
               throws ParseException
Set the sentby string. This is used for stamping outgoing messages sent from this listening point.

Parameters:
sentBy -
Throws:
ParseException

getSentBy

public String getSentBy()
Get the sentby string.


getSIPStack

public abstract SIPTransactionStack getSIPStack()
Get the SIP Stack.

Returns:
the sip stack.

createMessageChannel

public abstract MessageChannel createMessageChannel(gov.nist.core.HostPort targetHostPort)
                                             throws IOException
Create a message channel for the specified host/port.

Returns:
New MessageChannel for this processor.
Throws:
IOException

createMessageChannel

public abstract MessageChannel createMessageChannel(InetAddress targetHost,
                                                    int port)
                                             throws IOException
Create a message channel for the specified host/port.

Returns:
New MessageChannel for this processor.
Throws:
IOException

start

public abstract void start()
                    throws IOException
Start our thread.

Throws:
IOException

stop

public abstract void stop()
Stop method.


getDefaultTargetPort

public abstract int getDefaultTargetPort()
Default target port used by this processor. This is 5060 for TCP / UDP


isSecure

public abstract boolean isSecure()
Flags whether this processor is secure or not.


getMaximumMessageSize

public abstract int getMaximumMessageSize()
Maximum number of bytes that this processor can handle.


inUse

public abstract boolean inUse()
Return true if there are pending messages to be processed (which prevents the message channel from being closed).


run

public abstract void run()
Run method.

Specified by:
run in interface Runnable

isSentBySet

public boolean isSentBySet()
Returns:
Returns the sentBySet.

getDefaultPort

public static int getDefaultPort(String transport)
Get the defalt port for the message processor.

Parameters:
transport -
Returns:
-- the default port for the message processor.

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.