NIST SIP Parser and Stack (v1.2) API

gov.nist.javax.sip.stack
Class TCPMessageProcessor

java.lang.Object
  |
  +--gov.nist.javax.sip.stack.MessageProcessor
        |
        +--gov.nist.javax.sip.stack.TCPMessageProcessor
All Implemented Interfaces:
Runnable

public class TCPMessageProcessor
extends MessageProcessor

Sit in a loop waiting for incoming tcp connections and start a new thread to handle each new connection. This is the active object that creates new TCP MessageChannels (one for each new accept socket).

Version:
JAIN-SIP-1.1
Author:
M. Ranganathan
Acknowledgement: Jeff Keyser suggested that a Stop mechanism be added to this. Niklas Uhrberg suggested that a means to limit the number of simultaneous active connections should be added. This code is in the public domain.

Method Summary
 MessageChannel createMessageChannel(HostPort targetHostPort)
          Create and return new TCPMessageChannel for the given host/port.
 MessageChannel createMessageChannel(InetAddress host, int port)
          Create a message channel for the specified host/port.
 int getDefaultTargetPort()
          Default target port for TCP
 int getMaximumMessageSize()
          TCP can handle an unlimited number of bytes.
 String getNAPTRService()
          TCP NAPTR service name.
 int getPort()
          Returns the port that we are listening on.
 SIPStack getSIPStack()
          Returns the stack.
 String getSRVPrefix()
          TCP SRV prefix.
 String getTransport()
          Return the transport string.
 boolean inUse()
          Return true if there are pending messages to be processed (which prevents the message channel from being closed).
 boolean isSecure()
          TCP is not a secure protocol.
 void run()
          Run method for the thread that gets created for each accept socket.
 void start()
          Start the processor.
 void stop()
          Stop the message processor.
 
Methods inherited from class gov.nist.javax.sip.stack.MessageProcessor
getViaHeader
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

start

public void start()
           throws IOException
Start the processor.

Specified by:
start in class MessageProcessor
IOException

run

public void run()
Run method for the thread that gets created for each accept socket.

Specified by:
run in interface Runnable
Specified by:
run in class MessageProcessor

getTransport

public String getTransport()
Return the transport string.

Specified by:
getTransport in class MessageProcessor
Returns:
the transport string

getPort

public int getPort()
Returns the port that we are listening on.

Specified by:
getPort in class MessageProcessor
Returns:
Port address for the tcp accept.

getSIPStack

public SIPStack getSIPStack()
Returns the stack.

Specified by:
getSIPStack in class MessageProcessor
Returns:
my sip stack.

stop

public void stop()
Stop the message processor. Feature suggested by Jeff Keyser.

Specified by:
stop in class MessageProcessor

createMessageChannel

public MessageChannel createMessageChannel(HostPort targetHostPort)
                                    throws IOException
Create and return new TCPMessageChannel for the given host/port.

Specified by:
createMessageChannel in class MessageProcessor
Returns:
New MessageChannel for this processor.
IOException

createMessageChannel

public MessageChannel createMessageChannel(InetAddress host,
                                           int port)
                                    throws IOException
Description copied from class: MessageProcessor
Create a message channel for the specified host/port.

Specified by:
createMessageChannel in class MessageProcessor
Returns:
New MessageChannel for this processor.
IOException

getMaximumMessageSize

public int getMaximumMessageSize()
TCP can handle an unlimited number of bytes.

Specified by:
getMaximumMessageSize in class MessageProcessor

getNAPTRService

public String getNAPTRService()
TCP NAPTR service name.


getSRVPrefix

public String getSRVPrefix()
TCP SRV prefix.


inUse

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

Specified by:
inUse in class MessageProcessor

getDefaultTargetPort

public int getDefaultTargetPort()
Default target port for TCP

Specified by:
getDefaultTargetPort in class MessageProcessor

isSecure

public boolean isSecure()
TCP is not a secure protocol.

Specified by:
isSecure in class MessageProcessor

NIST SIP Parser and Stack (v1.2) API

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