gov.nist.javax.sip.stack
クラス SIPMessageStack

java.lang.Object
  上位を拡張 gov.nist.javax.sip.stack.SIPMessageStack
直系の既知のサブクラス:
SIPTransactionStack

public abstract class SIPMessageStack
extends java.lang.Object

This class defines a SIP Stack. In order to build a SIP server (UAS/UAC or Proxy etc.) you need to extend this class and instantiate it in your application. After you have done so, call createMessageProcessor to create message processors and then start these message processors to get the stack the process messages. This will start the necessary threads that wait for incoming SIP messages.

バージョン:
JAIN-SIP-1.1 $Revision: 1.4 $ $Date: 2004/08/30 16:04:47 $
作成者:
M. Ranganathan
Jeff Keyser suggested that MessageProcessors be accessible and applications should have control over message processors. IPv6 Support added by Emil Ivov (emil_ivov@yahoo.com)
Network Research Team (http://www-r2.u-strasbg.fr))
Louis Pasteur University - Strasbourg - France
This code is in the public domain.

フィールドの概要
static int DEFAULT_PORT
          Default UDP port (5060)
 
コンストラクタの概要
SIPMessageStack()
          Default constructor.
SIPMessageStack(StackMessageFactory messageFactory, java.lang.String stackAddress, java.lang.String stackName)
          Construcor for the stack.
 
メソッドの概要
 void addMessageProcessor(MessageProcessor newMessageProcessor)
          Adds a new MessageProcessor to the list of running processors for this SIPStack and starts it.
 MessageChannel createMessageChannel(javax.sip.address.Hop nextHop)
          Creates a new MessageChannel for a given Hop.
 MessageProcessor createMessageProcessor(int port, java.lang.String transport)
          Creates the equivalent of a JAIN listening point and attaches to the stack.
 java.lang.String getBadMessageLog()
          Get the file name of the bad message log.
 javax.sip.address.Hop getDefaultRoute()
          Get the default route.
 Route getDefaultRouteHeader()
          Get the route header corresponding to the default route.
 java.lang.String getHostAddress()
          Get my address.
 LogWriter getLogWriter()
           
 int getMaxMessageSize()
           
 MessageProcessor getMessageProcessor(java.lang.String transport)
          Get a message processor for the given transport.
 MessageProcessor[] getMessageProcessors()
          Gets an array of running MessageProcessors on this SIPStack.
 javax.sip.address.Hop getNextHop()
          Get the default next hop from the router.
 java.util.Iterator getNextHop(SIPRequest sipRequest)
          Get the default route string.
 int getPort(java.lang.String transport)
          get port of the message processor (based on the transport).
 Route getRouteHeader(javax.sip.address.Hop hop)
          Get the route header for this hop.
 javax.sip.address.Router getRouter()
          Get the router algorithm.
 ServerLog getServerLog()
           
 java.lang.String getStackName()
          Get the Stack name.
 boolean isAlive()
          return the status of the toExit flag.
 boolean isTransportEnabled(java.lang.String transport)
          Return true if a transport is enabled.
 boolean isTransportEnabled(java.lang.String transport, int port)
          Return true if the transport is enabled for a given port.
 void logBadMessage(java.lang.String message)
          Log a bad message (invoked when a parse exception arises).
 void logMessage(java.lang.String message)
          debug log writer.
 void logStackTrace()
          Log the stack trace.
 ServerRequestInterface newSIPServerRequest(SIPRequest siprequest, MessageChannel msgchan)
          Generate a new SIPSeverRequest from the given SIPRequest.
 ServerResponseInterface newSIPServerResponse(SIPResponse sipresponse, MessageChannel msgchan)
          Generate a new SIPSeverResponse from the given SIPResponse.
 void removeMessageProcessor(MessageProcessor oldMessageProcessor)
          Removes a MessageProcessor from this SIPStack.
 void setMaxConnections(int nconnections)
          Set the max # of simultaneously handled TCP connections.
 void setRouter(javax.sip.address.Router router)
          Set the router algorithm.
 void setSingleThreaded()
          Set the flag that instructs the stack to only start a single thread for sequentially processing incoming udp messages (thus serializing the processing).
 void setStackMessageFactory(StackMessageFactory messageFactory)
          Set the server Request and response factories.
 void setStackName(java.lang.String stackName)
          Set the descriptive name of the stack.
 void setThreadPoolSize(int size)
          Set the thread pool size for processing incoming UDP messages.
 void stopStack()
          Make the stack close all accept connections and return.
 
クラス java.lang.Object から継承されたメソッド
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

フィールドの詳細

DEFAULT_PORT

public static final int DEFAULT_PORT
Default UDP port (5060)

関連項目:
定数フィールド値
コンストラクタの詳細

SIPMessageStack

public SIPMessageStack(StackMessageFactory messageFactory,
                       java.lang.String stackAddress,
                       java.lang.String stackName)
                throws java.net.UnknownHostException
Construcor for the stack. Registers the request and response factories for the stack.

パラメータ:
messageFactory - User-implemented factory for processing messages.
stackAddress - -- IP address or host name of the stack.
stackName - -- descriptive name for the stack.
例外:
java.net.UnknownHostException

SIPMessageStack

public SIPMessageStack()
Default constructor.

メソッドの詳細

logBadMessage

public void logBadMessage(java.lang.String message)
Log a bad message (invoked when a parse exception arises).

パラメータ:
message - is a string that contains the bad message to log.

logMessage

public void logMessage(java.lang.String message)
debug log writer.

パラメータ:
message - is the message to log.

getLogWriter

public LogWriter getLogWriter()

getServerLog

public ServerLog getServerLog()

getMaxMessageSize

public int getMaxMessageSize()

logStackTrace

public void logStackTrace()
Log the stack trace.


getBadMessageLog

public java.lang.String getBadMessageLog()
Get the file name of the bad message log.

戻り値:
the file where bad messages are logged.

setSingleThreaded

public void setSingleThreaded()
Set the flag that instructs the stack to only start a single thread for sequentially processing incoming udp messages (thus serializing the processing). Caution: If the user-defined function called by the processing thread blocks, then the entire server will block. This feature was requested by Lamine Brahimi (IBM Zurich).


setThreadPoolSize

public void setThreadPoolSize(int size)
Set the thread pool size for processing incoming UDP messages. Limit the total number of threads for processing udp messages. Caution: If the user-defined function called by the processing thread blocks, then the entire server will block.


setMaxConnections

public void setMaxConnections(int nconnections)
Set the max # of simultaneously handled TCP connections.


getNextHop

public java.util.Iterator getNextHop(SIPRequest sipRequest)
Get the default route string.

パラメータ:
sipRequest - is the request for which we want to compute the next hop.

setStackMessageFactory

public void setStackMessageFactory(StackMessageFactory messageFactory)
Set the server Request and response factories.

パラメータ:
messageFactory - User-implemented factory for processing messages.

setStackName

public void setStackName(java.lang.String stackName)
Set the descriptive name of the stack.

パラメータ:
stackName - -- descriptive name of the stack.

getStackName

public java.lang.String getStackName()
Get the Stack name.

戻り値:
name of the stack.

getHostAddress

public java.lang.String getHostAddress()
Get my address.

戻り値:
hostAddress - my host address.

getNextHop

public javax.sip.address.Hop getNextHop()
Get the default next hop from the router.


getPort

public int getPort(java.lang.String transport)
get port of the message processor (based on the transport). If multiple ports are enabled for the same transport then the first one is retrieved.

パラメータ:
transport - is the transport for which to get the port.

isTransportEnabled

public boolean isTransportEnabled(java.lang.String transport)
Return true if a transport is enabled.

パラメータ:
transport - is the transport to check.

isTransportEnabled

public boolean isTransportEnabled(java.lang.String transport,
                                  int port)
Return true if the transport is enabled for a given port.

パラメータ:
transport - transport to check
port - port to check transport at.

newSIPServerRequest

public ServerRequestInterface newSIPServerRequest(SIPRequest siprequest,
                                                  MessageChannel msgchan)
Generate a new SIPSeverRequest from the given SIPRequest. A SIPServerRequest is generated by the application SIPServerRequestFactoryImpl. The application registers the factory implementation at the time the stack is initialized.

パラメータ:
siprequest - SIPRequest for which we want to generate thsi SIPServerRequest.
msgchan - Message channel for the request for which we want to generate the SIPServerRequest
戻り値:
Generated SIPServerRequest.

newSIPServerResponse

public ServerResponseInterface newSIPServerResponse(SIPResponse sipresponse,
                                                    MessageChannel msgchan)
Generate a new SIPSeverResponse from the given SIPResponse.

パラメータ:
sipresponse - SIPResponse from which the SIPServerResponse is to be generated. Note - this just calls the factory interface to do its work. The factory interface is provided by the user.
msgchan - Message channel for the SIPServerResponse
戻り値:
SIPServerResponse generated from this SIP Response

setRouter

public void setRouter(javax.sip.address.Router router)
Set the router algorithm.

パラメータ:
router - A class that implements the Router interface.

getRouter

public javax.sip.address.Router getRouter()
Get the router algorithm.

戻り値:
Router router

getDefaultRoute

public javax.sip.address.Hop getDefaultRoute()
Get the default route.


getRouteHeader

public Route getRouteHeader(javax.sip.address.Hop hop)
Get the route header for this hop.

戻り値:
the route header for the hop.

getDefaultRouteHeader

public Route getDefaultRouteHeader()
Get the route header corresponding to the default route.


isAlive

public boolean isAlive()
return the status of the toExit flag.

戻り値:
true if the stack object is alive and false otherwise.

stopStack

public void stopStack()
Make the stack close all accept connections and return. This is useful if you want to start/stop the stack several times from your application. Caution : use of this function could cause peculiar bugs as messages are prcessed asynchronously by the stack.


addMessageProcessor

public void addMessageProcessor(MessageProcessor newMessageProcessor)
                         throws java.io.IOException
Adds a new MessageProcessor to the list of running processors for this SIPStack and starts it. You can use this method for dynamic stack configuration. Acknowledgement: This code is contributed by Jeff Keyser.

例外:
java.io.IOException

removeMessageProcessor

public void removeMessageProcessor(MessageProcessor oldMessageProcessor)
Removes a MessageProcessor from this SIPStack. Acknowledgement: Code contributed by Jeff Keyser.

パラメータ:
oldMessageProcessor -

getMessageProcessors

public MessageProcessor[] getMessageProcessors()
Gets an array of running MessageProcessors on this SIPStack. Acknowledgement: Jeff Keyser suggested that applications should have access to the running message processors and contributed this code.

戻り値:
an array of running message processors.

getMessageProcessor

public MessageProcessor getMessageProcessor(java.lang.String transport)
Get a message processor for the given transport.


createMessageProcessor

public MessageProcessor createMessageProcessor(int port,
                                               java.lang.String transport)
                                        throws java.io.IOException
Creates the equivalent of a JAIN listening point and attaches to the stack.

例外:
java.io.IOException

createMessageChannel

public MessageChannel createMessageChannel(javax.sip.address.Hop nextHop)
                                    throws java.net.UnknownHostException
Creates a new MessageChannel for a given Hop.

パラメータ:
nextHop - Hop to create a MessageChannel to.
戻り値:
A MessageChannel to the specified Hop, or null if no MessageProcessors support contacting that Hop.
例外:
UnknwonHostException - If the host in the Hop doesn't exist.
java.net.UnknownHostException