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

java.lang.Object
  上位を拡張 gov.nist.javax.sip.stack.MessageChannel
      上位を拡張 gov.nist.javax.sip.stack.TCPMessageChannel
すべての実装されたインタフェース:
ParseExceptionListener, SIPMessageListener, java.lang.Runnable

public final class TCPMessageChannel
extends MessageChannel
implements SIPMessageListener, java.lang.Runnable

This is stack for TCP connections. This abstracts a stream of parsed messages. The SIP stack starts this from the main SIPStack class for each connection that it accepts. It starts a message parser in its own thread and talks to the message parser via a pipe. The message parser calls back via the parseError or processMessage functions that are defined as part of the SIPMessageListener interface.

バージョン:
JAIN-SIP-1.1 $Revision: 1.31 $ $Date: 2004/08/23 23:56:20 $ This code is in the public domain.
作成者:
M. Ranganathan
Acknowedgement: Ahmet Uyar sent in a bug report for TCP operation of the JAIN stack. Niklas Uhrberg suggested that a mechanism be added to limit the number of simultaneous open connections.
関連項目:
PipelinedMsgParser

メソッドの概要
 void close()
          Close the message channel.
 boolean equals(java.lang.Object other)
          Equals predicate.
 java.lang.String getKey()
          Get an identifying key.
 java.lang.String getPeerAddress()
          get the address of the client that sent the data to us.
 int getPeerPort()
          Get the port of the peer to whom we are sending messages.
 java.lang.String getPeerProtocol()
           
 SIPMessageStack getSIPStack()
          Get my SIP Stack.
 java.lang.String getTransport()
          get the transport string.
 java.lang.String getViaHost()
          Get the host to assign to outgoing messages.
 int getViaPort()
          Get the port for outgoing messages sent from the channel.
 void handleException(java.text.ParseException ex, SIPMessage sipMessage, java.lang.Class hdrClass, java.lang.String header, java.lang.String message)
          Exception processor for exceptions detected from the parser.
 boolean isReliable()
          Returns "true" as this is a reliable transport.
 boolean isSecure()
          TCP Is not a secure protocol.
 void processMessage(SIPMessage sipMessage)
          Gets invoked by the parser as a callback on successful message parsing (i.e. no parser errors).
 void run()
          This gets invoked when thread.start is called from the constructor.
 void sendMessage(byte[] message, java.net.InetAddress receiverAddress, int receiverPort, boolean retry)
          Send a message to a specified address.
 void sendMessage(SIPMessage sipMessage)
          Return a formatted message to the client.
 
クラス gov.nist.javax.sip.stack.MessageChannel から継承されたメソッド
getHost, getHostPort, getKey, getKey, getMessageProcessor, getPeerHostPort, getPort, getRawIpSourceAddress, getViaHeader, getViaHostPort, logResponse, sendMessage
 
クラス java.lang.Object から継承されたメソッド
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

メソッドの詳細

isReliable

public boolean isReliable()
Returns "true" as this is a reliable transport.

定義:
クラス MessageChannel 内の isReliable
戻り値:
True if reliable, false if not.

close

public void close()
Close the message channel.

定義:
クラス MessageChannel 内の close

getSIPStack

public SIPMessageStack getSIPStack()
Get my SIP Stack.

定義:
クラス MessageChannel 内の getSIPStack
戻り値:
The SIP Stack for this message channel.

getTransport

public java.lang.String getTransport()
get the transport string.

定義:
クラス MessageChannel 内の getTransport
戻り値:
"tcp" in this case.

getPeerAddress

public java.lang.String getPeerAddress()
get the address of the client that sent the data to us.

定義:
クラス MessageChannel 内の getPeerAddress
戻り値:
Address of the client that sent us data that resulted in this channel being created.

getPeerProtocol

public java.lang.String getPeerProtocol()

sendMessage

public void sendMessage(SIPMessage sipMessage)
                 throws java.io.IOException
Return a formatted message to the client. We try to re-connect with the peer on the other end if possible.

定義:
クラス MessageChannel 内の sendMessage
パラメータ:
sipMessage - Message to send.
例外:
java.io.IOException - If there is an error sending the message

sendMessage

public void sendMessage(byte[] message,
                        java.net.InetAddress receiverAddress,
                        int receiverPort,
                        boolean retry)
                 throws java.io.IOException
Send a message to a specified address.

パラメータ:
message - Pre-formatted message to send.
receiverAddress - Address to send it to.
receiverPort - Receiver port.
例外:
java.io.IOException - If there is a problem connecting or sending.

handleException

public void handleException(java.text.ParseException ex,
                            SIPMessage sipMessage,
                            java.lang.Class hdrClass,
                            java.lang.String header,
                            java.lang.String message)
                     throws java.text.ParseException
Exception processor for exceptions detected from the parser. (This is invoked by the parser when an error is detected).

定義:
インタフェース ParseExceptionListener 内の handleException
パラメータ:
sipMessage - -- the message that incurred the error.
ex - -- parse exception detected by the parser.
header - -- header that caused the error.
message - -- message where this header was detected.
例外:
java.text.ParseException - Thrown if we want to reject the message.

processMessage

public void processMessage(SIPMessage sipMessage)
                    throws java.lang.Exception
Gets invoked by the parser as a callback on successful message parsing (i.e. no parser errors).

定義:
インタフェース SIPMessageListener 内の processMessage
パラメータ:
sipMessage - Mesage to process (this calls the application for processing the message).
例外:
java.lang.Exception
関連項目:
for the method that gets called on parse exception.

run

public void run()
This gets invoked when thread.start is called from the constructor. Implements a message loop - reading the tcp connection and processing messages until we are done or the other end has closed.

定義:
インタフェース java.lang.Runnable 内の run

equals

public boolean equals(java.lang.Object other)
Equals predicate.

オーバーライド:
クラス java.lang.Object 内の equals
パラメータ:
other - is the other object to compare ourselves to for equals

getKey

public java.lang.String getKey()
Get an identifying key. This key is used to cache the connection and re-use it if necessary.

定義:
クラス MessageChannel 内の getKey

getViaHost

public java.lang.String getViaHost()
Get the host to assign to outgoing messages.

定義:
クラス MessageChannel 内の getViaHost
戻り値:
the host to assign to the via header.

getViaPort

public int getViaPort()
Get the port for outgoing messages sent from the channel.

定義:
クラス MessageChannel 内の getViaPort
戻り値:
the port to assign to the via header.

getPeerPort

public int getPeerPort()
Get the port of the peer to whom we are sending messages.

定義:
クラス MessageChannel 内の getPeerPort
戻り値:
the peer port.

isSecure

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

定義:
クラス MessageChannel 内の isSecure