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

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

public class UDPMessageChannel
extends MessageChannel
implements ParseExceptionListener, java.lang.Runnable

This is the UDP Message handler that gets created when a UDP message needs to be processed. The message is processed by creating a String Message parser and invoking it on the message read from the UPD socket. The parsed structure is handed off via a SIP stack request for further processing. This stack structure isolates the message handling logic from the mechanics of sending and recieving messages (which could be either udp or tcp.

バージョン:
JAIN-SIP-1.1 $Revision: 1.25 $ $Date: 2004/09/07 20:13:06 $
作成者:
M. Ranganathan , M. Ranganathan
This code is in the public domain. Acknowledgement: Kim Kirby of Keyvoice suggested that duplicate checking should be added to the stack (later removed). Lamine Brahimi suggested a single threaded behavior flag be added to this. Niklas Uhrberg suggested that thread pooling support be added to this for performance and resource management. Peter Parnes found a bug with this code that was sending it into an infinite loop when a bad incoming message was parsed.
関連項目:
StringMsgParser, ServerRequestInterface

メソッドの概要
 void close()
          Close the message channel.
 boolean equals(java.lang.Object other)
          Compare two UDP Message channels for equality.
 java.lang.String getHost()
          get the stack address for the stack that received this message.
 java.lang.String getKey()
          Generate a key which identifies the message channel.
 java.lang.String getPeerAddress()
          get the address of the host that sent me the message
 java.lang.String getPeerName()
          get the name (address) of the host that sent me the message
 int getPeerPort()
          Get the sender port ( the port of the other end that sent me the message).
 java.lang.String getPeerProtocol()
           
 int getPort()
          get the port.
 SIPMessageStack getSIPStack()
          get the stack pointer.
 java.lang.String getTransport()
          Return a transport string.
 java.lang.String getViaHost()
          Get the logical originator of the message (from the top via header).
 int getViaPort()
          Get the logical port of the message orginator (from the top via hdr).
 void handleException(java.text.ParseException ex, SIPMessage sipMessage, java.lang.Class hdrClass, java.lang.String header, java.lang.String message)
          Implementation of the ParseExceptionListener interface.
 boolean isReliable()
          Returns "false" as this is an unreliable transport.
 boolean isSecure()
          UDP is not a secure protocol.
 void run()
          Run method specified by runnnable.
 void sendMessage(SIPMessage sipMessage)
          Return a reply from a pre-constructed reply.
 
クラス gov.nist.javax.sip.stack.MessageChannel から継承されたメソッド
getHostPort, getKey, getKey, getMessageProcessor, getPeerHostPort, getRawIpSourceAddress, getViaHeader, getViaHostPort, logResponse, sendMessage
 
クラス java.lang.Object から継承されたメソッド
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

メソッドの詳細

run

public void run()
Run method specified by runnnable.

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

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
Implementation of the ParseExceptionListener interface.

定義:
インタフェース ParseExceptionListener 内の handleException
パラメータ:
ex - Exception that is given to us by the parser.
sipMessage - -- sip message being processed.
header - -- header/RL/SL text being parsed.
message - -- message where this header was detected.
例外:
java.text.ParseException - If we choose to reject the header or message.

sendMessage

public void sendMessage(SIPMessage sipMessage)
                 throws java.io.IOException
Return a reply from a pre-constructed reply. This sends the message back to the entity who caused us to create this channel in the first place.

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

getSIPStack

public SIPMessageStack getSIPStack()
get the stack pointer.

定義:
クラス MessageChannel 内の getSIPStack
戻り値:
The sip stack for this channel.

getTransport

public java.lang.String getTransport()
Return a transport string.

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

getHost

public java.lang.String getHost()
get the stack address for the stack that received this message.

オーバーライド:
クラス MessageChannel 内の getHost
戻り値:
The stack address for our stack.

getPort

public int getPort()
get the port.

オーバーライド:
クラス MessageChannel 内の getPort
戻り値:
Our port (on which we are getting datagram packets).

getPeerName

public java.lang.String getPeerName()
get the name (address) of the host that sent me the message

戻り値:
The name of the sender (from the datagram packet).

getPeerAddress

public java.lang.String getPeerAddress()
get the address of the host that sent me the message

定義:
クラス MessageChannel 内の getPeerAddress
戻り値:
The senders ip address.

equals

public boolean equals(java.lang.Object other)
Compare two UDP Message channels for equality.

オーバーライド:
クラス java.lang.Object 内の equals
パラメータ:
other - The other message channel with which to compare oursleves.

getKey

public java.lang.String getKey()
クラス MessageChannel の記述:
Generate a key which identifies the message channel. This allows us to cache the message channel.

定義:
クラス MessageChannel 内の getKey

getViaHost

public java.lang.String getViaHost()
Get the logical originator of the message (from the top via header).

定義:
クラス MessageChannel 内の getViaHost
戻り値:
topmost via header sentby field

getViaPort

public int getViaPort()
Get the logical port of the message orginator (from the top via hdr).

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

isReliable

public boolean isReliable()
Returns "false" as this is an unreliable transport.

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

isSecure

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

定義:
クラス MessageChannel 内の isSecure

getPeerPort

public int getPeerPort()
クラス MessageChannel の記述:
Get the sender port ( the port of the other end that sent me the message).

定義:
クラス MessageChannel 内の getPeerPort

getPeerProtocol

public java.lang.String getPeerProtocol()

close

public void close()
Close the message channel.

定義:
クラス MessageChannel 内の close