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

gov.nist.javax.sip.stack
Class UDPMessageProcessor

java.lang.Object
  extended by gov.nist.javax.sip.stack.MessageProcessor
      extended by gov.nist.javax.sip.stack.UDPMessageProcessor
All Implemented Interfaces:
Runnable

public class UDPMessageProcessor
extends MessageProcessor

Sit in a loop and handle incoming udp datagram messages. For each Datagram packet, a new UDPMessageChannel is created (upto the max thread pool size). Each UDP message is processed in its own thread).

Version:
1.2 $Revision: 1.35 $ $Date: 2009/07/31 00:43:37 $
Author:
M. Ranganathan
See the implementation sequence diagram for processing incoming requests. Acknowledgement: Jeff Keyser contributed ideas on starting and stoppping the stack that were incorporated into this code. Niklas Uhrberg suggested that thread pooling be added to limit the number of threads and improve performance.

Method Summary
 MessageChannel createMessageChannel(gov.nist.core.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 UDP
 int getMaximumMessageSize()
          UDP can handle a message as large as the MAX_DATAGRAM_SIZE.
 int getPort()
          Get port on which to listen for incoming stuff.
 SIPTransactionStack getSIPStack()
          Returns the stack.
 String getTransport()
          Return the transport string.
 boolean inUse()
          Return true if there are any messages in use.
 boolean isSecure()
          UDP is not a secure protocol.
 void run()
          Thread main routine.
 void start()
          Start our processor thread.
 void stop()
          Shut down the message processor.
 
Methods inherited from class gov.nist.javax.sip.stack.MessageProcessor
getDefaultPort, getIpAddress, getListeningPoint, getSavedIpAddress, getSentBy, getViaHeader, isSentBySet, setListeningPoint, setSentBy
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getPort

public int getPort()
Get port on which to listen for incoming stuff.

Overrides:
getPort in class MessageProcessor
Returns:
port on which I am listening.

start

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

Specified by:
start in class MessageProcessor
Throws:
IOException

run

public void run()
Thread main routine.

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

stop

public void stop()
Shut down the message processor. Close the socket for recieving incoming messages.

Specified by:
stop in class MessageProcessor

getTransport

public String getTransport()
Return the transport string.

Overrides:
getTransport in class MessageProcessor
Returns:
the transport string

getSIPStack

public SIPTransactionStack getSIPStack()
Returns the stack.

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

createMessageChannel

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

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

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.
Throws:
IOException

getDefaultTargetPort

public int getDefaultTargetPort()
Default target port for UDP

Specified by:
getDefaultTargetPort in class MessageProcessor

isSecure

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

Specified by:
isSecure in class MessageProcessor

getMaximumMessageSize

public int getMaximumMessageSize()
UDP can handle a message as large as the MAX_DATAGRAM_SIZE.

Specified by:
getMaximumMessageSize in class MessageProcessor

inUse

public boolean inUse()
Return true if there are any messages in use.

Specified by:
inUse in class MessageProcessor

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.