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

gov.nist.javax.sip.stack
Class MessageChannel

java.lang.Object
  extended by gov.nist.javax.sip.stack.MessageChannel
Direct Known Subclasses:
SIPTransaction, TCPMessageChannel, TLSMessageChannel, UDPMessageChannel

public abstract class MessageChannel
extends Object

Message channel abstraction for the SIP stack.

Version:
1.2 $Revision: 1.24 $ $Date: 2009/07/29 20:38:14 $
Author:
M. Ranganathan
Contains additions for support of symmetric NAT contributed by Hagai.

Constructor Summary
MessageChannel()
           
 
Method Summary
abstract  void close()
          Close the message channel.
 String getHost()
          Get the host of this message channel.
 gov.nist.core.HostPort getHostPort()
          Get the hostport structure of this message channel.
abstract  String getKey()
          Generate a key which identifies the message channel.
static String getKey(gov.nist.core.HostPort hostPort, String transport)
          Generate a key given host and port.
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.
 gov.nist.core.HostPort getPeerHostPort()
          Get the peer host and port.
abstract  InetAddress getPeerPacketSourceAddress()
           
abstract  int getPeerPacketSourcePort()
           
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  SIPTransactionStack 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.
 gov.nist.core.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  boolean isReliable()
          Get whether this channel is reliable or not.
abstract  boolean isSecure()
          Return true if this is a secure channel.
 void logResponse(SIPResponse sipResponse, long receptionTime, String status)
          Log a response received at this message channel.
abstract  void sendMessage(SIPMessage sipMessage)
          Send the message (after it has been formatted)
 void sendMessage(SIPMessage sipMessage, Hop hop)
          Send a formatted message to the specified target.
 void sendMessage(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 SIPTransactionStack 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(SIPMessage sipMessage)
                          throws IOException
Send the message (after it has been formatted)

Parameters:
sipMessage - Message to send.
Throws:
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.

getPeerPort

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


getPeerPacketSourcePort

public abstract int getPeerPacketSourcePort()

getPeerPacketSourceAddress

public abstract InetAddress getPeerPacketSourceAddress()

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.

sendMessage

public void sendMessage(SIPMessage sipMessage,
                        Hop hop)
                 throws IOException
Send a formatted message to the specified target.

Parameters:
sipMessage - Message to send.
hop - hop to send it to.
Throws:
IOException - If there is an error sending the message

sendMessage

public void sendMessage(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
Throws:
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.


getKey

public static String getKey(gov.nist.core.HostPort hostPort,
                            String transport)
Generate a key given host and port.


getHostPort

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


getPeerHostPort

public gov.nist.core.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 gov.nist.core.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(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: 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.