public abstract class ConnectionOrientedMessageChannel extends MessageChannel implements SIPMessageListener, Runnable, RawMessageChannel
Modifier and Type | Field and Description |
---|---|
protected boolean |
isCached |
protected boolean |
isRunning |
protected String |
key |
protected String |
myAddress |
protected InputStream |
myClientInputStream |
protected PipelinedMsgParser |
myParser |
protected int |
myPort |
protected Socket |
mySock |
protected Thread |
mythread |
protected InetAddress |
peerAddress |
protected String |
peerAddressAdvertisedInHeaders |
protected int |
peerPort |
protected int |
peerPortAdvertisedInHeaders |
protected String |
peerProtocol |
protected SIPTransactionStack |
sipStack |
messageProcessor, useCount
Constructor and Description |
---|
ConnectionOrientedMessageChannel(SIPTransactionStack sipStack) |
Modifier and Type | Method and Description |
---|---|
void |
cancelPingKeepAliveTimeoutTaskIfStarted() |
void |
close()
Close the message channel.
|
protected abstract void |
close(boolean removeSocket,
boolean stopKeepAliveTask) |
long |
getKeepAliveTimeout() |
String |
getKey()
Get an identifying key.
|
String |
getPeerAddress()
get the address of the client that sent the data to us.
|
protected InetAddress |
getPeerInetAddress() |
InetAddress |
getPeerPacketSourceAddress() |
int |
getPeerPacketSourcePort() |
int |
getPeerPort()
Get the port of the peer to whom we are sending messages.
|
String |
getPeerProtocol() |
SIPTransactionStack |
getSIPStack()
Get my SIP Stack.
|
String |
getViaHost()
Get the host to assign to outgoing messages.
|
int |
getViaPort()
Get the port for outgoing messages sent from the channel.
|
boolean |
isReliable()
Returns "true" as this is a reliable transport.
|
void |
processMessage(SIPMessage sipMessage)
Gets invoked by the parser as a callback on successful message parsing
(i.e.
|
void |
processMessage(SIPMessage sipMessage,
InetAddress address) |
void |
rescheduleKeepAliveTimeout(long newKeepAliveTimeout) |
void |
run()
This gets invoked when thread.start is called from the constructor.
|
protected abstract void |
sendMessage(byte[] msg,
boolean b) |
void |
sendMessage(SIPMessage sipMessage)
Return a formatted message to the client.
|
void |
sendSingleCLRF() |
void |
setKeepAliveTimeout(long keepAliveTimeout) |
protected void |
uncache()
Hook method, overridden by subclasses
|
createBadReqRes, getEncapsulatedClientTransaction, getHost, getHostPort, getKey, getKey, getMessageProcessor, getPeerHostPort, getPort, getRawIpSourceAddress, getTransport, getViaHeader, getViaHostPort, isSecure, logMessage, logResponse, sendMessage, sendMessage, sendMessage, setEncapsulatedClientTransaction
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
handleException
protected SIPTransactionStack sipStack
protected Socket mySock
protected PipelinedMsgParser myParser
protected String key
protected InputStream myClientInputStream
protected boolean isRunning
protected boolean isCached
protected Thread mythread
protected String myAddress
protected int myPort
protected InetAddress peerAddress
protected int peerPortAdvertisedInHeaders
protected String peerAddressAdvertisedInHeaders
protected int peerPort
protected String peerProtocol
public ConnectionOrientedMessageChannel(SIPTransactionStack sipStack)
public boolean isReliable()
isReliable
in class MessageChannel
public void close()
close
in class MessageChannel
protected abstract void close(boolean removeSocket, boolean stopKeepAliveTask)
public SIPTransactionStack getSIPStack()
getSIPStack
in class MessageChannel
public String getPeerAddress()
getPeerAddress
in class MessageChannel
protected InetAddress getPeerInetAddress()
getPeerInetAddress
in class MessageChannel
public String getPeerProtocol()
getPeerProtocol
in class MessageChannel
public void sendMessage(SIPMessage sipMessage) throws IOException
sendMessage
in class MessageChannel
sipMessage
- Message to send.IOException
- If there is an error sending the messageprotected abstract void sendMessage(byte[] msg, boolean b) throws IOException
IOException
public void processMessage(SIPMessage sipMessage, InetAddress address)
public void processMessage(SIPMessage sipMessage) throws Exception
processMessage
in interface SIPMessageListener
processMessage
in interface RawMessageChannel
sipMessage
- Message to process (this calls the application for processing
the message).
Jvb: note that this code is identical to TCPMessageChannel,
refactor some dayException
for the method that gets called
on parse exception.
public void run()
protected void uncache()
MessageChannel
uncache
in class MessageChannel
public String getKey()
getKey
in class MessageChannel
public String getViaHost()
getViaHost
in class MessageChannel
public int getViaPort()
getViaPort
in class MessageChannel
public int getPeerPort()
getPeerPort
in class MessageChannel
public int getPeerPacketSourcePort()
getPeerPacketSourcePort
in class MessageChannel
public InetAddress getPeerPacketSourceAddress()
getPeerPacketSourceAddress
in class MessageChannel
public void sendSingleCLRF() throws Exception
sendSingleCLRF
in interface SIPMessageListener
Exception
public void cancelPingKeepAliveTimeoutTaskIfStarted()
public void setKeepAliveTimeout(long keepAliveTimeout)
public long getKeepAliveTimeout()
public void rescheduleKeepAliveTimeout(long newKeepAliveTimeout)
Copyright © 2016. All Rights Reserved.