NIST SIP Parser and Stack (v1.2) API

gov.nist.javax.sip.stack
Class MessageChannel

java.lang.Object
  |
  +--gov.nist.javax.sip.stack.MessageChannel
Direct Known Subclasses:
SIPTransaction, TCPMessageChannel, UDPMessageChannel

public abstract class MessageChannel
extends Object

Message channel abstraction for the SIP stack.

Author:
M. Ranganathan
This code is in the public domain.

Constructor Summary
MessageChannel()
           
 
Method Summary
abstract  void close()
          Close the message channel.
 String getHost()
          Get the host of this message channel.
 HostPort getHostPort()
          Get the hostport structure of this message channel.
abstract  String getKey()
          Generate a key which identifies the message channel.
static String getKey(InetAddress inetAddr, int port, String transport)
          generate a key given the inet address port and transport.
 MessageProcessor getMessageProcessor()
          Get the message processor.
abstract  String getPeerAddress()
          Get the peer address of the machine that sent us this message.
 HostPort getPeerHostPort()
          Get the peer host and port.
abstract  String getPeerName()
          Get the name of the machine that sent us this message.
abstract  int getPeerPort()
          Get the sender port ( the port of the other end that sent me the message).
 int getPort()
          Get port of this message channel.
 String getRawIpSourceAddress()
          Convenience function to get the raw IP source address of a SIP message as a String.
abstract  SIPStack getSIPStack()
          Get the SIPStack object from this message channel.
abstract  String getTransport()
          Get transport string of this message channel.
 Via getViaHeader()
          Get the Via header for this transport.
abstract  String getViaHost()
          Get the host to assign for an outgoing Request via header.
 HostPort getViaHostPort()
          Get the via header host:port structure.
abstract  int getViaPort()
          Get the port to assign for the via header of an outgoing message.
abstract  void handleException(SIPServerException ex)
          Handle an exception.
abstract  boolean isReliable()
          Get whether this channel is reliable or not.
abstract  boolean isSecure()
          Return true if this is a secure channel.
 void logResponse(gov.nist.javax.sip.message.SIPResponse sipResponse, long receptionTime, String status)
          Log a response received at this message channel.
abstract  void sendMessage(gov.nist.javax.sip.message.SIPMessage sipMessage)
          Send the message (after it has been formatted)
 void sendMessage(gov.nist.javax.sip.message.SIPMessage sipMessage, InetAddress receiverAddress, int receiverPort)
          Send a message given SIP message.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageChannel

public MessageChannel()
Method Detail

close

public abstract void close()
Close the message channel.


getSIPStack

public abstract SIPStack getSIPStack()
Get the SIPStack object from this message channel.

Returns:
SIPStack object of this message channel

getTransport

public abstract String getTransport()
Get transport string of this message channel.

Returns:
Transport string of this message channel.

isReliable

public abstract boolean isReliable()
Get whether this channel is reliable or not.

Returns:
True if reliable, false if not.

isSecure

public abstract boolean isSecure()
Return true if this is a secure channel.


sendMessage

public abstract void sendMessage(gov.nist.javax.sip.message.SIPMessage sipMessage)
                          throws IOException
Send the message (after it has been formatted)

Parameters:
sipMessage - Message to send.
IOException

getPeerAddress

public abstract String getPeerAddress()
Get the peer address of the machine that sent us this message.

Returns:
a string contianing the ip address or host name of the sender of the message.

getPeerName

public abstract String getPeerName()
Get the name of the machine that sent us this message.

Returns:
a string contianing the ip address or host name of the sender of the message.

getPeerPort

public abstract int getPeerPort()
Get the sender port ( the port of the other end that sent me the message).


getKey

public abstract String getKey()
Generate a key which identifies the message channel. This allows us to cache the message channel.


getViaHost

public abstract String getViaHost()
Get the host to assign for an outgoing Request via header.


getViaPort

public abstract int getViaPort()
Get the port to assign for the via header of an outgoing message.


getHost

public String getHost()
Get the host of this message channel.

Returns:
host of this messsage channel.

getPort

public int getPort()
Get port of this message channel.

Returns:
Port of this message channel.

handleException

public abstract void handleException(SIPServerException ex)
Handle an exception.


sendMessage

public void sendMessage(gov.nist.javax.sip.message.SIPMessage sipMessage,
                        InetAddress receiverAddress,
                        int receiverPort)
                 throws IOException
Send a message given SIP message.

Parameters:
sipMessage - is the messge to send.
receiverAddress - is the address to which we want to send
receiverPort - is the port to which we want to send
IOException

getRawIpSourceAddress

public String getRawIpSourceAddress()
Convenience function to get the raw IP source address of a SIP message as a String.


getKey

public static String getKey(InetAddress inetAddr,
                            int port,
                            String transport)
generate a key given the inet address port and transport.


getHostPort

public HostPort getHostPort()
Get the hostport structure of this message channel.


getPeerHostPort

public HostPort getPeerHostPort()
Get the peer host and port.

Returns:
a HostPort structure for the peer.

getViaHeader

public Via getViaHeader()
Get the Via header for this transport. Note that this does not set a branch identifier.

Returns:
a via header for outgoing messages sent from this channel.

getViaHostPort

public HostPort getViaHostPort()
Get the via header host:port structure. This is extracted from the topmost via header of the request.

Returns:
a host:port structure

logResponse

public void logResponse(gov.nist.javax.sip.message.SIPResponse sipResponse,
                        long receptionTime,
                        String status)
Log a response received at this message channel. This is used for processing incoming responses to a client transaction.

Parameters:
receptionTime - is the time at which the response was received.
status - is the processing status of the message.

getMessageProcessor

public MessageProcessor getMessageProcessor()
Get the message processor.


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.