public abstract class MessageChannel extends Object
Modifier and Type | Field and Description |
---|---|
protected MessageProcessor |
messageProcessor
Message processor to whom I belong (if set).
|
protected int |
useCount |
Constructor and Description |
---|
MessageChannel() |
Modifier and Type | Method and Description |
---|---|
abstract void |
close()
Close the message channel.
|
protected String |
createBadReqRes(String badReq,
ParseException pe)
Creates a response to a bad request (ie one that causes a ParseException)
|
SIPClientTransaction |
getEncapsulatedClientTransaction() |
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(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.
|
HostPort |
getPeerHostPort()
Get the peer host and port.
|
protected abstract InetAddress |
getPeerInetAddress() |
abstract InetAddress |
getPeerPacketSourceAddress() |
abstract int |
getPeerPacketSourcePort() |
abstract int |
getPeerPort()
Get the sender port ( the port of the other end that sent me the message).
|
protected abstract String |
getPeerProtocol() |
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 for a viaHeader.
|
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 |
logMessage(SIPMessage sipMessage,
InetAddress address,
int port,
long time)
Log a message sent to an address and port via the default interface.
|
void |
logResponse(SIPResponse sipResponse,
long receptionTime,
String status)
Log a response received at this message channel.
|
protected abstract void |
sendMessage(byte[] message,
InetAddress receiverAddress,
int receiverPort,
boolean reconnectFlag)
Send the message (after it has been formatted), to a specified address and a specified port
|
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.
|
void |
setEncapsulatedClientTransaction(SIPClientTransaction transaction) |
protected void |
uncache()
Hook method, overridden by subclasses
|
protected int useCount
protected transient MessageProcessor messageProcessor
protected void uncache()
public abstract void close()
public abstract SIPTransactionStack getSIPStack()
public abstract String getTransport()
public abstract boolean isReliable()
public abstract boolean isSecure()
public abstract void sendMessage(SIPMessage sipMessage) throws IOException
sipMessage
- Message to send.IOException
public abstract String getPeerAddress()
protected abstract InetAddress getPeerInetAddress()
protected abstract String getPeerProtocol()
public abstract int getPeerPort()
public abstract int getPeerPacketSourcePort()
public abstract InetAddress getPeerPacketSourceAddress()
public abstract String getKey()
public abstract String getViaHost()
public abstract int getViaPort()
protected abstract void sendMessage(byte[] message, InetAddress receiverAddress, int receiverPort, boolean reconnectFlag) throws IOException
message
- Message to send.receiverAddress
- Address of the receiver.receiverPort
- Port of the receiver.IOException
public String getHost()
public int getPort()
public void sendMessage(SIPMessage sipMessage, Hop hop) throws IOException
sipMessage
- Message to send.hop
- hop to send it to.IOException
- If there is an error sending the messagepublic void sendMessage(SIPMessage sipMessage, InetAddress receiverAddress, int receiverPort) throws IOException
sipMessage
- is the messge to send.receiverAddress
- is the address to which we want to sendreceiverPort
- is the port to which we want to sendIOException
public String getRawIpSourceAddress()
public static String getKey(InetAddress inetAddr, int port, String transport)
public static String getKey(HostPort hostPort, String transport)
public HostPort getHostPort()
public HostPort getPeerHostPort()
public Via getViaHeader()
public HostPort getViaHostPort()
public void logMessage(SIPMessage sipMessage, InetAddress address, int port, long time)
sipMessage
- is the message to log.address
- is the inet address to which the message is sent.port
- is the port to which the message is directed.public void logResponse(SIPResponse sipResponse, long receptionTime, String status)
receptionTime
- is the time at which the response was received.status
- is the processing status of the message.protected final String createBadReqRes(String badReq, ParseException pe)
badReq
- public MessageProcessor getMessageProcessor()
public SIPClientTransaction getEncapsulatedClientTransaction()
public void setEncapsulatedClientTransaction(SIPClientTransaction transaction)
Copyright © 2018. All Rights Reserved.